diff options
author | kallewoof <karljohan-alm@garage.co.jp> | 2023-03-08 12:57:13 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-08 12:57:13 +0900 |
commit | 4e4db8ba123aa8e9cba8cc4d2f700b9724cb8963 (patch) | |
tree | 11ddfb8935fb9a01ae3d4c06c96bb7899f72c82c | |
parent | e98121e531ba6cbe0ee67b9ad602b7f3ee8f612a (diff) | |
parent | e538fa8562fe26f814e544836991048383d225af (diff) | |
download | bips-4e4db8ba123aa8e9cba8cc4d2f700b9724cb8963.tar.xz |
Merge pull request #1430 from bigspider/psbtv0-fix-signing-algo
PSBTv0: Update Simple Signer Algorithm for SegWitv0 inputs
-rw-r--r-- | bip-0174.mediawiki | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/bip-0174.mediawiki b/bip-0174.mediawiki index 6a5d5e8..f4c0807 100644 --- a/bip-0174.mediawiki +++ b/bip-0174.mediawiki @@ -718,15 +718,8 @@ sign_non_witness(script_code, i): if IsMine(key) and IsAcceptable(sighash_type): sign(non_witness_sighash(script_code, i, input)) -for input,i in enumerate(psbt.inputs): - if non_witness_utxo.exists: - assert(sha256d(non_witness_utxo) == psbt.tx.input[i].prevout.hash) - if redeemScript.exists: - assert(non_witness_utxo.vout[psbt.tx.input[i].prevout.n].scriptPubKey == P2SH(redeemScript)) - sign_non_witness(redeemScript, i) - else: - sign_non_witness(non_witness_utxo.vout[psbt.tx.input[i].prevout.n].scriptPubKey, i) - else if witness_utxo.exists: +for input, i in enumerate(psbt.inputs): + if witness_utxo.exists: if redeemScript.exists: assert(witness_utxo.scriptPubKey == P2SH(redeemScript)) script = redeemScript @@ -737,6 +730,13 @@ for input,i in enumerate(psbt.inputs): else if IsP2WSH(script): assert(script == P2WSH(witnessScript)) sign_witness(witnessScript, i) + else if non_witness_utxo.exists: + assert(sha256d(non_witness_utxo) == psbt.tx.input[i].prevout.hash) + if redeemScript.exists: + assert(non_witness_utxo.vout[psbt.tx.input[i].prevout.n].scriptPubKey == P2SH(redeemScript)) + sign_non_witness(redeemScript, i) + else: + sign_non_witness(non_witness_utxo.vout[psbt.tx.input[i].prevout.n].scriptPubKey, i) else: assert False </pre> |