aboutsummaryrefslogtreecommitdiff
path: root/test/functional/test_framework
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2020-09-20 11:13:49 +0200
committerMarcoFalke <falke.marco@gmail.com>2020-09-20 11:13:56 +0200
commitb99a1633b270e0e89479b2bb2ae19a8a8dc0fa05 (patch)
tree46e5578e18a53396be9c61eace7f13b9267eed4b /test/functional/test_framework
parent38fd1bdcd4a5abbd0dbbf4ec93de9010cffa4055 (diff)
parent638441928a446726ce3a7fb20433a5478e7585bb (diff)
downloadbitcoin-b99a1633b270e0e89479b2bb2ae19a8a8dc0fa05.tar.xz
Merge #19781: test: add parameterized constructor for msg_sendcmpct()
638441928a446726ce3a7fb20433a5478e7585bb test: add parameterized constructor for msg_sendcmpct() (Sebastian Falbesoner) Pull request description: While working on the test for #19776 I noticed that creating a `sendcmpct` message is quite cumbersome -- due to the lack of a parameterized constructor, one needs to create an empty (that is, initialized with default values) object and then set the two fields one by one. This PR replaces the default constructor with a parameterized constructor and uses it in the test `p2p_compactblocks.py`, reducing LOC. No need to pollute the namespace with temporary throw-away message objects anymore. ACKs for top commit: guggero: Code review ACK 638441928a446726ce3a7fb20433a5478e7585bb. epson121: Code review ACK 638441928a446726ce3a7fb20433a5478e7585bb Tree-SHA512: 3b58d276d714b73abc6cc98d1d52dec5f6026b33f03faaeb7dcbc5d83ac377555179f98b159b2b9ecc8957999c35a1dc082e3c69299c5fde4e35f1bd0587ce9d
Diffstat (limited to 'test/functional/test_framework')
-rwxr-xr-xtest/functional/test_framework/messages.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/test/functional/test_framework/messages.py b/test/functional/test_framework/messages.py
index 1e062ab9a4..00cf1ef66d 100755
--- a/test/functional/test_framework/messages.py
+++ b/test/functional/test_framework/messages.py
@@ -1472,9 +1472,9 @@ class msg_sendcmpct:
__slots__ = ("announce", "version")
msgtype = b"sendcmpct"
- def __init__(self):
- self.announce = False
- self.version = 1
+ def __init__(self, announce=False, version=1):
+ self.announce = announce
+ self.version = version
def deserialize(self, f):
self.announce = struct.unpack("<?", f.read(1))[0]