Merge #15982: tests: Make msg_block a witness block

fa1d766717 tests: Make msg_block a witness block (MarcoFalke)
fa52eb55c9 test: Remove True argument to CBlock::serialize (MarcoFalke)

Pull request description:

  Unnamed arguments are confusing as to what they mean without looking up the function signature.

  Since segwit is active by default in regtest, and all blocks are serialized with witness (#15664), remove the argument `with_witness=True` from all calls to `CBlock::serialize` and `BlockTransactions::serialize`.

ACKs for commit fa1d76:
  laanwj:
    code-review ACK fa1d766717

Tree-SHA512: 2c550646f99c9ca86a223ca988c61a730f5e6646807adeaa7174fb2424a32cea3fef8bcd3e0b12e162e7ff192877d0c02fd0654df6ee1a9b821b065707c2dcbc
This commit is contained in:
MarcoFalke
2019-06-17 11:13:58 -04:00
6 changed files with 39 additions and 42 deletions

View File

@@ -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(with_witness=True)
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(with_witness=True)
return r
return self.block_transactions.serialize(with_witness=False)