mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-19 23:24:27 +01:00
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:
committed by
Christian Decker
parent
0b99e2cc42
commit
4302afd9a5
@@ -1,6 +1,7 @@
|
|||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
#include <bitcoin/address.h>
|
#include <bitcoin/address.h>
|
||||||
#include <bitcoin/base58.h>
|
#include <bitcoin/base58.h>
|
||||||
|
#include <bitcoin/feerate.h>
|
||||||
#include <bitcoin/script.h>
|
#include <bitcoin/script.h>
|
||||||
#include <ccan/json_escape/json_escape.h>
|
#include <ccan/json_escape/json_escape.h>
|
||||||
#include <ccan/mem/mem.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 = tal(cmd, u32);
|
||||||
**feerate = feerate_from_style(num, style);
|
**feerate = feerate_from_style(num, style);
|
||||||
|
if (**feerate < FEERATE_FLOOR)
|
||||||
|
**feerate = FEERATE_FLOOR;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,6 @@ import time
|
|||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.xfail(strict=True)
|
|
||||||
@unittest.skipIf(TEST_NETWORK != 'regtest', "Test relies on a number of example addresses valid only in regtest")
|
@unittest.skipIf(TEST_NETWORK != 'regtest', "Test relies on a number of example addresses valid only in regtest")
|
||||||
def test_withdraw(node_factory, bitcoind):
|
def test_withdraw(node_factory, bitcoind):
|
||||||
amount = 1000000
|
amount = 1000000
|
||||||
|
|||||||
Reference in New Issue
Block a user