Merge bitcoin/bitcoin#33183: validation: rename block script verification error from "mandatory" to "block"
c0d91fc69cAdd release note for #33050 and #33183 error string changes (Antoine Poinsot)b3f781a0efcontrib: adapt max reject string size in tracing demo (Antoine Poinsot)9a04635432scripted-diff: validation: rename mandatory errors into block errors (Antoine Poinsot) Pull request description: This is a followup to #33050 now that it's merged. Using "block"/"mempool" as the error reason is clearer to a user than "mandatory"/"non-mandatory". The "non-mandatory" errors got renamed to "mempool" in #33050 (see https://github.com/bitcoin/bitcoin/pull/33050#discussion_r2230103371). This takes care of the second part of the renaming. ACKs for top commit: fjahr: utACKc0d91fc69cdavidgumberg: lgtm ACK https://github.com/bitcoin/bitcoin/commit/c0d91fc69c67e6f7123326d4f3caeac069d2637b ajtowns: utACKc0d91fc69cCrypt-iQ: utACKc0d91fc69cjanb84: utACKc0d91fc69cinstagibbs: ACKc0d91fc69cTree-SHA512: b463e633c57dd1eae7c49d23239a59066a672f355142ec194982eddc927a7646bc5cde583dc8d6f45075bf5cbb96dbe73f7e339e728929b0eff356b674d1b68c
This commit is contained in:
12 files changed
+37
-30
No files matched your search
@@ -17,9 +17,9 @@ from bcc import BPF, USDT
|
|||||||
PROGRAM = """
|
PROGRAM = """
|
||||||
# include <uapi/linux/ptrace.h>
|
# include <uapi/linux/ptrace.h>
|
||||||
|
|
||||||
// The longest rejection reason is 118 chars and is generated in case of SCRIPT_ERR_EVAL_FALSE by
|
// The longest rejection reason is 114 chars and is generated in case of SCRIPT_ERR_EVAL_FALSE by
|
||||||
// strprintf("mandatory-script-verify-flag-failed (%s)", ScriptErrorString(check.GetScriptError()))
|
// strprintf("block-script-verify-flag-failed (%s)", ScriptErrorString(check.GetScriptError()))
|
||||||
#define MAX_REJECT_REASON_LENGTH 118
|
#define MAX_REJECT_REASON_LENGTH 114
|
||||||
// The longest string returned by RemovalReasonToString() is 'sizelimit'
|
// The longest string returned by RemovalReasonToString() is 'sizelimit'
|
||||||
#define MAX_REMOVAL_REASON_LENGTH 9
|
#define MAX_REMOVAL_REASON_LENGTH 9
|
||||||
#define HASH_LENGTH 32
|
#define HASH_LENGTH 32
|
||||||
|
|||||||
@@ -0,0 +1,7 @@
|
|||||||
|
Updated RPCs
|
||||||
|
------------
|
||||||
|
|
||||||
|
Transaction Script validation errors used to return the reason for the error prefixed by either
|
||||||
|
"mandatory-script-verify-flag-failed" if it was a consensus error, or "non-mandatory-script-verify-flag"
|
||||||
|
(without "-failed") if it was a standardness error. This has been changed to "block-script-verify-flag-failed"
|
||||||
|
and "mempool-script-verify-flag-failed" for all block and mempool errors respectively.
|
||||||
@@ -450,7 +450,7 @@ void MinerTestingSetup::TestBasicMining(const CScript& scriptPubKey, const std::
|
|||||||
tx.vout[0].nValue -= LOWFEE;
|
tx.vout[0].nValue -= LOWFEE;
|
||||||
hash = tx.GetHash();
|
hash = tx.GetHash();
|
||||||
AddToMempool(tx_mempool, entry.Fee(LOWFEE).Time(Now<NodeSeconds>()).SpendsCoinbase(false).FromTx(tx));
|
AddToMempool(tx_mempool, entry.Fee(LOWFEE).Time(Now<NodeSeconds>()).SpendsCoinbase(false).FromTx(tx));
|
||||||
BOOST_CHECK_EXCEPTION(mining->createNewBlock(options), std::runtime_error, HasReason("mandatory-script-verify-flag-failed"));
|
BOOST_CHECK_EXCEPTION(mining->createNewBlock(options), std::runtime_error, HasReason("block-script-verify-flag-failed"));
|
||||||
|
|
||||||
// Delete the dummy blocks again.
|
// Delete the dummy blocks again.
|
||||||
while (m_node.chainman->ActiveChain().Tip()->nHeight > nHeight) {
|
while (m_node.chainman->ActiveChain().Tip()->nHeight > nHeight) {
|
||||||
|
|||||||
+2
-2
@@ -2200,7 +2200,7 @@ bool CheckInputScripts(const CTransaction& tx, TxValidationState& state,
|
|||||||
if (flags & STANDARD_NOT_MANDATORY_VERIFY_FLAGS) {
|
if (flags & STANDARD_NOT_MANDATORY_VERIFY_FLAGS) {
|
||||||
return state.Invalid(TxValidationResult::TX_NOT_STANDARD, strprintf("mempool-script-verify-flag-failed (%s)", ScriptErrorString(result->first)), result->second);
|
return state.Invalid(TxValidationResult::TX_NOT_STANDARD, strprintf("mempool-script-verify-flag-failed (%s)", ScriptErrorString(result->first)), result->second);
|
||||||
} else {
|
} else {
|
||||||
return state.Invalid(TxValidationResult::TX_CONSENSUS, strprintf("mandatory-script-verify-flag-failed (%s)", ScriptErrorString(result->first)), result->second);
|
return state.Invalid(TxValidationResult::TX_CONSENSUS, strprintf("block-script-verify-flag-failed (%s)", ScriptErrorString(result->first)), result->second);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2674,7 +2674,7 @@ bool Chainstate::ConnectBlock(const CBlock& block, BlockValidationState& state,
|
|||||||
if (control) {
|
if (control) {
|
||||||
auto parallel_result = control->Complete();
|
auto parallel_result = control->Complete();
|
||||||
if (parallel_result.has_value() && state.IsValid()) {
|
if (parallel_result.has_value() && state.IsValid()) {
|
||||||
state.Invalid(BlockValidationResult::BLOCK_CONSENSUS, strprintf("mandatory-script-verify-flag-failed (%s)", ScriptErrorString(parallel_result->first)), parallel_result->second);
|
state.Invalid(BlockValidationResult::BLOCK_CONSENSUS, strprintf("block-script-verify-flag-failed (%s)", ScriptErrorString(parallel_result->first)), parallel_result->second);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!state.IsValid()) {
|
if (!state.IsValid()) {
|
||||||
|
|||||||
@@ -260,7 +260,7 @@ def getDisabledOpcodeTemplate(opcode):
|
|||||||
class NonStandardAndInvalid(BadTxTemplate):
|
class NonStandardAndInvalid(BadTxTemplate):
|
||||||
"""A non-standard transaction which is also consensus-invalid should return the first error."""
|
"""A non-standard transaction which is also consensus-invalid should return the first error."""
|
||||||
reject_reason = "mempool-script-verify-flag-failed (Using OP_CODESEPARATOR in non-witness script)"
|
reject_reason = "mempool-script-verify-flag-failed (Using OP_CODESEPARATOR in non-witness script)"
|
||||||
block_reject_reason = "mandatory-script-verify-flag-failed (OP_RETURN was encountered)"
|
block_reject_reason = "block-script-verify-flag-failed (OP_RETURN was encountered)"
|
||||||
valid_in_block = False
|
valid_in_block = False
|
||||||
|
|
||||||
def get_tx(self):
|
def get_tx(self):
|
||||||
|
|||||||
@@ -191,7 +191,7 @@ class FullBlockTest(BitcoinTestFramework):
|
|||||||
badblock = self.update_block(blockname, [badtx])
|
badblock = self.update_block(blockname, [badtx])
|
||||||
reject_reason = (template.block_reject_reason or template.reject_reason)
|
reject_reason = (template.block_reject_reason or template.reject_reason)
|
||||||
if reject_reason.startswith("mempool-script-verify-flag-failed"):
|
if reject_reason.startswith("mempool-script-verify-flag-failed"):
|
||||||
reject_reason = "mandatory-script-verify-flag-failed" + reject_reason[33:]
|
reject_reason = "block-script-verify-flag-failed" + reject_reason[33:]
|
||||||
self.send_blocks(
|
self.send_blocks(
|
||||||
[badblock], success=False,
|
[badblock], success=False,
|
||||||
reject_reason=reject_reason,
|
reject_reason=reject_reason,
|
||||||
|
|||||||
@@ -153,7 +153,7 @@ class BIP65Test(BitcoinTestFramework):
|
|||||||
coin_vout = coin.prevout.n
|
coin_vout = coin.prevout.n
|
||||||
cltv_invalidate(spendtx, i)
|
cltv_invalidate(spendtx, i)
|
||||||
|
|
||||||
blk_rej = "mandatory-script-verify-flag-failed"
|
blk_rej = "block-script-verify-flag-failed"
|
||||||
tx_rej = "mempool-script-verify-flag-failed"
|
tx_rej = "mempool-script-verify-flag-failed"
|
||||||
expected_cltv_reject_reason = [
|
expected_cltv_reject_reason = [
|
||||||
" (Operation not valid with the current stack size)",
|
" (Operation not valid with the current stack size)",
|
||||||
|
|||||||
@@ -403,9 +403,9 @@ class BIP68_112_113Test(BitcoinTestFramework):
|
|||||||
|
|
||||||
# -1 OP_CSV tx and (empty stack) OP_CSV tx should fail
|
# -1 OP_CSV tx and (empty stack) OP_CSV tx should fail
|
||||||
self.send_blocks([self.create_test_block([bip112tx_special_v1])], success=False,
|
self.send_blocks([self.create_test_block([bip112tx_special_v1])], success=False,
|
||||||
reject_reason='mandatory-script-verify-flag-failed (Negative locktime)')
|
reject_reason='block-script-verify-flag-failed (Negative locktime)')
|
||||||
self.send_blocks([self.create_test_block([bip112tx_emptystack_v1])], success=False,
|
self.send_blocks([self.create_test_block([bip112tx_emptystack_v1])], success=False,
|
||||||
reject_reason='mandatory-script-verify-flag-failed (Operation not valid with the current stack size)')
|
reject_reason='block-script-verify-flag-failed (Operation not valid with the current stack size)')
|
||||||
# If SEQUENCE_LOCKTIME_DISABLE_FLAG is set in argument to OP_CSV, version 1 txs should still pass
|
# If SEQUENCE_LOCKTIME_DISABLE_FLAG is set in argument to OP_CSV, version 1 txs should still pass
|
||||||
|
|
||||||
success_txs = [tx['tx'] for tx in bip112txs_vary_OP_CSV_v1 if tx['sdf']]
|
success_txs = [tx['tx'] for tx in bip112txs_vary_OP_CSV_v1 if tx['sdf']]
|
||||||
@@ -420,15 +420,15 @@ class BIP68_112_113Test(BitcoinTestFramework):
|
|||||||
fail_txs += [tx['tx'] for tx in bip112txs_vary_OP_CSV_9_v1 if not tx['sdf']]
|
fail_txs += [tx['tx'] for tx in bip112txs_vary_OP_CSV_9_v1 if not tx['sdf']]
|
||||||
for tx in fail_txs:
|
for tx in fail_txs:
|
||||||
self.send_blocks([self.create_test_block([tx])], success=False,
|
self.send_blocks([self.create_test_block([tx])], success=False,
|
||||||
reject_reason='mandatory-script-verify-flag-failed (Locktime requirement not satisfied)')
|
reject_reason='block-script-verify-flag-failed (Locktime requirement not satisfied)')
|
||||||
|
|
||||||
self.log.info("Test version 2 txs")
|
self.log.info("Test version 2 txs")
|
||||||
|
|
||||||
# -1 OP_CSV tx and (empty stack) OP_CSV tx should fail
|
# -1 OP_CSV tx and (empty stack) OP_CSV tx should fail
|
||||||
self.send_blocks([self.create_test_block([bip112tx_special_v2])], success=False,
|
self.send_blocks([self.create_test_block([bip112tx_special_v2])], success=False,
|
||||||
reject_reason='mandatory-script-verify-flag-failed (Negative locktime)')
|
reject_reason='block-script-verify-flag-failed (Negative locktime)')
|
||||||
self.send_blocks([self.create_test_block([bip112tx_emptystack_v2])], success=False,
|
self.send_blocks([self.create_test_block([bip112tx_emptystack_v2])], success=False,
|
||||||
reject_reason='mandatory-script-verify-flag-failed (Operation not valid with the current stack size)')
|
reject_reason='block-script-verify-flag-failed (Operation not valid with the current stack size)')
|
||||||
|
|
||||||
# If SEQUENCE_LOCKTIME_DISABLE_FLAG is set in argument to OP_CSV, version 2 txs should pass (all sequence locks are met)
|
# If SEQUENCE_LOCKTIME_DISABLE_FLAG is set in argument to OP_CSV, version 2 txs should pass (all sequence locks are met)
|
||||||
success_txs = [tx['tx'] for tx in bip112txs_vary_OP_CSV_v2 if tx['sdf']]
|
success_txs = [tx['tx'] for tx in bip112txs_vary_OP_CSV_v2 if tx['sdf']]
|
||||||
@@ -444,20 +444,20 @@ class BIP68_112_113Test(BitcoinTestFramework):
|
|||||||
fail_txs += [tx['tx'] for tx in bip112txs_vary_OP_CSV_9_v2 if not tx['sdf']]
|
fail_txs += [tx['tx'] for tx in bip112txs_vary_OP_CSV_9_v2 if not tx['sdf']]
|
||||||
for tx in fail_txs:
|
for tx in fail_txs:
|
||||||
self.send_blocks([self.create_test_block([tx])], success=False,
|
self.send_blocks([self.create_test_block([tx])], success=False,
|
||||||
reject_reason='mandatory-script-verify-flag-failed (Locktime requirement not satisfied)')
|
reject_reason='block-script-verify-flag-failed (Locktime requirement not satisfied)')
|
||||||
|
|
||||||
# If SEQUENCE_LOCKTIME_DISABLE_FLAG is set in nSequence, tx should fail
|
# If SEQUENCE_LOCKTIME_DISABLE_FLAG is set in nSequence, tx should fail
|
||||||
fail_txs = [tx['tx'] for tx in bip112txs_vary_nSequence_v2 if tx['sdf']]
|
fail_txs = [tx['tx'] for tx in bip112txs_vary_nSequence_v2 if tx['sdf']]
|
||||||
for tx in fail_txs:
|
for tx in fail_txs:
|
||||||
self.send_blocks([self.create_test_block([tx])], success=False,
|
self.send_blocks([self.create_test_block([tx])], success=False,
|
||||||
reject_reason='mandatory-script-verify-flag-failed (Locktime requirement not satisfied)')
|
reject_reason='block-script-verify-flag-failed (Locktime requirement not satisfied)')
|
||||||
|
|
||||||
# If sequencelock types mismatch, tx should fail
|
# If sequencelock types mismatch, tx should fail
|
||||||
fail_txs = [tx['tx'] for tx in bip112txs_vary_nSequence_v2 if not tx['sdf'] and tx['stf']]
|
fail_txs = [tx['tx'] for tx in bip112txs_vary_nSequence_v2 if not tx['sdf'] and tx['stf']]
|
||||||
fail_txs += [tx['tx'] for tx in bip112txs_vary_OP_CSV_v2 if not tx['sdf'] and tx['stf']]
|
fail_txs += [tx['tx'] for tx in bip112txs_vary_OP_CSV_v2 if not tx['sdf'] and tx['stf']]
|
||||||
for tx in fail_txs:
|
for tx in fail_txs:
|
||||||
self.send_blocks([self.create_test_block([tx])], success=False,
|
self.send_blocks([self.create_test_block([tx])], success=False,
|
||||||
reject_reason='mandatory-script-verify-flag-failed (Locktime requirement not satisfied)')
|
reject_reason='block-script-verify-flag-failed (Locktime requirement not satisfied)')
|
||||||
|
|
||||||
# Remaining txs should pass, just test masking works properly
|
# Remaining txs should pass, just test masking works properly
|
||||||
success_txs = [tx['tx'] for tx in bip112txs_vary_nSequence_v2 if not tx['sdf'] and not tx['stf']]
|
success_txs = [tx['tx'] for tx in bip112txs_vary_nSequence_v2 if not tx['sdf'] and not tx['stf']]
|
||||||
|
|||||||
@@ -133,7 +133,7 @@ class BIP66Test(BitcoinTestFramework):
|
|||||||
block.hashMerkleRoot = block.calc_merkle_root()
|
block.hashMerkleRoot = block.calc_merkle_root()
|
||||||
block.solve()
|
block.solve()
|
||||||
|
|
||||||
with self.nodes[0].assert_debug_log(expected_msgs=['Block validation error: mandatory-script-verify-flag-failed (Non-canonical DER signature)']):
|
with self.nodes[0].assert_debug_log(expected_msgs=['Block validation error: block-script-verify-flag-failed (Non-canonical DER signature)']):
|
||||||
peer.send_and_ping(msg_block(block))
|
peer.send_and_ping(msg_block(block))
|
||||||
assert_equal(int(self.nodes[0].getbestblockhash(), 16), tip)
|
assert_equal(int(self.nodes[0].getbestblockhash(), 16), tip)
|
||||||
peer.sync_with_ping()
|
peer.sync_with_ping()
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ from test_framework.wallet import getnewdestination
|
|||||||
from test_framework.wallet_util import generate_keypair
|
from test_framework.wallet_util import generate_keypair
|
||||||
|
|
||||||
NULLDUMMY_TX_ERROR = "mempool-script-verify-flag-failed (Dummy CHECKMULTISIG argument must be zero)"
|
NULLDUMMY_TX_ERROR = "mempool-script-verify-flag-failed (Dummy CHECKMULTISIG argument must be zero)"
|
||||||
NULLDUMMY_BLK_ERROR = "mandatory-script-verify-flag-failed (Dummy CHECKMULTISIG argument must be zero)"
|
NULLDUMMY_BLK_ERROR = "block-script-verify-flag-failed (Dummy CHECKMULTISIG argument must be zero)"
|
||||||
|
|
||||||
def invalidate_nulldummy_tx(tx):
|
def invalidate_nulldummy_tx(tx):
|
||||||
"""Transform a NULLDUMMY compliant tx (i.e. scriptSig starts with OP_0)
|
"""Transform a NULLDUMMY compliant tx (i.e. scriptSig starts with OP_0)
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ MEMPOOL_TRACEPOINTS_PROGRAM = """
|
|||||||
# include <uapi/linux/ptrace.h>
|
# include <uapi/linux/ptrace.h>
|
||||||
|
|
||||||
// The longest rejection reason is 118 chars and is generated in case of SCRIPT_ERR_EVAL_FALSE by
|
// The longest rejection reason is 118 chars and is generated in case of SCRIPT_ERR_EVAL_FALSE by
|
||||||
// strprintf("mandatory-script-verify-flag-failed (%s)", ScriptErrorString(check.GetScriptError()))
|
// strprintf("block-script-verify-flag-failed (%s)", ScriptErrorString(check.GetScriptError()))
|
||||||
#define MAX_REJECT_REASON_LENGTH 118
|
#define MAX_REJECT_REASON_LENGTH 118
|
||||||
// The longest string returned by RemovalReasonToString() is 'sizelimit'
|
// The longest string returned by RemovalReasonToString() is 'sizelimit'
|
||||||
#define MAX_REMOVAL_REASON_LENGTH 9
|
#define MAX_REMOVAL_REASON_LENGTH 9
|
||||||
|
|||||||
@@ -505,7 +505,7 @@ class SegWitTest(BitcoinTestFramework):
|
|||||||
# invalid (transactions are always validated with SCRIPT_VERIFY_WITNESS so a segwit v0 transaction
|
# invalid (transactions are always validated with SCRIPT_VERIFY_WITNESS so a segwit v0 transaction
|
||||||
# without a witness is invalid).
|
# without a witness is invalid).
|
||||||
test_witness_block(self.nodes[0], self.test_node, block, accepted=False, with_witness=False,
|
test_witness_block(self.nodes[0], self.test_node, block, accepted=False, with_witness=False,
|
||||||
reason='mandatory-script-verify-flag-failed (Witness program was passed an empty witness)')
|
reason='block-script-verify-flag-failed (Witness program was passed an empty witness)')
|
||||||
|
|
||||||
self.utxo.pop(0)
|
self.utxo.pop(0)
|
||||||
self.utxo.append(UTXO(txid, 2, value))
|
self.utxo.append(UTXO(txid, 2, value))
|
||||||
@@ -977,7 +977,7 @@ class SegWitTest(BitcoinTestFramework):
|
|||||||
|
|
||||||
# Extra witness data should not be allowed.
|
# Extra witness data should not be allowed.
|
||||||
test_witness_block(self.nodes[0], self.test_node, block, accepted=False,
|
test_witness_block(self.nodes[0], self.test_node, block, accepted=False,
|
||||||
reason='mandatory-script-verify-flag-failed (Witness provided for non-witness script)')
|
reason='block-script-verify-flag-failed (Witness provided for non-witness script)')
|
||||||
|
|
||||||
# Try extra signature data. Ok if we're not spending a witness output.
|
# Try extra signature data. Ok if we're not spending a witness output.
|
||||||
block.vtx[1].wit.vtxinwit = []
|
block.vtx[1].wit.vtxinwit = []
|
||||||
@@ -1002,7 +1002,7 @@ class SegWitTest(BitcoinTestFramework):
|
|||||||
|
|
||||||
# This has extra witness data, so it should fail.
|
# This has extra witness data, so it should fail.
|
||||||
test_witness_block(self.nodes[0], self.test_node, block, accepted=False,
|
test_witness_block(self.nodes[0], self.test_node, block, accepted=False,
|
||||||
reason='mandatory-script-verify-flag-failed (Stack size must be exactly one after execution)')
|
reason='block-script-verify-flag-failed (Stack size must be exactly one after execution)')
|
||||||
|
|
||||||
# Now get rid of the extra witness, but add extra scriptSig data
|
# Now get rid of the extra witness, but add extra scriptSig data
|
||||||
tx2.vin[0].scriptSig = CScript([OP_TRUE])
|
tx2.vin[0].scriptSig = CScript([OP_TRUE])
|
||||||
@@ -1014,7 +1014,7 @@ class SegWitTest(BitcoinTestFramework):
|
|||||||
|
|
||||||
# This has extra signature data for a witness input, so it should fail.
|
# This has extra signature data for a witness input, so it should fail.
|
||||||
test_witness_block(self.nodes[0], self.test_node, block, accepted=False,
|
test_witness_block(self.nodes[0], self.test_node, block, accepted=False,
|
||||||
reason='mandatory-script-verify-flag-failed (Witness requires empty scriptSig)')
|
reason='block-script-verify-flag-failed (Witness requires empty scriptSig)')
|
||||||
|
|
||||||
# Now get rid of the extra scriptsig on the witness input, and verify
|
# Now get rid of the extra scriptsig on the witness input, and verify
|
||||||
# success (even with extra scriptsig data in the non-witness input)
|
# success (even with extra scriptsig data in the non-witness input)
|
||||||
@@ -1050,7 +1050,7 @@ class SegWitTest(BitcoinTestFramework):
|
|||||||
|
|
||||||
self.update_witness_block_with_transactions(block, [tx, tx2])
|
self.update_witness_block_with_transactions(block, [tx, tx2])
|
||||||
test_witness_block(self.nodes[0], self.test_node, block, accepted=False,
|
test_witness_block(self.nodes[0], self.test_node, block, accepted=False,
|
||||||
reason='mandatory-script-verify-flag-failed (Push value size limit exceeded)')
|
reason='block-script-verify-flag-failed (Push value size limit exceeded)')
|
||||||
|
|
||||||
# Now reduce the length of the stack element
|
# Now reduce the length of the stack element
|
||||||
tx2.wit.vtxinwit[0].scriptWitness.stack[0] = b'a' * (MAX_SCRIPT_ELEMENT_SIZE)
|
tx2.wit.vtxinwit[0].scriptWitness.stack[0] = b'a' * (MAX_SCRIPT_ELEMENT_SIZE)
|
||||||
@@ -1089,7 +1089,7 @@ class SegWitTest(BitcoinTestFramework):
|
|||||||
self.update_witness_block_with_transactions(block, [tx, tx2])
|
self.update_witness_block_with_transactions(block, [tx, tx2])
|
||||||
|
|
||||||
test_witness_block(self.nodes[0], self.test_node, block, accepted=False,
|
test_witness_block(self.nodes[0], self.test_node, block, accepted=False,
|
||||||
reason='mandatory-script-verify-flag-failed (Script is too big)')
|
reason='block-script-verify-flag-failed (Script is too big)')
|
||||||
|
|
||||||
# Try again with one less byte in the witness script
|
# Try again with one less byte in the witness script
|
||||||
witness_script = CScript([b'a' * MAX_SCRIPT_ELEMENT_SIZE] * 19 + [OP_DROP] * 62 + [OP_TRUE])
|
witness_script = CScript([b'a' * MAX_SCRIPT_ELEMENT_SIZE] * 19 + [OP_DROP] * 62 + [OP_TRUE])
|
||||||
@@ -1179,7 +1179,7 @@ class SegWitTest(BitcoinTestFramework):
|
|||||||
block.vtx = [block.vtx[0]]
|
block.vtx = [block.vtx[0]]
|
||||||
self.update_witness_block_with_transactions(block, [tx2])
|
self.update_witness_block_with_transactions(block, [tx2])
|
||||||
test_witness_block(self.nodes[0], self.test_node, block, accepted=False,
|
test_witness_block(self.nodes[0], self.test_node, block, accepted=False,
|
||||||
reason='mandatory-script-verify-flag-failed (Operation not valid with the current stack size)')
|
reason='block-script-verify-flag-failed (Operation not valid with the current stack size)')
|
||||||
|
|
||||||
# Fix the broken witness and the block should be accepted.
|
# Fix the broken witness and the block should be accepted.
|
||||||
tx2.wit.vtxinwit[5].scriptWitness.stack = [b'a', witness_script]
|
tx2.wit.vtxinwit[5].scriptWitness.stack = [b'a', witness_script]
|
||||||
@@ -1535,7 +1535,7 @@ class SegWitTest(BitcoinTestFramework):
|
|||||||
sign_p2pk_witness_input(witness_script, tx, 0, hashtype, prev_utxo.nValue + 1, key)
|
sign_p2pk_witness_input(witness_script, tx, 0, hashtype, prev_utxo.nValue + 1, key)
|
||||||
self.update_witness_block_with_transactions(block, [tx])
|
self.update_witness_block_with_transactions(block, [tx])
|
||||||
test_witness_block(self.nodes[0], self.test_node, block, accepted=False,
|
test_witness_block(self.nodes[0], self.test_node, block, accepted=False,
|
||||||
reason='mandatory-script-verify-flag-failed (Script evaluated without error '
|
reason='block-script-verify-flag-failed (Script evaluated without error '
|
||||||
'but finished with a false/empty top stack element')
|
'but finished with a false/empty top stack element')
|
||||||
|
|
||||||
# Too-small input value
|
# Too-small input value
|
||||||
@@ -1543,7 +1543,7 @@ class SegWitTest(BitcoinTestFramework):
|
|||||||
block.vtx.pop() # remove last tx
|
block.vtx.pop() # remove last tx
|
||||||
self.update_witness_block_with_transactions(block, [tx])
|
self.update_witness_block_with_transactions(block, [tx])
|
||||||
test_witness_block(self.nodes[0], self.test_node, block, accepted=False,
|
test_witness_block(self.nodes[0], self.test_node, block, accepted=False,
|
||||||
reason='mandatory-script-verify-flag-failed (Script evaluated without error '
|
reason='block-script-verify-flag-failed (Script evaluated without error '
|
||||||
'but finished with a false/empty top stack element')
|
'but finished with a false/empty top stack element')
|
||||||
|
|
||||||
# Now try correct value
|
# Now try correct value
|
||||||
@@ -1647,7 +1647,7 @@ class SegWitTest(BitcoinTestFramework):
|
|||||||
block = self.build_next_block()
|
block = self.build_next_block()
|
||||||
self.update_witness_block_with_transactions(block, [tx, tx2])
|
self.update_witness_block_with_transactions(block, [tx, tx2])
|
||||||
test_witness_block(self.nodes[0], self.test_node, block, accepted=False,
|
test_witness_block(self.nodes[0], self.test_node, block, accepted=False,
|
||||||
reason='mandatory-script-verify-flag-failed (Witness requires empty scriptSig)')
|
reason='block-script-verify-flag-failed (Witness requires empty scriptSig)')
|
||||||
|
|
||||||
# Move the signature to the witness.
|
# Move the signature to the witness.
|
||||||
block.vtx.pop()
|
block.vtx.pop()
|
||||||
|
|||||||
Reference in new issue
Block a user