While working on #15931, I’ve tried to rationalize tx state management to ease integration of block height tracking per-wallet tx. We currently rely on a combination of hashBlock
and nIndex
with magic value to determine tx confirmation, conflicted or abandoned state. It’s hard to reason and error-prone. To solve that, we encapsulate these fields in a TxConfirmation
struct and introduce a TxState
member that we update accordingly at block connection/disconnection.
Following jnewbery recommendation, I’ve taken these changes in its own commit, and open a PR to get them first. It would ease review of aforementioned PR, but above all should ease fixing of long-term issues like :
- #7315 (but maybe we should abandon abandontransaction or relieve it to only free outpoints not track the transaction as abandoned in itself, need its own discussion)
- #8692 where we should cancel conflicted state of transactions chain smoothly
MarkConflicted
inLoadToWallet
is likely useless if we track conflicts rights at block connection
Main changes of this PR to get right are tx update in AddToWallet
and serialization/deserialization logic.