Browse Source

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 <darosior@protonmail.com>
Reported-by: Matt Whitlock
nifty/pset-pre
Antoine Poinsot 5 years ago
committed by Christian Decker
parent
commit
4302afd9a5
  1. 3
      lightningd/json.c
  2. 1
      tests/test_wallet.py

3
lightningd/json.c

@ -1,6 +1,7 @@
#include <arpa/inet.h>
#include <bitcoin/address.h>
#include <bitcoin/base58.h>
#include <bitcoin/feerate.h>
#include <bitcoin/script.h>
#include <ccan/json_escape/json_escape.h>
#include <ccan/mem/mem.h>
@ -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;
}

1
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

Loading…
Cancel
Save