In simple terms, we were removing previous state from the contract state data once we add a new state transition. However, this new state transition may not be yet final (its witness transaction is not mined), or may become invalid due to a blockchain re-org. Thus, I suggest to keep the historic state here (wallets do filter it anyway, so if it is assigned to a tx output which is already spent it will not be shown to the user).
Since the historic data will accumulate over the time, I plan to add an API to prune them with the wallet deciding which witness transactions are deep enough to safely remove the state.
Fixes https://github.com/RGB-WG/rgb-wallet/pull/81#issuecomment-1625377294
In simple terms, we were removing previous state from the contract state data once we add a new state transition. However, this new state transition may not be yet final (its witness transaction is not mined), or may become invalid due to a blockchain re-org. Thus, I suggest to keep the historic state here (wallets do filter it anyway, so if it is assigned to a tx output which is already spent it will not be shown to the user).
Since the historic data will accumulate over the time, I plan to add an API to prune them with the wallet deciding which witness transactions are deep enough to safely remove the state.