Inside Bitcoin
Opening the selected file…
Inside Bitcoin
Opening the selected file…
The code behind the network, with room to understand it.
Release published 2026-10-28 · Snapshot fetched 2026-11-01. Latest stable release at fetch time; development branches and Git history are excluded. Only the selected code window and visible folders load here.
501getrawaddrman = node.getrawaddrman()502getaddrmaninfo = node.getaddrmaninfo()503for (table_name, table_info) in expected.items():504assert_equal(len(getrawaddrman[table_name]), len(table_info))505assert_equal(len(getrawaddrman[table_name]), getaddrmaninfo["all_networks"][table_name])507for bucket_position in getrawaddrman[table_name].keys():508entry = getrawaddrman[table_name][bucket_position]509expected_entry = list(filter(lambda e: e["address"] == entry["address"], table_info))[0]510assert_equal(bucket_position, expected_entry["bucket_position"])511check_addr_information(entry, expected_entry)513# we expect 4 new and 4 tried table entries in the addrman which were added using seed_addrman()514expected = {515"new": [516{517"bucket_position": "82/8",518"address": "2.0.0.0",519"port": 8333,520"services": 9,521"network": "ipv4",522"source": "2.0.0.0",523"source_network": "ipv4",524},525{526"bucket_position": "336/24",527"address": "fc00:1:2:3:4:5:6:7",528"port": 8333,529"services": 9,530"network": "cjdns",531"source": "fc00:1:2:3:4:5:6:7",532"source_network": "cjdns",533},534{535"bucket_position": "963/46",536"address": "c4gfnttsuwqomiygupdqqqyy5y5emnk5c73hrfvatri67prd7vyq.b32.i2p",537"port": 8333,538"services": 9,539"network": "i2p",540"source": "c4gfnttsuwqomiygupdqqqyy5y5emnk5c73hrfvatri67prd7vyq.b32.i2p",541"source_network": "i2p",542},543{544"bucket_position": "613/6",545"address": "2803:0:1234:abcd::1",546"services": 9,547"network": "ipv6",548"source": "2803:0:1234:abcd::1",549"source_network": "ipv6",550"port": 45324,551}552],553"tried": [554{555"bucket_position": "6/33",556"address": "1.2.3.4",557"port": 8333,558"services": 9,559"network": "ipv4",560"source": "1.2.3.4",561"source_network": "ipv4",562},563{564"bucket_position": "197/34",565"address": "1233:3432:2434:2343:3234:2345:6546:4534",566"port": 8333,567"services": 9,568"network": "ipv6",569"source": "1233:3432:2434:2343:3234:2345:6546:4534",570"source_network": "ipv6",571},572{573"bucket_position": "72/61",574"address": "pg6mmjiyjmcrsslvykfwnntlaru7p5svn6y2ymmju6nubxndf4pscryd.onion",575"port": 8333,576"services": 9,577"network": "onion",578"source": "pg6mmjiyjmcrsslvykfwnntlaru7p5svn6y2ymmju6nubxndf4pscryd.onion",579"source_network": "onion"580},581{582"bucket_position": "139/46",583"address": "nrfj6inpyf73gpkyool35hcmne5zwfmse3jl3aw23vk7chdemalyaqad.onion",584"services": 9,585"network": "onion",586"source": "nrfj6inpyf73gpkyool35hcmne5zwfmse3jl3aw23vk7chdemalyaqad.onion",587"source_network": "onion",588"port": 45324,589}590]591}593self.log.debug("Test that getrawaddrman contains information about newly added addresses in each addrman table")594check_getrawaddrman_entries(expected)597if __name__ == '__main__':598NetTest(__file__).main()
Independent explanations by MyBitcoinExplorer. Not affiliated with or endorsed by Bitcoin Core. Guides are educational and do not replace the source or its tests.
Bitcoin Core source © its contributors, distributed under the MIT license. Original notices and bundled third-party licenses are retained in the source tree.