From c3cead8737cf276f935c598955ce8b1f9c5f5862 Mon Sep 17 00:00:00 2001 From: Patrick Date: Thu, 28 Oct 2021 16:10:42 -0400 Subject: [PATCH] [rpc] Add dustlimit info to getnetworkinfo --- qa/rpc-tests/dustlimits.py | 11 +++++++++++ src/rpc/net.cpp | 4 ++++ 2 files changed, 15 insertions(+) diff --git a/qa/rpc-tests/dustlimits.py b/qa/rpc-tests/dustlimits.py index 3ced377a3..208aab540 100644 --- a/qa/rpc-tests/dustlimits.py +++ b/qa/rpc-tests/dustlimits.py @@ -59,6 +59,12 @@ class DustLimitTest(BitcoinTestFramework): def run_test(self): + # make sure the dust limits got configured + self.check_dust_config(self.nodes[0], Decimal("1.0"), Decimal("0.0")) + self.check_dust_config(self.nodes[1], Decimal("1.0"), Decimal("1.0")) + self.check_dust_config(self.nodes[2], Decimal("0.01"), Decimal("0.001")) + self.check_dust_config(self.nodes[3], Decimal("0.0"), Decimal("0.0")) + # set up 10 seeded addresses for node 0-2 addrs = [] for i in range(3): @@ -162,5 +168,10 @@ class DustLimitTest(BitcoinTestFramework): rawtx = self.create_dusty_tx(n, dust, fee) assert_raises_jsonrpc(-26, "dust", n.sendrawtransaction, rawtx['hex']) + def check_dust_config(self, n, soft, hard): + networkinfo = n.getnetworkinfo() + assert_equal(networkinfo["softdustlimit"], soft) + assert_equal(networkinfo["harddustlimit"], hard) + if __name__ == '__main__': DustLimitTest().main() diff --git a/src/rpc/net.cpp b/src/rpc/net.cpp index b6e6f19aa..94c07a3ec 100644 --- a/src/rpc/net.cpp +++ b/src/rpc/net.cpp @@ -422,6 +422,8 @@ UniValue getnetworkinfo(const JSONRPCRequest& request) " ],\n" " \"relayfee\": x.xxxxxxxx, (numeric) minimum relay fee for non-free transactions in " + CURRENCY_UNIT + "/kB\n" " \"incrementalfee\": x.xxxxxxxx, (numeric) minimum fee increment for mempool limiting or BIP 125 replacement in " + CURRENCY_UNIT + "/kB\n" + " \"softdustlimit\": x.xxxxxxxx, (numeric) minimum output value under which this value needs to be added to fee, in " + CURRENCY_UNIT + "\n" + " \"harddustlimit\": x.xxxxxxxx, (numeric) minimum output value under which the node will no longer relay, in " + CURRENCY_UNIT + "\n" " \"localaddresses\": [ (array) list of local addresses\n" " {\n" " \"address\": \"xxxx\", (string) network address\n" @@ -453,6 +455,8 @@ UniValue getnetworkinfo(const JSONRPCRequest& request) obj.pushKV("networks", GetNetworksInfo()); obj.pushKV("relayfee", ValueFromAmount(::minRelayTxFeeRate.GetFeePerK())); obj.pushKV("incrementalfee", ValueFromAmount(::incrementalRelayFee.GetFeePerK())); + obj.pushKV("softdustlimit", ValueFromAmount(nDustLimit)); + obj.pushKV("harddustlimit", ValueFromAmount(nHardDustLimit)); UniValue localAddresses(UniValue::VARR); { LOCK(cs_mapLocalHost);