Skip to content

Commit 8c7647b

Browse files
committed
rpc: deprecate banscore field in rpc getpeerinfo
1 parent abdfd2d commit 8c7647b

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/rpc/net.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ static UniValue getpeerinfo(const JSONRPCRequest& request)
112112
{RPCResult::Type::BOOL, "inbound", "Inbound (true) or Outbound (false)"},
113113
{RPCResult::Type::BOOL, "addnode", "Whether connection was due to addnode/-connect or if it was an automatic/inbound connection"},
114114
{RPCResult::Type::NUM, "startingheight", "The starting height (block) of the peer"},
115-
{RPCResult::Type::NUM, "banscore", "The ban score"},
115+
{RPCResult::Type::NUM, "banscore", "The ban score (DEPRECATED, returned only if config option -deprecatedrpc=banscore is passed)"},
116116
{RPCResult::Type::NUM, "synced_headers", "The last header we have in common with this peer"},
117117
{RPCResult::Type::NUM, "synced_blocks", "The last block we have in common with this peer"},
118118
{RPCResult::Type::ARR, "inflight", "",
@@ -191,7 +191,10 @@ static UniValue getpeerinfo(const JSONRPCRequest& request)
191191
obj.pushKV("addnode", stats.m_manual_connection);
192192
obj.pushKV("startingheight", stats.nStartingHeight);
193193
if (fStateStats) {
194-
obj.pushKV("banscore", statestats.nMisbehavior);
194+
if (IsDeprecatedRPCEnabled("banscore")) {
195+
// banscore is deprecated in v0.21 for removal in v0.22
196+
obj.pushKV("banscore", statestats.nMisbehavior);
197+
}
195198
obj.pushKV("synced_headers", statestats.nSyncHeight);
196199
obj.pushKV("synced_blocks", statestats.nCommonHeight);
197200
UniValue heights(UniValue::VARR);

0 commit comments

Comments
 (0)