Reformat p2p_permissions.py
This commit is contained in:
2 files changed
+35
-36
No files matched your search
Regular → Executable
+35
-36
@@ -22,26 +22,25 @@ class P2PPermissionsTests(BitcoinTestFramework):
|
|||||||
self.extra_args = [[],[]]
|
self.extra_args = [[],[]]
|
||||||
|
|
||||||
def run_test(self):
|
def run_test(self):
|
||||||
|
self.checkpermission(
|
||||||
|
# default permissions (no specific permissions)
|
||||||
|
["-whitelist=127.0.0.1"],
|
||||||
|
["relay", "noban", "mempool"],
|
||||||
|
True)
|
||||||
|
|
||||||
self.checkpermission(
|
self.checkpermission(
|
||||||
# default permissions (no specific permissions)
|
# relay permission removed (no specific permissions)
|
||||||
["-whitelist=127.0.0.1"],
|
["-whitelist=127.0.0.1", "-whitelistrelay=0"],
|
||||||
["relay", "noban", "mempool"],
|
["noban", "mempool"],
|
||||||
True)
|
True)
|
||||||
|
|
||||||
self.checkpermission(
|
self.checkpermission(
|
||||||
# relay permission removed (no specific permissions)
|
# forcerelay and relay permission added
|
||||||
["-whitelist=127.0.0.1", "-whitelistrelay=0"],
|
# Legacy parameter interaction which set whitelistrelay to true
|
||||||
["noban", "mempool"],
|
# if whitelistforcerelay is true
|
||||||
True)
|
["-whitelist=127.0.0.1", "-whitelistforcerelay"],
|
||||||
|
["forcerelay", "relay", "noban", "mempool"],
|
||||||
self.checkpermission(
|
True)
|
||||||
# forcerelay and relay permission added
|
|
||||||
# Legacy parameter interaction which set whitelistrelay to true
|
|
||||||
# if whitelistforcerelay is true
|
|
||||||
["-whitelist=127.0.0.1", "-whitelistforcerelay"],
|
|
||||||
["forcerelay", "relay", "noban", "mempool"],
|
|
||||||
True)
|
|
||||||
|
|
||||||
# Let's make sure permissions are merged correctly
|
# Let's make sure permissions are merged correctly
|
||||||
# For this, we need to use whitebind instead of bind
|
# For this, we need to use whitebind instead of bind
|
||||||
@@ -49,35 +48,35 @@ class P2PPermissionsTests(BitcoinTestFramework):
|
|||||||
ip_port = "127.0.0.1:{}".format(p2p_port(1))
|
ip_port = "127.0.0.1:{}".format(p2p_port(1))
|
||||||
self.replaceinconfig(1, "bind=127.0.0.1", "whitebind=bloomfilter,forcerelay@" + ip_port)
|
self.replaceinconfig(1, "bind=127.0.0.1", "whitebind=bloomfilter,forcerelay@" + ip_port)
|
||||||
self.checkpermission(
|
self.checkpermission(
|
||||||
["-whitelist=noban@127.0.0.1" ],
|
["-whitelist=noban@127.0.0.1" ],
|
||||||
# Check parameter interaction forcerelay should activate relay
|
# Check parameter interaction forcerelay should activate relay
|
||||||
["noban", "bloomfilter", "forcerelay", "relay" ],
|
["noban", "bloomfilter", "forcerelay", "relay" ],
|
||||||
False)
|
False)
|
||||||
self.replaceinconfig(1, "whitebind=bloomfilter,forcerelay@" + ip_port, "bind=127.0.0.1")
|
self.replaceinconfig(1, "whitebind=bloomfilter,forcerelay@" + ip_port, "bind=127.0.0.1")
|
||||||
|
|
||||||
self.checkpermission(
|
self.checkpermission(
|
||||||
# legacy whitelistrelay should be ignored
|
# legacy whitelistrelay should be ignored
|
||||||
["-whitelist=noban,mempool@127.0.0.1", "-whitelistrelay"],
|
["-whitelist=noban,mempool@127.0.0.1", "-whitelistrelay"],
|
||||||
["noban", "mempool"],
|
["noban", "mempool"],
|
||||||
False)
|
False)
|
||||||
|
|
||||||
self.checkpermission(
|
self.checkpermission(
|
||||||
# legacy whitelistforcerelay should be ignored
|
# legacy whitelistforcerelay should be ignored
|
||||||
["-whitelist=noban,mempool@127.0.0.1", "-whitelistforcerelay"],
|
["-whitelist=noban,mempool@127.0.0.1", "-whitelistforcerelay"],
|
||||||
["noban", "mempool"],
|
["noban", "mempool"],
|
||||||
False)
|
False)
|
||||||
|
|
||||||
self.checkpermission(
|
self.checkpermission(
|
||||||
# missing mempool permission to be considered legacy whitelisted
|
# missing mempool permission to be considered legacy whitelisted
|
||||||
["-whitelist=noban@127.0.0.1"],
|
["-whitelist=noban@127.0.0.1"],
|
||||||
["noban"],
|
["noban"],
|
||||||
False)
|
False)
|
||||||
|
|
||||||
self.checkpermission(
|
self.checkpermission(
|
||||||
# all permission added
|
# all permission added
|
||||||
["-whitelist=all@127.0.0.1"],
|
["-whitelist=all@127.0.0.1"],
|
||||||
["forcerelay", "noban", "mempool", "bloomfilter", "relay"],
|
["forcerelay", "noban", "mempool", "bloomfilter", "relay"],
|
||||||
False)
|
False)
|
||||||
|
|
||||||
self.stop_node(1)
|
self.stop_node(1)
|
||||||
self.nodes[1].assert_start_raises_init_error(["-whitelist=oopsie@127.0.0.1"], "Invalid P2P permission", match=ErrorMatch.PARTIAL_REGEX)
|
self.nodes[1].assert_start_raises_init_error(["-whitelist=oopsie@127.0.0.1"], "Invalid P2P permission", match=ErrorMatch.PARTIAL_REGEX)
|
||||||
|
|||||||
Regular → Executable
File mode changed.
Reference in new issue
Block a user