Skip to content

Commit

Permalink
rpc: don't go below feerate_floor when converting vbytes
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reported-by: Matt Whitlock
  • Loading branch information
darosior authored and cdecker committed Jun 18, 2020
1 parent 0b99e2c commit 4302afd
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 3 additions & 0 deletions lightningd/json.c
Original file line number Diff line number Diff line change
@@ -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>
Expand Down Expand Up @@ -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;
}

Expand Down
1 change: 0 additions & 1 deletion tests/test_wallet.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
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
Expand Down

0 comments on commit 4302afd

Please sign in to comment.