mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-07-08 17:30:36 +02:00
[rpc] Remove deprecated "banscore" field from getpeerinfo
This commit is contained in:
@ -874,7 +874,6 @@ bool PeerManager::GetNodeStateStats(NodeId nodeid, CNodeStateStats &stats) {
|
||||
|
||||
PeerRef peer = GetPeerRef(nodeid);
|
||||
if (peer == nullptr) return false;
|
||||
stats.m_misbehavior_score = WITH_LOCK(peer->m_misbehavior_mutex, return peer->m_misbehavior_score);
|
||||
stats.m_starting_height = peer->m_starting_height;
|
||||
|
||||
return true;
|
||||
|
@ -33,7 +33,6 @@ static const bool DEFAULT_PEERBLOCKFILTERS = false;
|
||||
static const int DISCOURAGEMENT_THRESHOLD{100};
|
||||
|
||||
struct CNodeStateStats {
|
||||
int m_misbehavior_score = 0;
|
||||
int nSyncHeight = -1;
|
||||
int nCommonHeight = -1;
|
||||
int m_starting_height = -1;
|
||||
|
@ -131,7 +131,6 @@ static RPCHelpMan getpeerinfo()
|
||||
{RPCResult::Type::STR, "connection_type", "Type of connection: \n" + Join(CONNECTION_TYPE_DOC, ",\n") + ".\n"
|
||||
"Please note this output is unlikely to be stable in upcoming releases as we iterate to\n"
|
||||
"best capture connection behaviors."},
|
||||
{RPCResult::Type::NUM, "banscore", "The ban score (DEPRECATED, returned only if config option -deprecatedrpc=banscore is passed)"},
|
||||
{RPCResult::Type::NUM, "startingheight", "The starting height (block) of the peer"},
|
||||
{RPCResult::Type::NUM, "synced_headers", "The last header we have in common with this peer"},
|
||||
{RPCResult::Type::NUM, "synced_blocks", "The last block we have in common with this peer"},
|
||||
@ -223,10 +222,6 @@ static RPCHelpMan getpeerinfo()
|
||||
obj.pushKV("bip152_hb_to", stats.m_bip152_highbandwidth_to);
|
||||
obj.pushKV("bip152_hb_from", stats.m_bip152_highbandwidth_from);
|
||||
if (fStateStats) {
|
||||
if (IsDeprecatedRPCEnabled("banscore")) {
|
||||
// banscore is deprecated in v0.21 for removal in v0.22
|
||||
obj.pushKV("banscore", statestats.m_misbehavior_score);
|
||||
}
|
||||
obj.pushKV("startingheight", statestats.m_starting_height);
|
||||
obj.pushKV("synced_headers", statestats.nSyncHeight);
|
||||
obj.pushKV("synced_blocks", statestats.nCommonHeight);
|
||||
|
@ -1,27 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
# Copyright (c) 2020 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 deprecation of getpeerinfo RPC fields."""
|
||||
|
||||
from test_framework.test_framework import BitcoinTestFramework
|
||||
|
||||
|
||||
class GetpeerinfoDeprecationTest(BitcoinTestFramework):
|
||||
def set_test_params(self):
|
||||
self.num_nodes = 2
|
||||
self.extra_args = [[], ["-deprecatedrpc=banscore"]]
|
||||
|
||||
def run_test(self):
|
||||
self.test_banscore_deprecation()
|
||||
|
||||
def test_banscore_deprecation(self):
|
||||
self.log.info("Test getpeerinfo by default no longer returns a banscore field")
|
||||
assert "banscore" not in self.nodes[0].getpeerinfo()[0].keys()
|
||||
|
||||
self.log.info("Test getpeerinfo returns banscore with -deprecatedrpc=banscore")
|
||||
assert "banscore" in self.nodes[1].getpeerinfo()[0].keys()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
GetpeerinfoDeprecationTest().main()
|
@ -279,7 +279,6 @@ BASE_SCRIPTS = [
|
||||
'feature_config_args.py',
|
||||
'feature_settings.py',
|
||||
'rpc_getdescriptorinfo.py',
|
||||
'rpc_getpeerinfo_deprecation.py',
|
||||
'rpc_help.py',
|
||||
'feature_help.py',
|
||||
'feature_shutdown.py',
|
||||
|
Reference in New Issue
Block a user