From e7468139a1dddd4946bc70697ec38816b3fa8f9b Mon Sep 17 00:00:00 2001 From: Vasil Dimov Date: Fri, 11 Jun 2021 15:33:23 +0200 Subject: [PATCH] test: make CAddress in functional tests comparable This way we can compare CAddress objects using `==` or even arrays of CAddress using `array1 == array2`. --- test/functional/test_framework/messages.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/functional/test_framework/messages.py b/test/functional/test_framework/messages.py index a21d7e7946e..fdc254e5fc8 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: