Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed in PR #94 - is_signature_ok returns True for MULTISIG even though signatures appear out-of-order #93

Closed
posita opened this issue Feb 27, 2015 · 1 comment

Comments

@posita
Copy link
Contributor

posita commented Feb 27, 2015

From https://bitcoin.org/en/developer-reference#term-op-checkmultisig:

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 comparison
tx2.tx_from_hex(tx1.as_hex())
tx2.set_unspents(tx1.unspents)

# sign tx1 in one order
tx1.sign(k1)
tx1.sign(k2)

# sign tx2 in the reverse order
tx2.sign(k2)
tx2.sign(k1)

# check some stuff
assert tx1.is_signature_ok(0) # works
assert tx2.is_signature_ok(0) # works (should fail if the next assertion fails)
assert tx1.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).

@posita 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
@richardkiss
Copy link
Owner

Fixed in v0.62

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants