Repository navigation
BIP375: check SegWit versions in non-witness UTXOs - #2310
zjubiology wants to merge 1 commit into
Conversation
|
@achow101 @andrewtoth Could you please take a look when you have a chance? Thanks! |
fametrano
left a comment
There was a problem hiding this comment.
The validator change holds: at ea1192c, master (927b6de) accepts the new vector under input_eligibility, this branch rejects it with "Input 0 uses segwit version > 1 with silent payments", and all 43 vectors pass.
The vector's PSBT_IN_PREVIOUS_TXID is byte-reversed. The field holds 9630266b…0c73c9; the double-SHA256 of the PSBT_IN_NON_WITNESS_UTXO transaction is c9730c1b…263096. BIP 174 requires the two to match ("its hash must match the hash specified in the prevout"), and the six existing vectors with a non-witness UTXO store the hash as computed, so a parser that checks this rejects the PSBT for the wrong reason. Reversing the 32 bytes of PSBT_IN_PREVIOUS_TXID, and of prevout_txid in supplementary to match the other vectors, fixes it.
Signed-off-by: zjubiology <zjubiology@outlook.com>
|
ACK 242bfbe The new vector's PSBT_IN_PREVIOUS_TXID now matches its non-witness UTXO, the test runner passes 43/43, and the vector is still rejected for the segwit version. |
Thanks for the review and ACK! |
|
@fametrano Thanks for your review! If there's anything need I to do, please feel free to let me know. |
BIP375 requires constructors and signers to reject PSBTs that combine silent payment outputs with inputs spending SegWit v2+ outputs.
The reference validator currently performs this check only when the prevout is provided through
PSBT_IN_WITNESS_UTXO. BIP174 also permits SegWit inputs to provide the full previous transaction throughPSBT_IN_NON_WITNESS_UTXO, so an input containing only that field can currently bypass the SegWit-version check.Reuse the existing
_script_pubkey_from_psbt_input()helper when validating input eligibility. This extracts the referenced scriptPubKey from either UTXO field.Also add an invalid test vector containing:
PSBT_IN_NON_WITNESS_UTXO;