Check for specific tx acceptance failures based on script signature
This commit is contained in:
parent
3a4449e9ad
commit
17b42f4122
1 changed files with 6 additions and 2 deletions
|
@ -769,11 +769,15 @@ class SegWitTest(BitcoinTestFramework):
|
||||||
# will require a witness to spend a witness program regardless of
|
# will require a witness to spend a witness program regardless of
|
||||||
# segwit activation. Note that older bitcoind's that are not
|
# segwit activation. Note that older bitcoind's that are not
|
||||||
# segwit-aware would also reject this for failing CLEANSTACK.
|
# segwit-aware would also reject this for failing CLEANSTACK.
|
||||||
|
with self.nodes[0].assert_debug_log(
|
||||||
|
expected_msgs=(spend_tx.hash, 'was not accepted: non-mandatory-script-verify-flag (Witness program was passed an empty witness)')):
|
||||||
test_transaction_acceptance(self.nodes[0], self.test_node, spend_tx, with_witness=False, accepted=False)
|
test_transaction_acceptance(self.nodes[0], self.test_node, spend_tx, with_witness=False, accepted=False)
|
||||||
|
|
||||||
# Try to put the witness script in the scriptSig, should also fail.
|
# Try to put the witness script in the scriptSig, should also fail.
|
||||||
spend_tx.vin[0].scriptSig = CScript([p2wsh_pubkey, b'a'])
|
spend_tx.vin[0].scriptSig = CScript([p2wsh_pubkey, b'a'])
|
||||||
spend_tx.rehash()
|
spend_tx.rehash()
|
||||||
|
with self.nodes[0].assert_debug_log(
|
||||||
|
expected_msgs=('Not relaying invalid transaction {}'.format(spend_tx.hash), 'was not accepted: mandatory-script-verify-flag-failed (Script evaluated without error but finished with a false/empty top stack element)')):
|
||||||
test_transaction_acceptance(self.nodes[0], self.test_node, spend_tx, with_witness=False, accepted=False)
|
test_transaction_acceptance(self.nodes[0], self.test_node, spend_tx, with_witness=False, accepted=False)
|
||||||
|
|
||||||
# Now put the witness script in the witness, should succeed after
|
# Now put the witness script in the witness, should succeed after
|
||||||
|
|
Loading…
Reference in a new issue