aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnthony Towns <aj@erisian.com.au>2018-06-22 18:53:39 +1000
committerAnthony Towns <aj@erisian.com.au>2018-08-27 21:13:15 +1000
commit5778bf95d94f4d187451a72a5b86ba4daaafe4ab (patch)
treee7d16369ff660d36bb42b9b97597bec967ac6d33
parentb5591ca0b053623f0d96423b05ad809115a0bdef (diff)
downloadbitcoin-5778bf95d94f4d187451a72a5b86ba4daaafe4ab.tar.xz
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.
-rw-r--r--src/net.cpp1
-rw-r--r--src/net.h1
-rw-r--r--src/rpc/net.cpp2
-rwxr-xr-xtest/functional/rpc_net.py5
4 files changed, 9 insertions, 0 deletions
diff --git a/src/net.cpp b/src/net.cpp
index ec4fa6c267..df2cb54b7a 100644
--- a/src/net.cpp
+++ b/src/net.cpp
@@ -715,6 +715,7 @@ void CNode::copyStats(CNodeStats &stats)
X(nRecvBytes);
}
X(fWhitelisted);
+ X(minFeeFilter);
// It is common for nodes with good ping times to suddenly become lagged,
// due to a new block arriving or other large transfer.
diff --git a/src/net.h b/src/net.h
index f9cfea59b7..edd2f8cf0d 100644
--- a/src/net.h
+++ b/src/net.h
@@ -558,6 +558,7 @@ public:
double dPingTime;
double dPingWait;
double dMinPing;
+ CAmount minFeeFilter;
// Our address, as reported by the peer
std::string addrLocal;
// Address of this peer
diff --git a/src/rpc/net.cpp b/src/rpc/net.cpp
index 610a1fee6f..343b7d3b05 100644
--- a/src/rpc/net.cpp
+++ b/src/rpc/net.cpp
@@ -102,6 +102,7 @@ static UniValue getpeerinfo(const JSONRPCRequest& request)
" ...\n"
" ],\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"
" \"addr\": n, (numeric) The total bytes sent aggregated by message type\n"
" ...\n"
@@ -169,6 +170,7 @@ static UniValue getpeerinfo(const JSONRPCRequest& request)
obj.pushKV("inflight", heights);
}
obj.pushKV("whitelisted", stats.fWhitelisted);
+ obj.pushKV("minfeefilter", ValueFromAmount(stats.minFeeFilter));
UniValue sendPerMsgCmd(UniValue::VOBJ);
for (const mapMsgCmdSize::value_type &i : stats.mapSendBytesPerMsgCmd) {
diff --git a/test/functional/rpc_net.py b/test/functional/rpc_net.py
index 02114eca76..a46518200c 100755
--- a/test/functional/rpc_net.py
+++ b/test/functional/rpc_net.py
@@ -7,6 +7,8 @@
Tests correspond to code in rpc/net.cpp.
"""
+from decimal import Decimal
+
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import (
assert_equal,
@@ -21,6 +23,7 @@ class NetTest(BitcoinTestFramework):
def set_test_params(self):
self.setup_clean_chain = True
self.num_nodes = 2
+ self.extra_args = [["-minrelaytxfee=0.00001000"],["-minrelaytxfee=0.00000500"]]
def run_test(self):
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
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[0][0]['minfeefilter'], Decimal("0.00000500"))
+ assert_equal(peer_info[1][0]['minfeefilter'], Decimal("0.00001000"))
if __name__ == '__main__':
NetTest().main()