Skip to content

Commit bdf607e

Browse files
committed
test: Add resendwallettransactions functional tests
1 parent bf74d37 commit bdf607e

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
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+
7+
from test_framework.test_framework import BitcoinTestFramework
8+
from test_framework.util import assert_equal, assert_raises_jsonrpc
9+
10+
class ResendWalletTransactionsTest(BitcoinTestFramework):
11+
12+
def __init__(self):
13+
super().__init__()
14+
self.extra_args = [['--walletbroadcast=false']]
15+
self.num_nodes = 1
16+
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)
20+
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(), [])
25+
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])
29+
30+
if __name__ == '__main__':
31+
ResendWalletTransactionsTest().main()

test/functional/test_runner.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@
118118
'bipdersig-p2p.py',
119119
'bip65-cltv-p2p.py',
120120
'uptime.py',
121+
'resendwallettransactions.py',
121122
]
122123

123124
EXTENDED_SCRIPTS = [

0 commit comments

Comments
 (0)