2018-03-01 18:27:08 +01:00
|
|
|
#!/usr/bin/env python3
|
2020-12-31 18:50:11 +01:00
|
|
|
# Copyright (c) 2017-2020 The Bitcoin Core developers
|
2018-03-01 18:27:08 +01:00
|
|
|
# Distributed under the MIT software license, see the accompanying
|
|
|
|
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
|
|
|
"""Test wallet replace-by-fee capabilities in conjunction with the fallbackfee."""
|
2021-05-31 11:26:16 +02:00
|
|
|
|
|
|
|
from test_framework.blocktools import COINBASE_MATURITY
|
2018-03-01 18:27:08 +01:00
|
|
|
from test_framework.test_framework import BitcoinTestFramework
|
|
|
|
from test_framework.util import assert_raises_rpc_error
|
|
|
|
|
|
|
|
class WalletRBFTest(BitcoinTestFramework):
|
|
|
|
def set_test_params(self):
|
|
|
|
self.num_nodes = 1
|
|
|
|
self.setup_clean_chain = True
|
|
|
|
|
2023-02-14 09:48:28 +01:00
|
|
|
def skip_test_if_missing_module(self):
|
|
|
|
self.skip_if_no_wallet()
|
|
|
|
|
2018-03-01 18:27:08 +01:00
|
|
|
def run_test(self):
|
2021-05-31 11:26:16 +02:00
|
|
|
self.nodes[0].generate(COINBASE_MATURITY + 1)
|
2018-03-01 18:27:08 +01:00
|
|
|
|
|
|
|
# sending a transaction without fee estimations must be possible by default on regtest
|
|
|
|
self.nodes[0].sendtoaddress(self.nodes[0].getnewaddress(), 1)
|
|
|
|
|
|
|
|
# test sending a tx with disabled fallback fee (must fail)
|
|
|
|
self.restart_node(0, extra_args=["-fallbackfee=0"])
|
|
|
|
assert_raises_rpc_error(-4, "Fee estimation failed", lambda: self.nodes[0].sendtoaddress(self.nodes[0].getnewaddress(), 1))
|
|
|
|
assert_raises_rpc_error(-4, "Fee estimation failed", lambda: self.nodes[0].fundrawtransaction(self.nodes[0].createrawtransaction([], {self.nodes[0].getnewaddress(): 1})))
|
|
|
|
assert_raises_rpc_error(-6, "Fee estimation failed", lambda: self.nodes[0].sendmany("", {self.nodes[0].getnewaddress(): 1}))
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
WalletRBFTest().main()
|