You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

resendwallettransactions.py 1.3KB

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