There are scenarios where a the wallet may need to rescan the chain, even though it has account(s) with known spendable notes.
For example, consider a wallet which already has one (account A) and imports a new account (account B). The wallet will need to re-scan from the birthday height of B to discover its notes/balances. Currently, the truncation process applies to both accounts, resulting in the witness data corresponding to account A's notes being forgotten until it is regenerated during the re-scan. Ideally, account A's notes would still be spendable (e.g. still have the witness data) even during the re-scan, so that the user can still use A while re-scanning for B.
Possible solution: Exclude 'stable' witness data from truncation
Essentially, add a flag to mark notes as 'stable' once they've been confirmed up to the pruning depth. Then, modify pruning to exclude removal of witness data corresponding to those 'stable' notes.
There are scenarios where a the wallet may need to rescan the chain, even though it has account(s) with known spendable notes.
For example, consider a wallet which already has one (
account A) and imports a new account (account B). The wallet will need to re-scan from the birthday height ofBto discover its notes/balances. Currently, the truncation process applies to both accounts, resulting in the witness data corresponding toaccount A's notes being forgotten until it is regenerated during the re-scan. Ideally,account A's notes would still be spendable (e.g. still have the witness data) even during the re-scan, so that the user can still useAwhile re-scanning forB.Possible solution: Exclude 'stable' witness data from truncation
Essentially, add a flag to mark notes as 'stable' once they've been confirmed up to the pruning depth. Then, modify pruning to exclude removal of witness data corresponding to those 'stable' notes.