mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-02 09:46:52 -05:00
test: add coverage for mapped_as
from getrawaddrman
Test addresses are being mapped according to the ASMap file provided properly. Compare the result of the `getrawaddrman` RPC with the result from the ASMap Health Check.
This commit is contained in:
parent
8c2714907d
commit
1e54d61c46
1 changed files with 9 additions and 0 deletions
|
@ -27,6 +27,7 @@ import os
|
|||
import shutil
|
||||
|
||||
from test_framework.test_framework import BitcoinTestFramework
|
||||
from test_framework.util import assert_equal
|
||||
|
||||
DEFAULT_ASMAP_FILENAME = 'ip_asn.map' # defined in src/init.cpp
|
||||
ASMAP = '../../src/test/data/asmap.raw' # path to unit test skeleton asmap
|
||||
|
@ -118,6 +119,14 @@ class AsmapTest(BitcoinTestFramework):
|
|||
msg = "ASMap Health Check: 4 clearnet peers are mapped to 3 ASNs with 0 peers being unmapped"
|
||||
with self.node.assert_debug_log(expected_msgs=[msg]):
|
||||
self.start_node(0, extra_args=['-asmap'])
|
||||
raw_addrman = self.node.getrawaddrman()
|
||||
asns = []
|
||||
for _, entries in raw_addrman.items():
|
||||
for _, entry in entries.items():
|
||||
asn = entry['mapped_as']
|
||||
if asn not in asns:
|
||||
asns.append(asn)
|
||||
assert_equal(len(asns), 3)
|
||||
os.remove(self.default_asmap)
|
||||
|
||||
def run_test(self):
|
||||
|
|
Loading…
Add table
Reference in a new issue