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
This commit is contained in:
Antoine Poinsot
2020-06-16 14:07:22 +02:00
committed by Christian Decker
parent 0b99e2cc42
commit 4302afd9a5
2 changed files with 3 additions and 1 deletions

View File

@@ -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;
}

View File

@@ -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