mirror of
https://github.com/Retropex/bitcoin.git
synced 2025-05-28 21:12:29 +02:00
net: add forced_inbound to getpeerinfo
Github-Pull: #27600 Rebased-From: 8c2026848da910fdebff0a9f73e29f1f6ae81e43
This commit is contained in:
parent
2b3e19e9e8
commit
b0d90d2885
@ -633,6 +633,7 @@ void CNode::CopyStats(CNodeStats& stats)
|
||||
if (info.session_id) stats.m_session_id = HexStr(*info.session_id);
|
||||
}
|
||||
X(m_permission_flags);
|
||||
X(m_forced_inbound);
|
||||
|
||||
X(m_last_ping_time);
|
||||
X(m_min_ping_time);
|
||||
|
@ -222,6 +222,8 @@ public:
|
||||
TransportProtocolType m_transport_type;
|
||||
/** BIP324 session id string in hex, if any. */
|
||||
std::string m_session_id;
|
||||
/** whether this peer forced its connection by evicting another */
|
||||
bool m_forced_inbound;
|
||||
};
|
||||
|
||||
|
||||
|
@ -168,6 +168,7 @@ static RPCHelpMan getpeerinfo()
|
||||
{
|
||||
{RPCResult::Type::STR, "permission_type", Join(NET_PERMISSIONS_DOC, ",\n") + ".\n"},
|
||||
}},
|
||||
{RPCResult::Type::BOOL, "forced_inbound", "Whether this peer forced a connection by evicting another."},
|
||||
{RPCResult::Type::NUM, "minfeefilter", "The minimum fee rate for transactions this peer accepts"},
|
||||
{RPCResult::Type::OBJ_DYN, "bytessent_per_msg", "",
|
||||
{
|
||||
@ -275,6 +276,7 @@ static RPCHelpMan getpeerinfo()
|
||||
permissions.push_back(permission);
|
||||
}
|
||||
obj.pushKV("permissions", std::move(permissions));
|
||||
obj.pushKV("forced_inbound", stats.m_forced_inbound);
|
||||
obj.pushKV("minfeefilter", ValueFromAmount(statestats.m_fee_filter_received));
|
||||
|
||||
UniValue sendPerMsgType(UniValue::VOBJ);
|
||||
|
@ -148,7 +148,13 @@ class P2PEvict(BitcoinTestFramework):
|
||||
self.log.debug("ForceInbound whitebind inbound gets connected, even when full")
|
||||
allowed_peers.append(node.add_p2p_connection(P2PInterface(), dstport=30202))
|
||||
|
||||
assert_equal(len(node.getpeerinfo()), 10)
|
||||
peerinfo = node.getpeerinfo()
|
||||
assert_equal(len(peerinfo), 10)
|
||||
for peer in peerinfo:
|
||||
if "30202" in peer["addrbind"]:
|
||||
assert peer["forced_inbound"]
|
||||
else:
|
||||
assert not peer["forced_inbound"]
|
||||
|
||||
self.log.debug("Generic inbound gets rejected when whitebind peer is filling inbound slot")
|
||||
with node.assert_debug_log(["failed to find an eviction candidate - connection dropped (full)"]):
|
||||
|
@ -161,6 +161,7 @@ class NetTest(BitcoinTestFramework):
|
||||
"minfeefilter": Decimal("0E-8"),
|
||||
"network": "not_publicly_routable",
|
||||
"permissions": [],
|
||||
"forced_inbound": False,
|
||||
"presynced_headers": -1,
|
||||
"relaytxes": False,
|
||||
"services": "0000000000000000",
|
||||
|
Loading…
Reference in New Issue
Block a user