dcrwallet
dcrwallet copied to clipboard
In-memory branch index and cursor not updated after manual syncing without restart
As the title indicates, manually updating the address index and rescanning does not update the in-memory branch index and cursor unless the wallet is restarted.
The following steps can be taken to reproduce it with simnet:
- Create simnet setup with only the genesis block
- Start the wallet so it is at address index 0
- Mine a block that pays to address 10
- Advance the address index to 10
- Perform a rescan
- Query the current branch index for the account
$ ./ctl getblockcount
0
$ ./ctl accountaddressindex "default" 0
0
$ ./mine 2
[
"3bcc097a3e90871c2cba9cc1458b75cd721f71039dcca4d4dc177d401122538a"
]
[
"00fb12ad2e4c8fffab68905e8537dc0bf134e78e3e280b1e820df76aee466b00"
]
$ ./ctl getblockcount
2
$ ./ctl accountaddressindex "default" 0
0
$ ./ctl accountsyncaddressindex "default" 0 10
$ ./ctl validateaddress Ssegiu87pbn7cdSwLUnW7B57KcF6BLu8XS7 | jq .ismine
true
$ ./ctl rescanwallet
$ ./ctl accountaddressindex "default" 0
0 <---- should be 10
For some further details on the state at that point:
$ ./ctl getblockhash 2 | ./ctl getblock - true true | jq -r .rawtx[0].vout[2].scriptPubKey.addresses[0]
Ssegiu87pbn7cdSwLUnW7B57KcF6BLu8XS7 <--- proof the block pays to expected address
$ ./ctl getbalance | jq .totalimmaturecoinbaserewards
300 <---- balance is recognized
However, if you restart the wallet, the reported index is the expected value:
$ ./ctl accountaddressindex "default" 0
10