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 resendwallettransactions RPC."""
7 from test_framework
.test_framework
import BitcoinTestFramework
8 from test_framework
.util
import assert_equal
, assert_raises_rpc_error
10 class ResendWalletTransactionsTest(BitcoinTestFramework
):
11 def set_test_params(self
):
13 self
.extra_args
= [['--walletbroadcast=false']]
16 # Should raise RPC_WALLET_ERROR (-4) if walletbroadcast is disabled.
17 assert_raises_rpc_error(-4, "Error: Wallet transaction broadcasting is disabled with -walletbroadcast", self
.nodes
[0].resendwallettransactions
)
19 # Should return an empty array if there aren't unconfirmed wallet transactions.
21 self
.start_node(0, extra_args
=[])
22 assert_equal(self
.nodes
[0].resendwallettransactions(), [])
24 # Should return an array with the unconfirmed wallet transaction.
25 txid
= self
.nodes
[0].sendtoaddress(self
.nodes
[0].getnewaddress(), 1)
26 assert_equal(self
.nodes
[0].resendwallettransactions(), [txid
])
28 if __name__
== '__main__':
29 ResendWalletTransactionsTest().main()