[rpc] Add dustlimit info to getnetworkinfo
This commit is contained in:
parent
b2a55984f8
commit
c3cead8737
|
@ -59,6 +59,12 @@ class DustLimitTest(BitcoinTestFramework):
|
||||||
|
|
||||||
def run_test(self):
|
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
|
# set up 10 seeded addresses for node 0-2
|
||||||
addrs = []
|
addrs = []
|
||||||
for i in range(3):
|
for i in range(3):
|
||||||
|
@ -162,5 +168,10 @@ class DustLimitTest(BitcoinTestFramework):
|
||||||
rawtx = self.create_dusty_tx(n, dust, fee)
|
rawtx = self.create_dusty_tx(n, dust, fee)
|
||||||
assert_raises_jsonrpc(-26, "dust", n.sendrawtransaction, rawtx['hex'])
|
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__':
|
if __name__ == '__main__':
|
||||||
DustLimitTest().main()
|
DustLimitTest().main()
|
||||||
|
|
|
@ -422,6 +422,8 @@ UniValue getnetworkinfo(const JSONRPCRequest& request)
|
||||||
" ],\n"
|
" ],\n"
|
||||||
" \"relayfee\": x.xxxxxxxx, (numeric) minimum relay fee for non-free transactions in " + CURRENCY_UNIT + "/kB\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"
|
" \"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"
|
" \"localaddresses\": [ (array) list of local addresses\n"
|
||||||
" {\n"
|
" {\n"
|
||||||
" \"address\": \"xxxx\", (string) network address\n"
|
" \"address\": \"xxxx\", (string) network address\n"
|
||||||
|
@ -453,6 +455,8 @@ UniValue getnetworkinfo(const JSONRPCRequest& request)
|
||||||
obj.pushKV("networks", GetNetworksInfo());
|
obj.pushKV("networks", GetNetworksInfo());
|
||||||
obj.pushKV("relayfee", ValueFromAmount(::minRelayTxFeeRate.GetFeePerK()));
|
obj.pushKV("relayfee", ValueFromAmount(::minRelayTxFeeRate.GetFeePerK()));
|
||||||
obj.pushKV("incrementalfee", ValueFromAmount(::incrementalRelayFee.GetFeePerK()));
|
obj.pushKV("incrementalfee", ValueFromAmount(::incrementalRelayFee.GetFeePerK()));
|
||||||
|
obj.pushKV("softdustlimit", ValueFromAmount(nDustLimit));
|
||||||
|
obj.pushKV("harddustlimit", ValueFromAmount(nHardDustLimit));
|
||||||
UniValue localAddresses(UniValue::VARR);
|
UniValue localAddresses(UniValue::VARR);
|
||||||
{
|
{
|
||||||
LOCK(cs_mapLocalHost);
|
LOCK(cs_mapLocalHost);
|
||||||
|
|
Loading…
Reference in a new issue