|
| 1 | +#!/usr/bin/env python3 |
| 2 | +# Copyright (c) 2017 The Bitcoin Core developers |
| 3 | +# Distributed under the MIT software license, see the accompanying |
| 4 | +# file COPYING or http://www.opensource.org/licenses/mit-license.php. |
| 5 | +"""Test wallet replace-by-fee capabilities in conjunction with the fallbackfee.""" |
| 6 | +from test_framework.test_framework import BitcoinTestFramework |
| 7 | +from test_framework.util import * |
| 8 | + |
| 9 | +class WalletRBFTest(BitcoinTestFramework): |
| 10 | + def set_test_params(self): |
| 11 | + self.num_nodes = 1 |
| 12 | + self.setup_clean_chain = True |
| 13 | + |
| 14 | + def run_test(self): |
| 15 | + self.nodes[0].generate(101) |
| 16 | + |
| 17 | + # sending a transaction without fee estimations must be possible by default on regtest |
| 18 | + self.nodes[0].sendtoaddress(self.nodes[0].getnewaddress(), 1) |
| 19 | + |
| 20 | + # test sending a tx with disabled fallback fee (must fail) |
| 21 | + self.restart_node(0, extra_args=["-fallbackfee=0"]) |
| 22 | + assert_raises_rpc_error(-4, "Fee estimation failed", lambda: self.nodes[0].sendtoaddress(self.nodes[0].getnewaddress(), 1)) |
| 23 | + assert_raises_rpc_error(-4, "Fee estimation failed", lambda: self.nodes[0].fundrawtransaction(self.nodes[0].createrawtransaction([], {self.nodes[0].getnewaddress(): 1}))) |
| 24 | + assert_raises_rpc_error(-4, "Fee estimation failed", lambda: self.nodes[0].sendfrom("", self.nodes[0].getnewaddress(), 1)) |
| 25 | + assert_raises_rpc_error(-6, "Fee estimation failed", lambda: self.nodes[0].sendmany("", {self.nodes[0].getnewaddress(): 1})) |
| 26 | + |
| 27 | +if __name__ == '__main__': |
| 28 | + WalletRBFTest().main() |
0 commit comments