RPC to build witness cache #342

Open
opened 7 months ago by duke · 0 comments
duke commented 7 months ago
Owner

It would be useful to have an RPC that can build the witness cache from a specified block height, such as z_buildwitnesscache 123 which would update the witness cache from block height 123.

Currently the only way the witness cache is updated from an old block height is done as the last step of a rescan. If some kind of bug happens, it's not possible to redo the building of just the witness cache, you have to redo the entire rescan, which can be ridiculously slow for wallets with many zaddrs and/or rescanning a very old block height.

This kind of thing should not be needed by average users, but for instance, when bug #336 happens and the only way to stop the node fully is kill -9 and then you restart the node, sync it and successfully make a new ztx, I have "witnessed" the witness cache be incorrect. The node successfully spends a zutxo but it still shows as unspent in the output of z_listunspent . If you try to make a new ztx which tries to spend that note, the node correctly realizes that the note is already spent. Then the node is left in a state where it cannot spend some unspent notes, because the RPCs mix together some spent/unspent zutxos and there is no way to avoid spending some zutxos, depending on the amount trying to be spent and the values of the various zutxos.

It would be useful to have an RPC that can build the witness cache from a specified block height, such as `z_buildwitnesscache 123` which would update the witness cache from block height 123. Currently the only way the witness cache is updated from an old block height is done as the last step of a rescan. If some kind of bug happens, it's not possible to redo the building of *just* the witness cache, you have to redo the entire rescan, which can be ridiculously slow for wallets with many zaddrs and/or rescanning a very old block height. This kind of thing should not be needed by average users, but for instance, when bug #336 happens and the only way to stop the node fully is `kill -9` and then you restart the node, sync it and successfully make a new ztx, I have "witnessed" the witness cache be incorrect. The node successfully spends a zutxo but it still shows as unspent in the output of `z_listunspent` . If you try to make a new ztx which tries to spend that note, the node correctly realizes that the note is already spent. Then the node is left in a state where it cannot spend some unspent notes, because the RPCs mix together some spent/unspent zutxos and there is no way to avoid spending some zutxos, depending on the amount trying to be spent and the values of the various zutxos.
duke added the
feature
label 7 months ago
duke self-assigned this 6 months ago
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date

No due date set.

Dependencies

This issue currently doesn't have any dependencies.

Loading…
There is no content yet.