Skip to content

Commit deb7de2

Browse files
fanquakePastaPastaPasta
authored andcommitted
Merge bitcoin#26604: test: add coverage for -bantime
9c18992 test: add coverage for `-bantime` (brunoerg) Pull request description: This PR adds test coverage for `-bantime`. This flag sets the time in seconds how long the IP is banned (in the case you don't explicitly set `bantime` when using `setban`). ACKs for top commit: MarcoFalke: lgtm ACK 9c18992 Tree-SHA512: e95f8608aa5df9b09cc5577daae662ed79ef5d5c69ee5e704d7c69520b9b51cc142e9e6be69d80356eda25a5215c4770b1a208638560c48cd3bc8f6d195a371f
1 parent f725ed5 commit deb7de2

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

test/functional/rpc_setban.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66

77
from test_framework.test_framework import BitcoinTestFramework
88
from test_framework.util import (
9-
p2p_port
9+
p2p_port,
10+
assert_equal,
1011
)
1112

1213
class SetBanTests(BitcoinTestFramework):
@@ -70,6 +71,11 @@ def run_test(self):
7071
assert not self.is_banned(node, tor_addr)
7172
assert not self.is_banned(node, ip_addr)
7273

74+
self.log.info("Test -bantime")
75+
self.restart_node(1, ["-bantime=1234"])
76+
self.nodes[1].setban("127.0.0.1", "add")
77+
banned = self.nodes[1].listbanned()[0]
78+
assert_equal(banned['ban_duration'], 1234)
7379

7480
if __name__ == '__main__':
7581
SetBanTests().main()

0 commit comments

Comments
 (0)