Browse Source
fixes https://github.com/spesmilo/electrum/issues/8813 regression frommastereef9680743We started setting the witness field in above commit to be able to provide the witnesses for already pre-signed external inputs to the device, e.g. for a coinjoin. Trezor One fw has pretty strict limits on the witness field: max 109 bytes, probably because that's a ~tight upper bound for a p2wpkh witness: <num_witness_items> <len(sig)> <sig> <len(pubkey)> <pubkey>, it comes out to 3+73(high-S and high-R)+33.ed1785a985/legacy/firmware/protob/messages-bitcoin.options (L35)Trezor model T seems to have higher limits. tx_inputs is called for the tx being signed (for_sig=True), and for its parents/prev_txes (for_sig=False). The witness is only useful for the tx being signed, I think. Users reported seeing a "DataError: bytes overflow" exception when using a Trezor One to sign 2of3 p2wsh multisig txs. There were no external inputs involved so for the tx being signed all witnesses were None, however we were also setting the witness for the inputs of prev_txes. The witness for a 2of3 pw2sh multisig input is around ~253 bytes. To sidestep the problem, we now only set the witness in the for_sig=True case. Note that this means if someone tries to do a coinjoin with a Trezor One involving non-trivial external inputs, they will run into the same limit and exception.
1 changed files with 3 additions and 1 deletions
Loading…
Reference in new issue