[avalanche] Bind the tx finalization ws message to preconsensus events
Summary:
This diff adds a new field for the tx message sent by ws, which is only
present upon finalization to tell whether it's from pre or post consensus.
The tx finalized message will be sent twice under normal circumstances:
- Once for preconsensus while the tx is in the mempool
- Once for postconsensus while the tx is in a final block
There are lots of edge cases, e.g. the tx might not be in the mempool at
the time chronik processes the finalization event, or the tx might be
only finalized by postconsensus. This diff addresses all these cases by
looking for the finalized transaction both in the mempool and in the DB.
Only the finalization event is bound for now. The invalidation can be
added later if needed.
Depends on D18429.
Test Plan:
ninja all check-all
Reviewers: #bitcoin_abc, PiRK, tobias_ruck
Reviewed By: #bitcoin_abc, PiRK, tobias_ruck
Subscribers: tobias_ruck, PiRK
Differential Revision: https://reviews.bitcoinabc.org/D18432