2017-08-12 13:18:17 +02:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
# Copyright (c) 2017 The Bitcoin Core developers
|
|
|
|
# Distributed under the MIT software license, see the accompanying
|
|
|
|
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
|
|
|
"""Test resendwallettransactions RPC."""
|
|
|
|
|
|
|
|
from test_framework.test_framework import BitcoinTestFramework
|
2019-09-25 11:34:51 +02:00
|
|
|
from test_framework.util import assert_equal, assert_raises_rpc_error
|
2017-08-12 13:18:17 +02:00
|
|
|
|
|
|
|
class ResendWalletTransactionsTest(BitcoinTestFramework):
|
2017-09-01 18:47:13 +02:00
|
|
|
def set_test_params(self):
|
2017-08-12 13:18:17 +02:00
|
|
|
self.num_nodes = 1
|
2017-09-01 18:47:13 +02:00
|
|
|
self.extra_args = [['--walletbroadcast=false']]
|
2017-08-12 13:18:17 +02:00
|
|
|
|
2018-09-13 12:33:15 +02:00
|
|
|
def skip_test_if_missing_module(self):
|
|
|
|
self.skip_if_no_wallet()
|
|
|
|
|
2017-08-12 13:18:17 +02:00
|
|
|
def run_test(self):
|
|
|
|
# Should raise RPC_WALLET_ERROR (-4) if walletbroadcast is disabled.
|
2019-09-25 11:34:51 +02:00
|
|
|
assert_raises_rpc_error(-4, "Error: Wallet transaction broadcasting is disabled with -walletbroadcast", self.nodes[0].resendwallettransactions)
|
2017-08-12 13:18:17 +02:00
|
|
|
|
|
|
|
# Should return an empty array if there aren't unconfirmed wallet transactions.
|
|
|
|
self.stop_node(0)
|
2017-09-01 18:47:13 +02:00
|
|
|
self.start_node(0, extra_args=[])
|
2017-08-12 13:18:17 +02:00
|
|
|
assert_equal(self.nodes[0].resendwallettransactions(), [])
|
|
|
|
|
|
|
|
# Should return an array with the unconfirmed wallet transaction.
|
|
|
|
txid = self.nodes[0].sendtoaddress(self.nodes[0].getnewaddress(), 1)
|
|
|
|
assert_equal(self.nodes[0].resendwallettransactions(), [txid])
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
ResendWalletTransactionsTest().main()
|