forked from bitcoin/bitcoin
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge bitcoin#20755: [rpc] Remove deprecated fields from getpeerinfo
454a408 [doc] Add release notes for removed getpeerinfo fields. (Amiti Uttarwar) b1a936d [rpc] Remove deprecated "whitelisted" field from getpeerinfo (Amiti Uttarwar) 094c3be [rpc] Remove deprecated "banscore" field from getpeerinfo (Amiti Uttarwar) 5370533 [rpc] Remove deprecated "addnode" field from getpeerinfo (Amiti Uttarwar) Pull request description: This PR removes support for 3 fields on the `getpeerinfo` RPC that were deprecated in v0.21- `addnode`, `banscore` & `whitelisted`. ACKs for top commit: sipa: utACK 454a408 jnewbery: ACK 454a408. Tree-SHA512: ccc0e90c0763eeb8529cf0c46162dbaca3f7773981b3b52d9925166ea7421aed086795d56b320e16c9340f68862388785f52a9b78314865070917b33180d7cd6
- Loading branch information
1 parent
5fbf522
commit d5c017b
Showing
9 changed files
with
13 additions
and
107 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,35 +38,24 @@ def run_test(self): | |
# default permissions (no specific permissions) | ||
["-whitelist=127.0.0.1"], | ||
# Make sure the default values in the command line documentation match the ones here | ||
["relay", "noban", "mempool", "download"], | ||
True) | ||
|
||
self.checkpermission( | ||
# check without deprecatedrpc=whitelisted | ||
["-whitelist=127.0.0.1"], | ||
# Make sure the default values in the command line documentation match the ones here | ||
["relay", "noban", "mempool", "download"], | ||
None) | ||
["relay", "noban", "mempool", "download"]) | ||
|
||
self.checkpermission( | ||
# no permission (even with forcerelay) | ||
["[email protected]", "-whitelistforcerelay=1"], | ||
[], | ||
False) | ||
[]) | ||
|
||
self.checkpermission( | ||
# relay permission removed (no specific permissions) | ||
["-whitelist=127.0.0.1", "-whitelistrelay=0"], | ||
["noban", "mempool", "download"], | ||
True) | ||
["noban", "mempool", "download"]) | ||
|
||
self.checkpermission( | ||
# 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", "download"], | ||
True) | ||
["forcerelay", "relay", "noban", "mempool", "download"]) | ||
|
||
# Let's make sure permissions are merged correctly | ||
# For this, we need to use whitebind instead of bind | ||
|
@@ -76,39 +65,28 @@ def run_test(self): | |
self.checkpermission( | ||
["[email protected]"], | ||
# Check parameter interaction forcerelay should activate relay | ||
["noban", "bloomfilter", "forcerelay", "relay", "download"], | ||
False) | ||
["noban", "bloomfilter", "forcerelay", "relay", "download"]) | ||
self.replaceinconfig(1, "whitebind=bloomfilter,forcerelay@" + ip_port, "bind=127.0.0.1") | ||
|
||
self.checkpermission( | ||
# legacy whitelistrelay should be ignored | ||
["-whitelist=noban,[email protected]", "-whitelistrelay"], | ||
["noban", "mempool", "download"], | ||
False) | ||
|
||
self.checkpermission( | ||
# check without deprecatedrpc=whitelisted | ||
["-whitelist=noban,[email protected]", "-whitelistrelay"], | ||
["noban", "mempool", "download"], | ||
None) | ||
["noban", "mempool", "download"]) | ||
|
||
self.checkpermission( | ||
# legacy whitelistforcerelay should be ignored | ||
["-whitelist=noban,[email protected]", "-whitelistforcerelay"], | ||
["noban", "mempool", "download"], | ||
False) | ||
["noban", "mempool", "download"]) | ||
|
||
self.checkpermission( | ||
# missing mempool permission to be considered legacy whitelisted | ||
["[email protected]"], | ||
["noban", "download"], | ||
False) | ||
["noban", "download"]) | ||
|
||
self.checkpermission( | ||
# all permission added | ||
["[email protected]"], | ||
["forcerelay", "noban", "mempool", "bloomfilter", "relay", "download", "addr"], | ||
False) | ||
["forcerelay", "noban", "mempool", "bloomfilter", "relay", "download", "addr"]) | ||
|
||
self.stop_node(1) | ||
self.nodes[1].assert_start_raises_init_error(["[email protected]"], "Invalid P2P permission", match=ErrorMatch.PARTIAL_REGEX) | ||
|
@@ -164,19 +142,13 @@ def in_mempool(): | |
reject_reason='Not relaying non-mempool transaction {} from forcerelay peer=0'.format(txid), | ||
) | ||
|
||
def checkpermission(self, args, expectedPermissions, whitelisted): | ||
if whitelisted is not None: | ||
args = [*args, '-deprecatedrpc=whitelisted'] | ||
def checkpermission(self, args, expectedPermissions): | ||
self.restart_node(1, args) | ||
self.connect_nodes(0, 1) | ||
peerinfo = self.nodes[1].getpeerinfo()[0] | ||
if whitelisted is None: | ||
assert 'whitelisted' not in peerinfo | ||
else: | ||
assert_equal(peerinfo['whitelisted'], whitelisted) | ||
assert_equal(len(expectedPermissions), len(peerinfo['permissions'])) | ||
for p in expectedPermissions: | ||
if not p in peerinfo['permissions']: | ||
if p not in peerinfo['permissions']: | ||
raise AssertionError("Expected permissions %r is not granted." % p) | ||
|
||
def replaceinconfig(self, nodeid, old, new): | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters