mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-25 10:43:19 -03:00
test: test banlist database recreation
This commit is contained in:
parent
d8bdee0fc8
commit
4bdcf57158
1 changed files with 12 additions and 0 deletions
|
@ -4,6 +4,7 @@
|
|||
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
"""Test node disconnect and ban behavior"""
|
||||
import time
|
||||
from pathlib import Path
|
||||
|
||||
from test_framework.test_framework import BitcoinTestFramework
|
||||
from test_framework.util import (
|
||||
|
@ -36,6 +37,17 @@ class DisconnectBanTest(BitcoinTestFramework):
|
|||
self.log.info("clearbanned: successfully clear ban list")
|
||||
self.nodes[1].clearbanned()
|
||||
assert_equal(len(self.nodes[1].listbanned()), 0)
|
||||
|
||||
self.log.info('Test banlist database recreation')
|
||||
self.stop_node(1)
|
||||
target_file = self.nodes[1].chain_path / "banlist.json"
|
||||
Path.unlink(target_file)
|
||||
with self.nodes[1].assert_debug_log(["Recreating the banlist database"]):
|
||||
self.start_node(1)
|
||||
|
||||
assert Path.exists(target_file)
|
||||
assert_equal(self.nodes[1].listbanned(), [])
|
||||
|
||||
self.nodes[1].setban("127.0.0.0/24", "add")
|
||||
|
||||
self.log.info("setban: fail to ban an already banned subnet")
|
||||
|
|
Loading…
Add table
Reference in a new issue