Skip to content

fix(swap): reject THORChain all-zero outbound-hash sentinel in tracker#344

Merged
BitHighlander merged 1 commit into
developfrom
fix/swap-tracker-zero-outbound-hash
Jul 12, 2026
Merged

fix(swap): reject THORChain all-zero outbound-hash sentinel in tracker#344
BitHighlander merged 1 commit into
developfrom
fix/swap-tracker-zero-outbound-hash

Conversation

@BitHighlander

Copy link
Copy Markdown
Collaborator

Problem

The swap tracker displayed an OUTPUT TX of 0000…0000 (with copy button + explorer link) and a "2 hashes" header for a swap that had no outbound leg yet — a phantom second transaction.

Cause

THORChain/Midgard reports out_hash as 64 hex zeros when the outbound leg hasn't been scheduled/observed yet — a "no tx" sentinel. The ingestion guards in SwapDialog.tsx only tested truthiness, and a non-empty zero string is truthy:

  • :905 (live swap-update) — if (update.outboundTxid) setLiveOutboundTxid(...)
  • :1317 (resume from persisted swap) — same

Once in state, it drove liveOutboundTxid ? '2 hashes' : '1 hash', the OUTPUT TX row, and an explorer link to a nonexistent tx.

Fix

Add isRealHash() and guard both ingestion points so the zero-hash sentinel never enters state. All downstream rendering (header count, output row, explorer, persisted snapshot) is then correct by construction.

const isRealHash = (h?: string | null): h is string => !!h && !/^(0x)?0+$/i.test(h)

Out of scope

The same screenshot showed GAS 112,387,787,618,779 gas on the input tx — a fee-in-wei value mislabeled as gasUsed. That's a Pioneer-side data-mapping issue, tracked separately.

Midgard reports out_hash as 64 hex zeros when the outbound leg hasn't been
scheduled/observed yet. The tracker ingestion guards only tested truthiness,
and a non-empty zero string is truthy — so the sentinel entered state and the
UI rendered it as a real OUTPUT TX (with copy + explorer link) and flipped the
header to '2 hashes'. Add isRealHash() and guard both ingestion points (live
update + resume) so the zero hash never becomes a displayed txid.
@BitHighlander BitHighlander merged commit 126a9d6 into develop Jul 12, 2026
1 check passed
@BitHighlander BitHighlander deleted the fix/swap-tracker-zero-outbound-hash branch July 12, 2026 01:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant