diff --git a/doc/release-notes.md b/doc/release-notes.md --- a/doc/release-notes.md +++ b/doc/release-notes.md @@ -4,4 +4,7 @@ -This is a maintenance release with no user-visible change. +This release includes the following features and fixes: + - The deprecated `addnode` and `whitelisted` have been removed from the + `getpeerinfo` RPC output. Users relying on the `deprecatedrpc` behavior need + to update their system accordingly. diff --git a/src/rpc/net.cpp b/src/rpc/net.cpp --- a/src/rpc/net.cpp +++ b/src/rpc/net.cpp @@ -168,11 +168,6 @@ {RPCResult::Type::BOOL, "bip152_hb_from", "Whether peer selected us as (compact blocks) " "high-bandwidth peer"}, - {RPCResult::Type::BOOL, "addnode", - "Whether connection was due to addnode/-connect or if it " - "was an automatic/inbound connection\n(DEPRECATED, " - "returned only if the config option " - "-deprecatedrpc=getpeerinfo_addnode is passed)"}, {RPCResult::Type::STR, "connection_type", "Type of connection: \n" + Join(CONNECTION_TYPE_DOC, ",\n") + "."}, @@ -190,10 +185,6 @@ "The heights of blocks we're currently asking from " "this peer"}, }}, - {RPCResult::Type::BOOL, "whitelisted", /* optional */ true, - "Whether the peer is whitelisted with default " - "permissions\n (DEPRECATED, returned only if config " - "option -deprecatedrpc=whitelisted is passed)"}, {RPCResult::Type::NUM, "minfeefilter", "The minimum fee rate for transactions this peer accepts"}, {RPCResult::Type::OBJ_DYN, @@ -293,10 +284,6 @@ obj.pushKV("inbound", stats.fInbound); obj.pushKV("bip152_hb_to", stats.m_bip152_highbandwidth_to); obj.pushKV("bip152_hb_from", stats.m_bip152_highbandwidth_from); - if (IsDeprecatedRPCEnabled(gArgs, "getpeerinfo_addnode")) { - // addnode is deprecated in v0.24.5 for removal in v0.25.x - obj.pushKV("addnode", stats.m_manual_connection); - } if (fStateStats) { obj.pushKV("startingheight", statestats.m_starting_height); obj.pushKV("synced_headers", statestats.nSyncHeight); @@ -310,10 +297,6 @@ obj.pushKV("addr_rate_limited", statestats.m_addr_rate_limited); } - if (IsDeprecatedRPCEnabled(gArgs, "whitelisted")) { - // whitelisted is deprecated in v0.24.7 for removal in v0.25 - obj.pushKV("whitelisted", stats.m_legacyWhitelisted); - } UniValue permissions(UniValue::VARR); for (const auto &permission : NetPermissions::ToStrings(stats.m_permissionFlags)) { diff --git a/test/functional/p2p_permissions.py b/test/functional/p2p_permissions.py --- a/test/functional/p2p_permissions.py +++ b/test/functional/p2p_permissions.py @@ -33,7 +33,7 @@ # 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 @@ -41,19 +41,19 @@ # Make sure the default values in the command line documentation # match the ones here ["relay", "noban", "mempool", "download"], - None) + ) self.checkpermission( # no permission (even with forcerelay) ["-whitelist=@127.0.0.1", "-whitelistforcerelay=1"], [], - False) + ) self.checkpermission( # relay permission removed (no specific permissions) ["-whitelist=127.0.0.1", "-whitelistrelay=0"], ["noban", "mempool", "download"], - True) + ) self.checkpermission( # forcerelay and relay permission added @@ -61,7 +61,7 @@ # if whitelistforcerelay is true ["-whitelist=127.0.0.1", "-whitelistforcerelay"], ["forcerelay", "relay", "noban", "mempool", "download"], - True) + ) # Let's make sure permissions are merged correctly # For this, we need to use whitebind instead of bind @@ -76,7 +76,7 @@ ["-whitelist=noban@127.0.0.1"], # Check parameter interaction forcerelay should activate relay ["noban", "bloomfilter", "forcerelay", "relay", "download"], - False) + ) self.replaceinconfig( 1, "whitebind=bloomfilter,forcerelay@" + @@ -87,38 +87,38 @@ # legacy whitelistrelay should be ignored ["-whitelist=noban,mempool@127.0.0.1", "-whitelistrelay"], ["noban", "mempool", "download"], - False) + ) self.checkpermission( # check without deprecatedrpc=whitelisted ["-whitelist=noban,mempool@127.0.0.1", "-whitelistrelay"], ["noban", "mempool", "download"], - None) + ) self.checkpermission( # legacy whitelistforcerelay should be ignored ["-whitelist=noban,mempool@127.0.0.1", "-whitelistforcerelay"], ["noban", "mempool", "download"], - False) + ) self.checkpermission( # missing mempool permission to be considered legacy whitelisted ["-whitelist=noban@127.0.0.1"], ["noban", "download"], - False) + ) self.checkpermission( # all permission added ["-whitelist=all@127.0.0.1"], ["forcerelay", "noban", "mempool", "bloomfilter", "relay", "download", "bypass_proof_request_limits", "addr"], - False) + ) self.checkpermission( # bypass_proof_request_limits permission ["-whitelist=bypass_proof_request_limits@127.0.0.1"], ["bypass_proof_request_limits"], - False) + ) self.stop_node(1) self.nodes[1].assert_start_raises_init_error( @@ -193,16 +193,10 @@ '{} 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 p not in peerinfo['permissions']: diff --git a/test/functional/rpc_deprecated.py b/test/functional/rpc_deprecated.py --- a/test/functional/rpc_deprecated.py +++ b/test/functional/rpc_deprecated.py @@ -10,8 +10,7 @@ def set_test_params(self): self.num_nodes = 2 self.extra_args = [[], - ["-deprecatedrpc=getpeerinfo_addnode", - "-deprecatedrpc=whitelisted"]] + []] def run_test(self): # This test should be used to verify correct behaviour of deprecated @@ -24,11 +23,7 @@ # self.log.info("Test generate RPC") # assert_raises_rpc_error(-32, 'The wallet generate rpc method is deprecated', self.nodes[0].rpc.generate, 1) # self.nodes[1].generate(1) - - self.log.info("Test deprecated fields from getpeerinfo") - for key in ['addnode', 'whitelisted']: - assert key not in self.nodes[0].getpeerinfo()[0] - assert key in self.nodes[1].getpeerinfo()[0] + pass if __name__ == '__main__':