aboutsummaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorpracticalswift <practicalswift@users.noreply.github.com>2020-11-09 15:29:15 +0000
committerpracticalswift <practicalswift@users.noreply.github.com>2020-11-09 15:29:15 +0000
commit79b8f8d5749fc676d9eeca0296172b7cdbbf2238 (patch)
tree914c1aa3cbaf7215f08e742034cb8982147c8f73 /src/test
parent0e3a78a8ab7ab5da71bd5e2f428ec3a2c9ad0901 (diff)
fuzz: Assert roundtrip equality for both addrv1 and addrv2 versions of CService
Diffstat (limited to 'src/test')
-rw-r--r--src/test/fuzz/deserialize.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/test/fuzz/deserialize.cpp b/src/test/fuzz/deserialize.cpp
index 10b9fbe2af..8ca5366c8a 100644
--- a/src/test/fuzz/deserialize.cpp
+++ b/src/test/fuzz/deserialize.cpp
@@ -206,6 +206,13 @@ void test_one_input(const std::vector<uint8_t>& buffer)
AssertEqualAfterSerializeDeserialize(s);
}
AssertEqualAfterSerializeDeserialize(s, INIT_PROTO_VERSION | ADDRV2_FORMAT);
+ CService s1;
+ DeserializeFromFuzzingInput(buffer, s1, INIT_PROTO_VERSION);
+ AssertEqualAfterSerializeDeserialize(s1, INIT_PROTO_VERSION);
+ assert(s1.IsAddrV1Compatible());
+ CService s2;
+ DeserializeFromFuzzingInput(buffer, s2, INIT_PROTO_VERSION | ADDRV2_FORMAT);
+ AssertEqualAfterSerializeDeserialize(s2, INIT_PROTO_VERSION | ADDRV2_FORMAT);
#elif MESSAGEHEADER_DESERIALIZE
CMessageHeader mh;
DeserializeFromFuzzingInput(buffer, mh);