We need to add a "note locking" feature to zcash_client_backend and zcash_client_sqlite. The essential changes that we need are: add a lock_output method to the WalletWrite trait that takes a (pool, txid, output_index) tuple as its argument, and that adds a locked flag to that note's record in the backing data store; add a database migration to update the storage appropriately. Note selection methods and queries should be modified to take an include_locked parameter; when the value of that parameter is false, locked notes should not be returned from note selection queries and should not be included in balance. Methods that create transaction proposals should also take an added lock_notes parameter (that defaults to false); when true, the notes selected for spending should be locked before the proposal is returned.
When a proposal to spend locked notes (or a PCZT that spends locked notes) is finally built into an actual transaction, the notes should be unlocked - we will allow the preexisting transaction expiry-based locking functionality to function there. Note locking has effect only between the time of creating a proposal or pczt, and the time that the proposal is acted upon to construct a transaction.
We need to add a "note locking" feature to
zcash_client_backendandzcash_client_sqlite. The essential changes that we need are: add alock_outputmethod to theWalletWritetrait that takes a (pool, txid, output_index) tuple as its argument, and that adds alockedflag to that note's record in the backing data store; add a database migration to update the storage appropriately. Note selection methods and queries should be modified to take aninclude_lockedparameter; when the value of that parameter is false, locked notes should not be returned from note selection queries and should not be included in balance. Methods that create transaction proposals should also take an addedlock_notesparameter (that defaults tofalse); whentrue, the notes selected for spending should be locked before the proposal is returned.When a proposal to spend locked notes (or a PCZT that spends locked notes) is finally built into an actual transaction, the notes should be unlocked - we will allow the preexisting transaction expiry-based locking functionality to function there. Note locking has effect only between the time of creating a proposal or pczt, and the time that the proposal is acted upon to construct a transaction.