aboutsummaryrefslogtreecommitdiff
path: root/test/functional/p2p_disconnect_ban.py
diff options
context:
space:
mode:
authorbrunoerg <brunoely.gc@gmail.com>2023-01-05 15:11:32 -0300
committerbrunoerg <brunoely.gc@gmail.com>2023-01-06 13:33:38 -0300
commitb99f1f20f773eb55c870a033b3f2e8f13d55d0c8 (patch)
tree57c825644070f8f7901b6cefdfd51b6647e424d7 /test/functional/p2p_disconnect_ban.py
parentadc41cf3b22f8f168e88ce3ad5f27c1130f12beb (diff)
downloadbitcoin-b99f1f20f773eb55c870a033b3f2e8f13d55d0c8.tar.xz
p2p, rpc: don't allow past absolute timestamp in `setban`
Diffstat (limited to 'test/functional/p2p_disconnect_ban.py')
-rwxr-xr-xtest/functional/p2p_disconnect_ban.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/test/functional/p2p_disconnect_ban.py b/test/functional/p2p_disconnect_ban.py
index 91c2a43932..8d4f50e681 100755
--- a/test/functional/p2p_disconnect_ban.py
+++ b/test/functional/p2p_disconnect_ban.py
@@ -46,6 +46,9 @@ class DisconnectBanTest(BitcoinTestFramework):
assert_raises_rpc_error(-30, "Error: Invalid IP/Subnet", self.nodes[1].setban, "127.0.0.1/42", "add")
assert_equal(len(self.nodes[1].listbanned()), 1) # still only one banned ip because 127.0.0.1 is within the range of 127.0.0.0/24
+ self.log.info("setban: fail to ban with past absolute timestamp")
+ assert_raises_rpc_error(-8, "Error: Absolute timestamp is in the past", self.nodes[1].setban, "127.27.0.1", "add", 123, True)
+
self.log.info("setban remove: fail to unban a non-banned subnet")
assert_raises_rpc_error(-30, "Error: Unban failed", self.nodes[1].setban, "127.0.0.1", "remove")
assert_equal(len(self.nodes[1].listbanned()), 1)