diff options
author | 0xb10c <b10c@b10c.me> | 2024-03-12 16:17:01 +0100 |
---|---|---|
committer | 0xb10c <b10c@b10c.me> | 2024-03-23 15:33:38 +0100 |
commit | 89b84ea91ae40876a52879c509c63d0bacbfaade (patch) | |
tree | 713da0caf5bd7b427eaa2d9db3935c2fd1db34be | |
parent | c1223188e0a5fb11c3a1b9224511a49dc2f848ed (diff) |
test: check that addrman seeding is successful
The addpeeraddress calls can fail due to collisions. As we are using a
deteministic addrman, they won't fail with the current bucket/position
calculation. However, if the calculation is changed, they might collide
and fail silently causing tests using `seed_addrman()` to fail.
Assert that the addpeeraddress calls are successful.
-rwxr-xr-x | test/functional/rpc_net.py | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/test/functional/rpc_net.py b/test/functional/rpc_net.py index 48d86ab59d..2701d2471d 100755 --- a/test/functional/rpc_net.py +++ b/test/functional/rpc_net.py @@ -45,14 +45,18 @@ def seed_addrman(node): """ Populate the addrman with addresses from different networks. Here 2 ipv4, 2 ipv6, 1 cjdns, 2 onion and 1 i2p addresses are added. """ - node.addpeeraddress(address="1.2.3.4", tried=True, port=8333) - node.addpeeraddress(address="2.0.0.0", port=8333) - node.addpeeraddress(address="1233:3432:2434:2343:3234:2345:6546:4534", tried=True, port=8333) - node.addpeeraddress(address="2803:0:1234:abcd::1", port=45324) - node.addpeeraddress(address="fc00:1:2:3:4:5:6:7", port=8333) - node.addpeeraddress(address="pg6mmjiyjmcrsslvykfwnntlaru7p5svn6y2ymmju6nubxndf4pscryd.onion", tried=True, port=8333) - node.addpeeraddress(address="nrfj6inpyf73gpkyool35hcmne5zwfmse3jl3aw23vk7chdemalyaqad.onion", port=45324, tried=True) - node.addpeeraddress(address="c4gfnttsuwqomiygupdqqqyy5y5emnk5c73hrfvatri67prd7vyq.b32.i2p", port=8333) + # These addresses currently don't collide with a deterministic addrman. + # If the addrman positioning/bucketing is changed, these might collide + # and adding them fails. + success = { "success": True } + assert_equal(node.addpeeraddress(address="1.2.3.4", tried=True, port=8333), success) + assert_equal(node.addpeeraddress(address="2.0.0.0", port=8333), success) + assert_equal(node.addpeeraddress(address="1233:3432:2434:2343:3234:2345:6546:4534", tried=True, port=8333), success) + assert_equal(node.addpeeraddress(address="2803:0:1234:abcd::1", port=45324), success) + assert_equal(node.addpeeraddress(address="fc00:1:2:3:4:5:6:7", port=8333), success) + assert_equal(node.addpeeraddress(address="pg6mmjiyjmcrsslvykfwnntlaru7p5svn6y2ymmju6nubxndf4pscryd.onion", tried=True, port=8333), success) + assert_equal(node.addpeeraddress(address="nrfj6inpyf73gpkyool35hcmne5zwfmse3jl3aw23vk7chdemalyaqad.onion", port=45324, tried=True), success) + assert_equal(node.addpeeraddress(address="c4gfnttsuwqomiygupdqqqyy5y5emnk5c73hrfvatri67prd7vyq.b32.i2p", port=8333), success) class NetTest(BitcoinTestFramework): |