Page MenuHomePhabricator

[avalanche] Bind the tx finalization ws message to preconsensus events
ClosedPublic

Authored by Fabien on Jul 30 2025, 13:57.

Details

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

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Fabien requested review of this revision.Jul 30 2025, 13:57
PiRK added a subscriber: PiRK.

newline nit

chronik/chronik-indexer/src/subs_group.rs
39 ↗(On Diff #55044)

inconsistent blank line

This revision is now accepted and ready to land.Jul 30 2025, 14:34
tobias_ruck added a subscriber: tobias_ruck.
tobias_ruck added inline comments.
chronik/chronik-indexer/src/indexer.rs
945 ↗(On Diff #55051)

add a comment why this branch is needed here (as it's not obvious)

chronik/chronik-indexer/src/subs_group.rs
20–21 ↗(On Diff #55051)

cf. below

34 ↗(On Diff #55051)

consider this—code should be clearer

This revision now requires changes to proceed.Jul 31 2025, 16:06
Fabien marked an inline comment as done.Jul 31 2025, 19:11
Fabien added inline comments.
chronik/chronik-indexer/src/subs_group.rs
34 ↗(On Diff #55051)

No idea what this is but I'll try

Use an enum variant to clean up the code a lot, add comment for the db lookup branch

This revision is now accepted and ready to land.Jul 31 2025, 19:52