You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Because public keys are not checked again if they fail any signature comparison, signatures must be placed in the signature script using the same order as their corresponding public keys were placed in the pubkey script or redeem script. See the OP_CHECKMULTISIG warning below for more details.
Right now, pycoin behaves like this:
# start with tx1 (not shown) which has one TxIn that consumes# a 2-of-2 multisig with keys k1 and k2 (in that order)# make a copy of tx1 for comparisontx2.tx_from_hex(tx1.as_hex())
tx2.set_unspents(tx1.unspents)
# sign tx1 in one ordertx1.sign(k1)
tx1.sign(k2)
# sign tx2 in the reverse ordertx2.sign(k2)
tx2.sign(k1)
# check some stuffasserttx1.is_signature_ok(0) # worksasserttx2.is_signature_ok(0) # works (should fail if the next assertion fails)asserttx1.txs_in[0].script==tx2.txs_in[0].script# fails (should work if the previous assertion works)# an inspection of tx2.txs_in[0].script will reveal that the# order of the signatures is inverted from that of# tx1.txs_in[0].script
Either the last two assertions should both fail, or both work, but only the first works right now (which is the bug).
The text was updated successfully, but these errors were encountered:
posita
changed the title
is_signature_ok returns True for MULTISIG even though signatures appear out-of-order
Fixed in PR #94 - is_signature_ok returns True for MULTISIG even though signatures appear out-of-order
Mar 6, 2015
From https://bitcoin.org/en/developer-reference#term-op-checkmultisig:
Right now,
pycoin
behaves like this:Either the last two assertions should both fail, or both work, but only the first works right now (which is the bug).
The text was updated successfully, but these errors were encountered: