Skip to content

Commit 5778bf9

Browse files
committed
Report minfeefilter value in getpeerinfo rpc
Lowering the minimum relay fee is only useful when many nodes in the p2p network also lower the fee, so to make it easier to understand progress on that front, this includes the value of the minfeefilter in getpeerinfo, so you at least have visibility to what fees your neighbours are currently accepting.
1 parent b5591ca commit 5778bf9

File tree

4 files changed

+9
-0
lines changed

4 files changed

+9
-0
lines changed

src/net.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -715,6 +715,7 @@ void CNode::copyStats(CNodeStats &stats)
715715
X(nRecvBytes);
716716
}
717717
X(fWhitelisted);
718+
X(minFeeFilter);
718719

719720
// It is common for nodes with good ping times to suddenly become lagged,
720721
// due to a new block arriving or other large transfer.

src/net.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -558,6 +558,7 @@ class CNodeStats
558558
double dPingTime;
559559
double dPingWait;
560560
double dMinPing;
561+
CAmount minFeeFilter;
561562
// Our address, as reported by the peer
562563
std::string addrLocal;
563564
// Address of this peer

src/rpc/net.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ static UniValue getpeerinfo(const JSONRPCRequest& request)
102102
" ...\n"
103103
" ],\n"
104104
" \"whitelisted\": true|false, (boolean) Whether the peer is whitelisted\n"
105+
" \"minfeefilter\": n, (numeric) The minimum fee rate for transactions this peer accepts\n"
105106
" \"bytessent_per_msg\": {\n"
106107
" \"addr\": n, (numeric) The total bytes sent aggregated by message type\n"
107108
" ...\n"
@@ -169,6 +170,7 @@ static UniValue getpeerinfo(const JSONRPCRequest& request)
169170
obj.pushKV("inflight", heights);
170171
}
171172
obj.pushKV("whitelisted", stats.fWhitelisted);
173+
obj.pushKV("minfeefilter", ValueFromAmount(stats.minFeeFilter));
172174

173175
UniValue sendPerMsgCmd(UniValue::VOBJ);
174176
for (const mapMsgCmdSize::value_type &i : stats.mapSendBytesPerMsgCmd) {

test/functional/rpc_net.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
Tests correspond to code in rpc/net.cpp.
88
"""
99

10+
from decimal import Decimal
11+
1012
from test_framework.test_framework import BitcoinTestFramework
1113
from test_framework.util import (
1214
assert_equal,
@@ -21,6 +23,7 @@ class NetTest(BitcoinTestFramework):
2123
def set_test_params(self):
2224
self.setup_clean_chain = True
2325
self.num_nodes = 2
26+
self.extra_args = [["-minrelaytxfee=0.00001000"],["-minrelaytxfee=0.00000500"]]
2427

2528
def run_test(self):
2629
self._test_connection_count()
@@ -95,6 +98,8 @@ def _test_getpeerinfo(self):
9598
# the address bound to on one side will be the source address for the other node
9699
assert_equal(peer_info[0][0]['addrbind'], peer_info[1][0]['addr'])
97100
assert_equal(peer_info[1][0]['addrbind'], peer_info[0][0]['addr'])
101+
assert_equal(peer_info[0][0]['minfeefilter'], Decimal("0.00000500"))
102+
assert_equal(peer_info[1][0]['minfeefilter'], Decimal("0.00001000"))
98103

99104
if __name__ == '__main__':
100105
NetTest().main()

0 commit comments

Comments
 (0)