diff --git a/test/functional/p2p_segwit.py b/test/functional/p2p_segwit.py index 191a9b5db5..aebb084b41 100755 --- a/test/functional/p2p_segwit.py +++ b/test/functional/p2p_segwit.py @@ -39,6 +39,7 @@ from test_framework.messages import ( ser_vector, sha256, uint256_from_str, + FromHex, ) from test_framework.mininode import ( P2PInterface, @@ -83,6 +84,7 @@ from test_framework.util import ( hex_str_to_bytes, sync_blocks, sync_mempools, + assert_raises_rpc_error, ) from test_framework import util @@ -277,6 +279,7 @@ class SegWitTest(BitcoinTestFramework): self.test_non_standard_witness() self.test_upgrade_after_activation() self.test_witness_sigops() + self.test_superfluous_witness() # Individual tests @@ -2126,5 +2129,33 @@ class SegWitTest(BitcoinTestFramework): # TODO: test p2sh sigop counting + def test_superfluous_witness(self): + # Serialization of tx that puts witness flag to 1 always + def serialize_with_bogus_witness(tx): + flags = 1 + r = b"" + r += struct.pack("