diff options
author | Vasil Dimov <vd@FreeBSD.org> | 2023-01-09 14:31:22 +0100 |
---|---|---|
committer | Vasil Dimov <vd@FreeBSD.org> | 2024-01-23 11:49:32 +0100 |
commit | b851c5385d0a0acec4493be1561cea285065d5dc (patch) | |
tree | f63b84cb6d02abe85703c6fb5a350a47a7a67eb2 /src/test/fuzz/netaddress.cpp | |
parent | 651fb034d85eb5db561bfd24b74f7271417defa5 (diff) | |
download | bitcoin-b851c5385d0a0acec4493be1561cea285065d5dc.tar.xz |
fuzz: extend ConsumeNetAddr() to return I2P and CJDNS addresses
In the process of doing so, refactor `ConsumeNetAddr()` to generate the
addresses from IPv4, IPv6, Tor, I2P and CJDNS networks in the same way -
by preparing some random stream and deserializing from it. Similar code
was already found in `RandAddr()`.
Diffstat (limited to 'src/test/fuzz/netaddress.cpp')
-rw-r--r-- | src/test/fuzz/netaddress.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/test/fuzz/netaddress.cpp b/src/test/fuzz/netaddress.cpp index 5141d3362d..4803cdccad 100644 --- a/src/test/fuzz/netaddress.cpp +++ b/src/test/fuzz/netaddress.cpp @@ -26,6 +26,12 @@ FUZZ_TARGET(netaddress) if (net_addr.GetNetwork() == Network::NET_ONION) { assert(net_addr.IsTor()); } + if (net_addr.GetNetwork() == Network::NET_I2P) { + assert(net_addr.IsI2P()); + } + if (net_addr.GetNetwork() == Network::NET_CJDNS) { + assert(net_addr.IsCJDNS()); + } if (net_addr.GetNetwork() == Network::NET_INTERNAL) { assert(net_addr.IsInternal()); } @@ -69,6 +75,12 @@ FUZZ_TARGET(netaddress) if (net_addr.IsTor()) { assert(net_addr.GetNetwork() == Network::NET_ONION); } + if (net_addr.IsI2P()) { + assert(net_addr.GetNetwork() == Network::NET_I2P); + } + if (net_addr.IsCJDNS()) { + assert(net_addr.GetNetwork() == Network::NET_CJDNS); + } (void)net_addr.IsValid(); (void)net_addr.ToStringAddr(); |