Merge #10859: RPC: gettxout: Slightly improve doc and tests
[bitcoinplatinum.git] / test / functional / resendwallettransactions.py
blob5059aa106e1e74a814e618469f744b632adeb1e9
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 resendwallettransactions RPC."""
7 from test_framework.test_framework import BitcoinTestFramework
8 from test_framework.util import assert_equal, assert_raises_jsonrpc
10 class ResendWalletTransactionsTest(BitcoinTestFramework):
12 def __init__(self):
13 super().__init__()
14 self.extra_args = [['--walletbroadcast=false']]
15 self.num_nodes = 1
17 def run_test(self):
18 # Should raise RPC_WALLET_ERROR (-4) if walletbroadcast is disabled.
19 assert_raises_jsonrpc(-4, "Error: Wallet transaction broadcasting is disabled with -walletbroadcast", self.nodes[0].resendwallettransactions)
21 # Should return an empty array if there aren't unconfirmed wallet transactions.
22 self.stop_node(0)
23 self.nodes[0] = self.start_node(0, self.options.tmpdir)
24 assert_equal(self.nodes[0].resendwallettransactions(), [])
26 # Should return an array with the unconfirmed wallet transaction.
27 txid = self.nodes[0].sendtoaddress(self.nodes[0].getnewaddress(), 1)
28 assert_equal(self.nodes[0].resendwallettransactions(), [txid])
30 if __name__ == '__main__':
31 ResendWalletTransactionsTest().main()