mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-12 06:58:57 +01:00
Make STRICTENC invalid pubkeys fail the script rather than the opcode.
This turns STRICTENC turn into a softforking-safe change (even though it is not intended as a consensus rule), and as a result guarantee that using it for mempool validation only results in consensus-valid transactions in the mempool.
This commit is contained in:
@@ -428,15 +428,24 @@ BOOST_AUTO_TEST_CASE(script_build)
|
||||
bad.push_back(TestBuilder(CScript() << ToByteVector(keys.pubkey0H) << OP_CHECKSIG << OP_NOT,
|
||||
"P2PK NOT with hybrid pubkey but no STRICTENC", 0
|
||||
).PushSig(keys.key0, SIGHASH_ALL));
|
||||
good.push_back(TestBuilder(CScript() << ToByteVector(keys.pubkey0H) << OP_CHECKSIG << OP_NOT,
|
||||
"P2PK NOT with hybrid pubkey", SCRIPT_VERIFY_STRICTENC
|
||||
).PushSig(keys.key0, SIGHASH_ALL));
|
||||
bad.push_back(TestBuilder(CScript() << ToByteVector(keys.pubkey0H) << OP_CHECKSIG << OP_NOT,
|
||||
"P2PK NOT with hybrid pubkey", SCRIPT_VERIFY_STRICTENC
|
||||
).PushSig(keys.key0, SIGHASH_ALL));
|
||||
good.push_back(TestBuilder(CScript() << ToByteVector(keys.pubkey0H) << OP_CHECKSIG << OP_NOT,
|
||||
"P2PK NOT with invalid hybrid pubkey but no STRICTENC", 0
|
||||
).PushSig(keys.key0, SIGHASH_ALL).DamagePush(10));
|
||||
good.push_back(TestBuilder(CScript() << ToByteVector(keys.pubkey0H) << OP_CHECKSIG << OP_NOT,
|
||||
"P2PK NOT with invalid hybrid pubkey", SCRIPT_VERIFY_STRICTENC
|
||||
).PushSig(keys.key0, SIGHASH_ALL).DamagePush(10));
|
||||
bad.push_back(TestBuilder(CScript() << ToByteVector(keys.pubkey0H) << OP_CHECKSIG << OP_NOT,
|
||||
"P2PK NOT with invalid hybrid pubkey", SCRIPT_VERIFY_STRICTENC
|
||||
).PushSig(keys.key0, SIGHASH_ALL).DamagePush(10));
|
||||
good.push_back(TestBuilder(CScript() << OP_1 << ToByteVector(keys.pubkey0H) << ToByteVector(keys.pubkey1C) << OP_2 << OP_CHECKMULTISIG,
|
||||
"1-of-2 with the second 1 hybrid pubkey and no STRICTENC", 0
|
||||
).Num(0).PushSig(keys.key1, SIGHASH_ALL));
|
||||
good.push_back(TestBuilder(CScript() << OP_1 << ToByteVector(keys.pubkey0H) << ToByteVector(keys.pubkey1C) << OP_2 << OP_CHECKMULTISIG,
|
||||
"1-of-2 with the second 1 hybrid pubkey", SCRIPT_VERIFY_STRICTENC
|
||||
).Num(0).PushSig(keys.key1, SIGHASH_ALL));
|
||||
bad.push_back(TestBuilder(CScript() << OP_1 << ToByteVector(keys.pubkey1C) << ToByteVector(keys.pubkey0H) << OP_2 << OP_CHECKMULTISIG,
|
||||
"1-of-2 with the first 1 hybrid pubkey", SCRIPT_VERIFY_STRICTENC
|
||||
).Num(0).PushSig(keys.key1, SIGHASH_ALL));
|
||||
|
||||
good.push_back(TestBuilder(CScript() << ToByteVector(keys.pubkey1) << OP_CHECKSIG,
|
||||
"P2PK with undefined hashtype but no STRICTENC", 0
|
||||
|
||||
Reference in New Issue
Block a user