diff options
author | Vasil Dimov <vd@FreeBSD.org> | 2021-01-11 17:25:40 +0100 |
---|---|---|
committer | Vasil Dimov <vd@FreeBSD.org> | 2021-06-21 15:27:03 +0200 |
commit | dd4e957dcdfc971a4a971995ff2db9fb787d23c3 (patch) | |
tree | f0942d6f7cad7ec5a43094d07337c71644112d6d /test/functional/rpc_setban.py | |
parent | d197977ae2076903ed12ab7616a7f93e88be02e1 (diff) | |
download | bitcoin-dd4e957dcdfc971a4a971995ff2db9fb787d23c3.tar.xz |
test: ensure banlist can be read from disk after restart
With `banlist.dat` (being written in addrv1 format) if we would try to
write a Tor v3 subnet, it would serialize as a dummy-all-0s IPv6
address and subsequently, when deserialized will not result in the same
subnet.
This problem does not exist with `banlist.json` where the data is saved
in textual, human-readable form.
Diffstat (limited to 'test/functional/rpc_setban.py')
-rwxr-xr-x | test/functional/rpc_setban.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/test/functional/rpc_setban.py b/test/functional/rpc_setban.py index fd5f8aa098..e91ed3b045 100755 --- a/test/functional/rpc_setban.py +++ b/test/functional/rpc_setban.py @@ -51,12 +51,24 @@ class SetBanTests(BitcoinTestFramework): ip_addr = "1.2.3.4" assert(not self.is_banned(node, tor_addr)) assert(not self.is_banned(node, ip_addr)) + node.setban(tor_addr, "add") assert(self.is_banned(node, tor_addr)) assert(not self.is_banned(node, ip_addr)) + + self.log.info("Test the ban list is preserved through restart") + + self.restart_node(1) + assert(self.is_banned(node, tor_addr)) + assert(not self.is_banned(node, ip_addr)) + node.setban(tor_addr, "remove") assert(not self.is_banned(self.nodes[1], tor_addr)) assert(not self.is_banned(node, ip_addr)) + self.restart_node(1) + assert(not self.is_banned(node, tor_addr)) + assert(not self.is_banned(node, ip_addr)) + if __name__ == '__main__': SetBanTests().main() |