refactor(bifrost/cardano): single-pass output selection in FetchTxs

Follow-up to the consolidation observation fix (merged in 9ebfa63b).

Output selection grew as three fallback loops (outbound/inbound, then vault-to-vault for the MIGRATE-loss fix, then consolidation for the fee-drift fix), each re-scanning the outputs and re-checking asgard membership / sender equality. This collapses them into one selectTargetOutput pass that classifies each output once (external / other-vault / self) and applies a single priority list:

outbound -> inbound -> vault-to-vault -> consolidation

Behavior is unchanged:

  • any non-self output still beats the consolidation classification, so a CONSOLIDATE memo with an external output keeps the outbound classification and MAYAChain slashes it as an unauthorized spend
  • self-sends without the CONSOLIDATE memo are still not reported
  • consolidation amounts remain the sum of the self-outputs
  • memo parsing is lazy (only evaluated for all-self vault txs)

Tests: TestConsolidationOutput becomes TestSelectTargetOutput, a decision table over all output shapes, now also asserting that external outputs win over the consolidation rule. TestFetchTxs_VaultConsolidation (7 mainnet shapes) passes unchanged.

Merge request reports

Loading
Loading