Usability improvements for z_importkey
- Add height parameter to z_importkey to reduce rescan range - Change semantics of rescan parameter, so users can explicitly force a rescan for existing keys. Closes #2032
This commit is contained in:
@@ -31,6 +31,14 @@ class Wallet1941RegressionTest (BitcoinTestFramework):
|
||||
connect_nodes_bi(self.nodes,0,1)
|
||||
self.sync_all()
|
||||
|
||||
def restart_second_node(self, extra_args=[]):
|
||||
self.nodes[1].stop()
|
||||
bitcoind_processes[1].wait()
|
||||
self.nodes[1] = start_node(1, self.options.tmpdir, extra_args=['-regtestprotectcoinbase','-debug=zrpc'] + extra_args)
|
||||
self.nodes[1].setmocktime(starttime + 9000)
|
||||
connect_nodes_bi(self.nodes, 0, 1)
|
||||
self.sync_all()
|
||||
|
||||
def wait_and_assert_operationid_status(self, myopid, in_status='success', in_errormsg=None):
|
||||
print('waiting for async operation {}'.format(myopid))
|
||||
opids = []
|
||||
@@ -93,8 +101,16 @@ class Wallet1941RegressionTest (BitcoinTestFramework):
|
||||
self.nodes[1].generate(101)
|
||||
self.sync_all()
|
||||
|
||||
# Import the key on node 1.
|
||||
self.nodes[1].z_importkey(key)
|
||||
# Import the key on node 1, only scanning the last few blocks.
|
||||
self.nodes[1].z_importkey(key, 'true', self.nodes[1].getblockchaininfo()['blocks'] - 100)
|
||||
|
||||
# Confirm that the balance on node 1 is zero, as we have not
|
||||
# rescanned over the older transactions
|
||||
resp = self.nodes[1].z_getbalance(myzaddr)
|
||||
assert_equal(Decimal(resp), 0)
|
||||
|
||||
# Re-import the key on node 1, scanning from before the transaction.
|
||||
self.nodes[1].z_importkey(key, 'true', self.nodes[1].getblockchaininfo()['blocks'] - 110)
|
||||
|
||||
# Confirm that the balance on node 1 is valid now (node 1 must
|
||||
# have rescanned)
|
||||
|
||||
Reference in New Issue
Block a user