Skip to content

Commit f3d6a5c

Browse files
author
MarcoFalke
committed
Merge bitcoin#23879: test: check ban_duration and time_remaining after setting ban
da349f1 test: check ban_duration and time_remaining after setting ban (brunoerg) Pull request description: This PR adds functional test coverage for `ban_duration` and `time_remaining` introduced in bitcoin#21602 ACKs for top commit: shaavan: ACK da349f1 theStack: Tested ACK da349f1 Tree-SHA512: 51e63f3a36adb1c81e4d49426486af2cd9c8c4319f94e06a47fa7da8100a8b53c029d28d4a4771bdbf4e0a2bfb4ddd3740b9974bd08d8ff06f2a0fc2b6d8a6b5
2 parents de28c34 + da349f1 commit f3d6a5c

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

test/functional/p2p_disconnect_ban.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,15 @@ def run_test(self):
7070
self.nodes[1].setmocktime(old_time + 3)
7171
assert_equal(len(self.nodes[1].listbanned()), 3)
7272

73+
self.log.info("Test ban_duration and time_remaining")
74+
for ban in self.nodes[1].listbanned():
75+
if ban["address"] in ["127.0.0.0/32", "127.0.0.0/24"]:
76+
assert_equal(ban["ban_duration"], 86400)
77+
assert_equal(ban["time_remaining"], 86397)
78+
elif ban["address"] == "2001:4d48:ac57:400:cacf:e9ff:fe1d:9c63/19":
79+
assert_equal(ban["ban_duration"], 1000)
80+
assert_equal(ban["time_remaining"], 997)
81+
7382
self.restart_node(1)
7483

7584
listAfterShutdown = self.nodes[1].listbanned()

0 commit comments

Comments
 (0)