tests: Make msg_block a witness block
This diff has been generated with the following script, but is better reviewed without looking at the script. # -BEGIN VERIFY SCRIPT- echo "Use msg_witness_block everywhere, except for tests that require msg_block" # This could be a separate commit, but it is combined with the # following scripts to reduce the overall diff sed -i -e 's/msg_block/msg_witness_block/g' ./test/functional/{feature_assumevalid,feature_cltv,feature_dersig,feature_versionbits_warning,p2p_fingerprint,p2p_sendheaders,p2p_unrequested_blocks,example_test,rpc_blockchain}.py echo "Rename msg_block to msg_no_witness_block" # Rename msg_block to msg_no_witness_block in all tests (not the # framework) sed -i -e 's/msg_block/msg_no_witness_block/g' $(git grep -l msg_block ./test/functional/*.py) # Derive msg_no_witness_block from msg_block # Make msg_block a witness block in messages.py patch -p1 --fuzz 0 << EOF diff --git a/test/functional/test_framework/messages.py b/test/functional/test_framework/messages.py index 00190e4cbd..e454ed5987 100755 --- a/test/functional/test_framework/messages.py +++ b/test/functional/test_framework/messages.py @@ -1133 +1133 @@ class msg_block: - return self.block.serialize(with_witness=False) + return self.block.serialize() @@ -1155 +1155 @@ class msg_generic: -class msg_witness_block(msg_block): +class msg_no_witness_block(msg_block): @@ -1158,2 +1158 @@ class msg_witness_block(msg_block): - r = self.block.serialize() - return r + return self.block.serialize(with_witness=False) @@ -1445 +1444 @@ class msg_blocktxn: - r += self.block_transactions.serialize(with_witness=False) + r += self.block_transactions.serialize() @@ -1452 +1451 @@ class msg_blocktxn: -class msg_witness_blocktxn(msg_blocktxn): +class msg_no_witness_blocktxn(msg_blocktxn): @@ -1456,3 +1455 @@ class msg_witness_blocktxn(msg_blocktxn): - r = b"" - r += self.block_transactions.serialize() - return r + return self.block_transactions.serialize(with_witness=False) EOF # Conclude rename of msg_block to msg_no_witness_block sed -i -e 's/msg_witness_block/msg_block/g' $(git grep -l msg_witness_block) # -END VERIFY SCRIPT-
This commit is contained in:
parent
fa52eb55c9
commit
fa1d766717
3 changed files with 24 additions and 27 deletions
test/functional/test_framework
|
@ -1130,7 +1130,7 @@ class msg_block:
|
|||
self.block.deserialize(f)
|
||||
|
||||
def serialize(self):
|
||||
return self.block.serialize(with_witness=False)
|
||||
return self.block.serialize()
|
||||
|
||||
def __repr__(self):
|
||||
return "msg_block(block=%s)" % (repr(self.block))
|
||||
|
@ -1152,11 +1152,10 @@ class msg_generic:
|
|||
return "msg_generic()"
|
||||
|
||||
|
||||
class msg_witness_block(msg_block):
|
||||
class msg_no_witness_block(msg_block):
|
||||
__slots__ = ()
|
||||
def serialize(self):
|
||||
r = self.block.serialize()
|
||||
return r
|
||||
return self.block.serialize(with_witness=False)
|
||||
|
||||
|
||||
class msg_getaddr:
|
||||
|
@ -1442,17 +1441,15 @@ class msg_blocktxn:
|
|||
|
||||
def serialize(self):
|
||||
r = b""
|
||||
r += self.block_transactions.serialize(with_witness=False)
|
||||
r += self.block_transactions.serialize()
|
||||
return r
|
||||
|
||||
def __repr__(self):
|
||||
return "msg_blocktxn(block_transactions=%s)" % (repr(self.block_transactions))
|
||||
|
||||
|
||||
class msg_witness_blocktxn(msg_blocktxn):
|
||||
class msg_no_witness_blocktxn(msg_blocktxn):
|
||||
__slots__ = ()
|
||||
|
||||
def serialize(self):
|
||||
r = b""
|
||||
r += self.block_transactions.serialize()
|
||||
return r
|
||||
return self.block_transactions.serialize(with_witness=False)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue