Skip to content

Commit 17b42f4

Browse files
committed
Check for specific tx acceptance failures based on script signature
1 parent 3a4449e commit 17b42f4

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

test/functional/p2p_segwit.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -769,12 +769,16 @@ def test_p2sh_witness(self):
769769
# will require a witness to spend a witness program regardless of
770770
# segwit activation. Note that older bitcoind's that are not
771771
# segwit-aware would also reject this for failing CLEANSTACK.
772-
test_transaction_acceptance(self.nodes[0], self.test_node, spend_tx, with_witness=False, accepted=False)
772+
with self.nodes[0].assert_debug_log(
773+
expected_msgs=(spend_tx.hash, 'was not accepted: non-mandatory-script-verify-flag (Witness program was passed an empty witness)')):
774+
test_transaction_acceptance(self.nodes[0], self.test_node, spend_tx, with_witness=False, accepted=False)
773775

774776
# Try to put the witness script in the scriptSig, should also fail.
775777
spend_tx.vin[0].scriptSig = CScript([p2wsh_pubkey, b'a'])
776778
spend_tx.rehash()
777-
test_transaction_acceptance(self.nodes[0], self.test_node, spend_tx, with_witness=False, accepted=False)
779+
with self.nodes[0].assert_debug_log(
780+
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)')):
781+
test_transaction_acceptance(self.nodes[0], self.test_node, spend_tx, with_witness=False, accepted=False)
778782

779783
# Now put the witness script in the witness, should succeed after
780784
# segwit activates.

0 commit comments

Comments
 (0)