mirror of
https://github.com/dashpay/dash.git
synced 2024-12-27 13:03:17 +01:00
909a13082f
3b05f0f70fbaee5b5eaa0d1b6f3b9d32f44410bb Reformat p2p_permissions.py (nicolas.dorier) ce7eac3cb0e7d301db75de24e9a7b0af93c61311 [Fix] The default whitelistrelay should be true (nicolas.dorier) Pull request description: I thought `whitelistrelay` default was `false` when it is `true`. The root of the issue come from the fact that all references to `DEFAULT_` are not in the scope of this file, so hard coding of default values are used everywhere in `net.cpp`. I think that in a separate PR we should fix that more fundamentally everywhere. ACKs for top commit: promag: ACK 3b05f0f70fbaee5b5eaa0d1b6f3b9d32f44410bb. Sjors: re-ACK 3b05f0f70fbaee5b5eaa0d1b6f3b9d32f44410bb Tree-SHA512: f4a75f986fa2adf1a5f1c91605e0d261f7ac5ac8535fb05437d83b8392dbcf5cc1a47d755adcf8ad8dc67a88de28060187200fd3ce06545261a5c7ec0fea831a
48 lines
1.8 KiB
Python
Executable File
48 lines
1.8 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
# Copyright (c) 2015-2019 The Bitcoin Core developers
|
|
# Distributed under the MIT software license, see the accompanying
|
|
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
|
"""Test the setban rpc call."""
|
|
|
|
from test_framework.test_framework import BitcoinTestFramework
|
|
from test_framework.util import (
|
|
connect_nodes,
|
|
p2p_port
|
|
)
|
|
|
|
class SetBanTests(BitcoinTestFramework):
|
|
def set_test_params(self):
|
|
self.num_nodes = 2
|
|
self.setup_clean_chain = True
|
|
self.extra_args = [[],[]]
|
|
|
|
def run_test(self):
|
|
# Node 0 connects to Node 1, check that the noban permission is not granted
|
|
connect_nodes(self.nodes[0], 1)
|
|
peerinfo = self.nodes[1].getpeerinfo()[0]
|
|
assert(not 'noban' in peerinfo['permissions'])
|
|
|
|
# Node 0 get banned by Node 1
|
|
self.nodes[1].setban("127.0.0.1", "add")
|
|
|
|
# Node 0 should not be able to reconnect
|
|
with self.nodes[1].assert_debug_log(expected_msgs=['dropped (banned)\n']):
|
|
self.restart_node(1, [])
|
|
self.nodes[0].addnode("127.0.0.1:" + str(p2p_port(1)), "onetry")
|
|
|
|
# However, node 0 should be able to reconnect if it has noban permission
|
|
self.restart_node(1, ['-whitelist=127.0.0.1'])
|
|
connect_nodes(self.nodes[0], 1)
|
|
peerinfo = self.nodes[1].getpeerinfo()[0]
|
|
assert('noban' in peerinfo['permissions'])
|
|
|
|
# If we remove the ban, Node 0 should be able to reconnect even without noban permission
|
|
self.nodes[1].setban("127.0.0.1", "remove")
|
|
self.restart_node(1, [])
|
|
connect_nodes(self.nodes[0], 1)
|
|
peerinfo = self.nodes[1].getpeerinfo()[0]
|
|
assert(not 'noban' in peerinfo['permissions'])
|
|
|
|
if __name__ == '__main__':
|
|
SetBanTests().main()
|