From 4302afd9a58f0c455bb812b63e9cdf377ebb74d4 Mon Sep 17 00:00:00 2001 From: Antoine Poinsot Date: Tue, 16 Jun 2020 14:07:22 +0200 Subject: [PATCH] rpc: don't go below feerate_floor when converting vbytes We passed below the floor when the user specified `1000perkb`. Matt Whitlock says : I was withdrawing with feerate=1000perkb, which should be the minimum-allowed fee rate. Indeed, bitcoin-cli getmempoolinfo reports: { "loaded": true, "size": 15097, "bytes": 9207924, "usage": 32831760, "maxmempool": 64000000, "mempoolminfee": 0.00001000, "minrelaytxfee": 0.00001000 } Changelog-fixed: rpc: The `feerate` parameters now correctly handle the standardness minimum when passed as `perkb`. Signed-off-by: Antoine Poinsot Reported-by: Matt Whitlock --- lightningd/json.c | 3 +++ tests/test_wallet.py | 1 - 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/lightningd/json.c b/lightningd/json.c index 4b790761d..d074c0294 100644 --- a/lightningd/json.c +++ b/lightningd/json.c @@ -1,6 +1,7 @@ #include #include #include +#include #include #include #include @@ -159,6 +160,8 @@ struct command_result *param_feerate(struct command *cmd, const char *name, *feerate = tal(cmd, u32); **feerate = feerate_from_style(num, style); + if (**feerate < FEERATE_FLOOR) + **feerate = FEERATE_FLOOR; return NULL; } diff --git a/tests/test_wallet.py b/tests/test_wallet.py index 66cc76223..e3a982b17 100644 --- a/tests/test_wallet.py +++ b/tests/test_wallet.py @@ -15,7 +15,6 @@ import time import unittest -@pytest.mark.xfail(strict=True) @unittest.skipIf(TEST_NETWORK != 'regtest', "Test relies on a number of example addresses valid only in regtest") def test_withdraw(node_factory, bitcoind): amount = 1000000