Skip to content

Commit 71c1991

Browse files
committed
[test] Use deterministic addrman in addpeeraddress test
this test inserts 1 address into the new table and 1 address into the tried table so that no collisions can happen in either table if a second address is added. this setup does not need to be maintained anymore since we can use a deterministic addrman and safely add many addresses in both tables without collisions. Remove comment explaining why previous setup needed to be maintained.
1 parent 7b868e6 commit 71c1991

File tree

1 file changed

+1
-9
lines changed

1 file changed

+1
-9
lines changed

test/functional/rpc_net.py

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -299,16 +299,8 @@ def test_getnodeaddresses(self):
299299
assert_raises_rpc_error(-8, "Network not recognized: Foo", self.nodes[0].getnodeaddresses, 1, "Foo")
300300

301301
def test_addpeeraddress(self):
302-
"""RPC addpeeraddress sets the source address equal to the destination address.
303-
If an address with the same /16 as an existing new entry is passed, it will be
304-
placed in the same new bucket and have a 1/64 chance of the bucket positions
305-
colliding (depending on the value of nKey in the addrman), in which case the
306-
new address won't be added. The probability of collision can be reduced to
307-
1/2^16 = 1/65536 by using an address from a different /16. We avoid this here
308-
by first testing adding a tried table entry before testing adding a new table one.
309-
"""
310302
self.log.info("Test addpeeraddress")
311-
self.restart_node(1, ["-checkaddrman=1"])
303+
self.restart_node(1, ["-checkaddrman=1", "-test=addrman"])
312304
node = self.nodes[1]
313305

314306
self.log.debug("Test that addpeerinfo is a hidden RPC")

0 commit comments

Comments
 (0)