aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorVasil Dimov <vd@FreeBSD.org>2021-06-11 15:33:23 +0200
committerVasil Dimov <vd@FreeBSD.org>2021-06-11 19:16:07 +0200
commite7468139a1dddd4946bc70697ec38816b3fa8f9b (patch)
tree667cfe9c57e98d44eaa2c0669404f0e15c791027 /test
parent33e211d2a442e4555ff3401f92af4ee2f7552568 (diff)
downloadbitcoin-e7468139a1dddd4946bc70697ec38816b3fa8f9b.tar.xz
test: make CAddress in functional tests comparable
This way we can compare CAddress objects using `==` or even arrays of CAddress using `array1 == array2`.
Diffstat (limited to 'test')
-rwxr-xr-xtest/functional/test_framework/messages.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/test/functional/test_framework/messages.py b/test/functional/test_framework/messages.py
index a21d7e7946..fdc254e5fc 100755
--- a/test/functional/test_framework/messages.py
+++ b/test/functional/test_framework/messages.py
@@ -229,6 +229,9 @@ class CAddress:
self.ip = "0.0.0.0"
self.port = 0
+ def __eq__(self, other):
+ return self.net == other.net and self.ip == other.ip and self.nServices == other.nServices and self.port == other.port and self.time == other.time
+
def deserialize(self, f, *, with_time=True):
"""Deserialize from addrv1 format (pre-BIP155)"""
if with_time: