Merge #13987: Report minfeefilter value in getpeerinfo rpc

5778bf95d9 Report minfeefilter value in getpeerinfo rpc (Anthony Towns)

Pull request description:

  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.

Tree-SHA512: 059f01bf2a32c98fce1648a13b7898701203b354d0209ee34e6683994b720eb594cf24968e66b699caae5e17e53d351e73281f042dd094decde14d3a318e9fb3
This commit is contained in:
MarcoFalke 2018-08-27 07:28:17 -04:00
commit 6667490466
No known key found for this signature in database
GPG key ID: D2EA4850E7528B25
4 changed files with 9 additions and 0 deletions

View file

@ -715,6 +715,7 @@ void CNode::copyStats(CNodeStats &stats)
X(nRecvBytes); X(nRecvBytes);
} }
X(fWhitelisted); X(fWhitelisted);
X(minFeeFilter);
// It is common for nodes with good ping times to suddenly become lagged, // It is common for nodes with good ping times to suddenly become lagged,
// due to a new block arriving or other large transfer. // due to a new block arriving or other large transfer.

View file

@ -558,6 +558,7 @@ public:
double dPingTime; double dPingTime;
double dPingWait; double dPingWait;
double dMinPing; double dMinPing;
CAmount minFeeFilter;
// Our address, as reported by the peer // Our address, as reported by the peer
std::string addrLocal; std::string addrLocal;
// Address of this peer // Address of this peer

View file

@ -102,6 +102,7 @@ static UniValue getpeerinfo(const JSONRPCRequest& request)
" ...\n" " ...\n"
" ],\n" " ],\n"
" \"whitelisted\": true|false, (boolean) Whether the peer is whitelisted\n" " \"whitelisted\": true|false, (boolean) Whether the peer is whitelisted\n"
" \"minfeefilter\": n, (numeric) The minimum fee rate for transactions this peer accepts\n"
" \"bytessent_per_msg\": {\n" " \"bytessent_per_msg\": {\n"
" \"addr\": n, (numeric) The total bytes sent aggregated by message type\n" " \"addr\": n, (numeric) The total bytes sent aggregated by message type\n"
" ...\n" " ...\n"
@ -169,6 +170,7 @@ static UniValue getpeerinfo(const JSONRPCRequest& request)
obj.pushKV("inflight", heights); obj.pushKV("inflight", heights);
} }
obj.pushKV("whitelisted", stats.fWhitelisted); obj.pushKV("whitelisted", stats.fWhitelisted);
obj.pushKV("minfeefilter", ValueFromAmount(stats.minFeeFilter));
UniValue sendPerMsgCmd(UniValue::VOBJ); UniValue sendPerMsgCmd(UniValue::VOBJ);
for (const mapMsgCmdSize::value_type &i : stats.mapSendBytesPerMsgCmd) { for (const mapMsgCmdSize::value_type &i : stats.mapSendBytesPerMsgCmd) {

View file

@ -7,6 +7,8 @@
Tests correspond to code in rpc/net.cpp. Tests correspond to code in rpc/net.cpp.
""" """
from decimal import Decimal
from test_framework.test_framework import BitcoinTestFramework from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import ( from test_framework.util import (
assert_equal, assert_equal,
@ -21,6 +23,7 @@ class NetTest(BitcoinTestFramework):
def set_test_params(self): def set_test_params(self):
self.setup_clean_chain = True self.setup_clean_chain = True
self.num_nodes = 2 self.num_nodes = 2
self.extra_args = [["-minrelaytxfee=0.00001000"],["-minrelaytxfee=0.00000500"]]
def run_test(self): def run_test(self):
self._test_connection_count() self._test_connection_count()
@ -95,6 +98,8 @@ class NetTest(BitcoinTestFramework):
# the address bound to on one side will be the source address for the other node # the address bound to on one side will be the source address for the other node
assert_equal(peer_info[0][0]['addrbind'], peer_info[1][0]['addr']) assert_equal(peer_info[0][0]['addrbind'], peer_info[1][0]['addr'])
assert_equal(peer_info[1][0]['addrbind'], peer_info[0][0]['addr']) assert_equal(peer_info[1][0]['addrbind'], peer_info[0][0]['addr'])
assert_equal(peer_info[0][0]['minfeefilter'], Decimal("0.00000500"))
assert_equal(peer_info[1][0]['minfeefilter'], Decimal("0.00001000"))
if __name__ == '__main__': if __name__ == '__main__':
NetTest().main() NetTest().main()