]>
Commit | Line | Data |
---|---|---|
a76174b7 JG |
1 | #!/usr/bin/env python2 |
2 | # Copyright (c) 2017 The Zcash developers | |
3 | # Distributed under the MIT software license, see the accompanying | |
4 | # file COPYING or http://www.opensource.org/licenses/mit-license.php. | |
5 | ||
6 | # | |
7 | # Create a large wallet | |
8 | # | |
9 | # To use: | |
10 | # - Copy to qa/rpc-tests/wallet_large.py | |
11 | # - Add wallet_large.py to RPC tests list | |
e719bf75 | 12 | # - ./qa/pull-tester/rpc-tests.sh wallet_large --nocleanup |
a76174b7 JG |
13 | # - Archive the resulting /tmp/test###### directory |
14 | # | |
15 | ||
16 | from test_framework.test_framework import BitcoinTestFramework | |
17 | from test_framework.util import ( | |
18 | assert_equal, | |
19 | connect_nodes_bi, | |
20 | initialize_chain_clean, | |
21 | start_nodes, | |
22 | ) | |
23 | ||
24 | from decimal import Decimal | |
25 | ||
26 | ||
27 | class LargeWalletTest(BitcoinTestFramework): | |
28 | ||
29 | def setup_chain(self): | |
30 | print("Initializing test directory "+self.options.tmpdir) | |
31 | initialize_chain_clean(self.options.tmpdir, 2) | |
32 | ||
33 | def setup_network(self): | |
34 | self.nodes = start_nodes(2, self.options.tmpdir) | |
35 | connect_nodes_bi(self.nodes, 0, 1) | |
36 | self.is_network_split = False | |
37 | self.sync_all() | |
38 | ||
39 | def run_test(self): | |
40 | self.nodes[1].generate(103) | |
41 | self.sync_all() | |
42 | ||
43 | inputs = [] | |
44 | for i in range(200000): | |
45 | taddr = self.nodes[0].getnewaddress() | |
46 | inputs.append(self.nodes[1].sendtoaddress(taddr, Decimal("0.001"))) | |
47 | if i % 1000 == 0: | |
48 | self.nodes[1].generate(1) | |
49 | self.sync_all() | |
50 | ||
a76174b7 | 51 | self.nodes[1].generate(1) |
a76174b7 JG |
52 | self.sync_all() |
53 | print('Node 0: %d transactions, %d UTXOs' % | |
54 | (len(self.nodes[0].listtransactions()), len(self.nodes[0].listunspent()))) | |
55 | print('Node 1: %d transactions, %d UTXOs' % | |
56 | (len(self.nodes[1].listtransactions()), len(self.nodes[1].listunspent()))) | |
d669871e | 57 | assert_equal(len(self.nodes[0].listunspent()), len(inputs)) |
a76174b7 JG |
58 | |
59 | if __name__ == '__main__': | |
60 | LargeWalletTest().main() |