aboutsummaryrefslogtreecommitdiff
path: root/test/functional
diff options
context:
space:
mode:
authorJohn Newbery <john@johnnewbery.com>2017-07-18 15:49:56 -0400
committerJohn Newbery <john@johnnewbery.com>2017-08-10 13:44:02 -0400
commit095142d1f93f39ad2b88dbe8d40140223a1b3900 (patch)
tree792b20cb2673c7ebc29e2ef6752cc9ad353d5f82 /test/functional
parentc25d90f125d69e33688288eff439eb7be75012e9 (diff)
downloadbitcoin-095142d1f93f39ad2b88dbe8d40140223a1b3900.tar.xz
[wallet] keypool mark-used and topup
This commit adds basic keypool mark-used and topup: - try to topup the keypool on initial load - if a key in the keypool is used, mark all keys before that as used and try to top up
Diffstat (limited to 'test/functional')
-rwxr-xr-xtest/functional/wallet-hd.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/test/functional/wallet-hd.py b/test/functional/wallet-hd.py
index dfd3dc83c5..821575ed19 100755
--- a/test/functional/wallet-hd.py
+++ b/test/functional/wallet-hd.py
@@ -9,7 +9,6 @@ from test_framework.util import (
assert_equal,
connect_nodes_bi,
)
-import os
import shutil
@@ -72,10 +71,12 @@ class WalletHDTest(BitcoinTestFramework):
self.log.info("Restore backup ...")
self.stop_node(1)
- os.remove(self.options.tmpdir + "/node1/regtest/wallet.dat")
+ # we need to delete the complete regtest directory
+ # otherwise node1 would auto-recover all funds in flag the keypool keys as used
+ shutil.rmtree(tmpdir + "/node1/regtest/blocks")
+ shutil.rmtree(tmpdir + "/node1/regtest/chainstate")
shutil.copyfile(tmpdir + "/hd.bak", tmpdir + "/node1/regtest/wallet.dat")
self.nodes[1] = self.start_node(1, self.options.tmpdir, self.extra_args[1])
- #connect_nodes_bi(self.nodes, 0, 1)
# Assert that derivation is deterministic
hd_add_2 = None
@@ -85,11 +86,12 @@ class WalletHDTest(BitcoinTestFramework):
assert_equal(hd_info_2["hdkeypath"], "m/0'/0'/"+str(_+1)+"'")
assert_equal(hd_info_2["hdmasterkeyid"], masterkeyid)
assert_equal(hd_add, hd_add_2)
+ connect_nodes_bi(self.nodes, 0, 1)
+ self.sync_all()
# Needs rescan
self.stop_node(1)
self.nodes[1] = self.start_node(1, self.options.tmpdir, self.extra_args[1] + ['-rescan'])
- #connect_nodes_bi(self.nodes, 0, 1)
assert_equal(self.nodes[1].getbalance(), num_hd_adds + 1)
# send a tx and make sure its using the internal chain for the changeoutput