diff --git a/test/functional/abc-parkedchain.py b/test/functional/abc-parkedchain.py --- a/test/functional/abc-parkedchain.py +++ b/test/functional/abc-parkedchain.py @@ -172,8 +172,12 @@ # Invalidate the tip on node 0, so it doesn't follow node 1. node.invalidateblock(node.getbestblockhash()) # Mine block to create a fork of proper depth - parking_node.generate(depth - 1) - node.generate(depth) + parking_node.generatetoaddress( + nblocks=depth - 1, + address=parking_node.getnewaddress(label='coinbase')) + node.generatetoaddress( + nblocks=depth, + address=node.getnewaddress(label='coinbase')) # extra block should now find themselves parked for i in range(extra_blocks): node.generate(1) @@ -203,7 +207,9 @@ # generate a ton of blocks at once. try: with parking_node.assert_debug_log(["Park block"]): - node.generate(20) + node.generatetoaddress( + nblocks=20, + address=node.getnewaddress(label='coinbase')) wait_until(lambda: parking_node.getbestblockhash() == node.getbestblockhash()) except AssertionError as exc: @@ -216,7 +222,9 @@ # Set up parking node height = fork + 4, node height = fork + 5 node.invalidateblock(node.getbestblockhash()) parking_node.generate(3) - node.generate(5) + node.generatetoaddress( + nblocks=5, + address=node.getnewaddress(label='coinbase')) wait_for_parked_block(node.getbestblockhash()) # Restart the parking node without parkdeepreorg. self.restart_node(1, ["-parkdeepreorg=0"]) diff --git a/test/functional/wallet_keypool.py b/test/functional/wallet_keypool.py --- a/test/functional/wallet_keypool.py +++ b/test/functional/wallet_keypool.py @@ -81,11 +81,10 @@ time.sleep(1.1) assert_equal(nodes[0].getwalletinfo()["unlocked_until"], 0) - # drain them by mining - nodes[0].generate(1) - nodes[0].generate(1) - nodes[0].generate(1) - assert_raises_rpc_error(-12, "Keypool ran out", nodes[0].generate, 1) + # drain the keypool + for _ in range(3): + nodes[0].getnewaddress() + assert_raises_rpc_error(-12, "Keypool ran out", nodes[0].getnewaddress) nodes[0].walletpassphrase('test', 100) nodes[0].keypoolrefill(100) diff --git a/test/functional/wallet_labels.py b/test/functional/wallet_labels.py --- a/test/functional/wallet_labels.py +++ b/test/functional/wallet_labels.py @@ -30,8 +30,13 @@ # Note each time we call generate, all generated coins go into # the same address, so we call twice to get two addresses w/50 each - node.generate(1) - node.generate(101) + node.generatetoaddress( + nblocks=1, address=node.getnewaddress( + label='coinbase')) + node.generatetoaddress( + nblocks=101, + address=node.getnewaddress( + label='coinbase')) assert_equal(node.getbalance(), 100) # there should be 2 address groups @@ -43,8 +48,9 @@ linked_addresses = set() for address_group in address_groups: assert_equal(len(address_group), 1) - assert_equal(len(address_group[0]), 2) + assert_equal(len(address_group[0]), 3) assert_equal(address_group[0][1], 50) + assert_equal(address_group[0][2], 'coinbase') linked_addresses.add(address_group[0][0]) # send 50 from each address to a third address not in this wallet @@ -79,7 +85,8 @@ label.verify(node) # Check all labels are returned by listlabels. - assert_equal(node.listlabels(), [label.name for label in labels]) + assert_equal(node.listlabels(), sorted( + ['coinbase'] + [label.name for label in labels])) # Send a transaction to each label. for label in labels: diff --git a/test/functional/wallet_multiwallet.py b/test/functional/wallet_multiwallet.py --- a/test/functional/wallet_multiwallet.py +++ b/test/functional/wallet_multiwallet.py @@ -178,7 +178,7 @@ self.start_node(0, ['-wallet=w4', '-wallet=w5']) assert_equal(set(node.listwallets()), {"w4", "w5"}) w5 = wallet("w5") - w5.generate(1) + node.generatetoaddress(nblocks=1, address=w5.getnewaddress()) # now if wallets/ exists again, but the rootdir is specified as the # walletdir, w4 and w5 should still be loaded @@ -207,7 +207,7 @@ wallet_bad = wallet("bad") # check wallet names and balances - wallets[0].generate(1) + node.generatetoaddress(nblocks=1, address=wallets[0].getnewaddress()) for wallet_name, wallet in zip(wallet_names, wallets): info = wallet.getwalletinfo() assert_equal(info['immature_balance'], @@ -223,7 +223,7 @@ node.getwalletinfo) w1, w2, w3, w4, *_ = wallets - w1.generate(101) + node.generatetoaddress(nblocks=101, address=w1.getnewaddress()) assert_equal(w1.getbalance(), 100) assert_equal(w2.getbalance(), 0) assert_equal(w3.getbalance(), 0) @@ -232,7 +232,7 @@ w1.sendtoaddress(w2.getnewaddress(), 1) w1.sendtoaddress(w3.getnewaddress(), 2) w1.sendtoaddress(w4.getnewaddress(), 3) - w1.generate(1) + node.generatetoaddress(nblocks=1, address=w1.getnewaddress()) assert_equal(w2.getbalance(), 1) assert_equal(w3.getbalance(), 2) assert_equal(w4.getbalance(), 3)