The threat is a swap counterparty who also runs, or colludes with, the gateway that supplies chain data. Such a party controls what a wallet is shown: it can present a valid transaction on a chain it mines, or claim that a transaction exists that does not. The swap must therefore be judged on evidence the wallet can recompute, with outside facts gathered so that no single party can fabricate them.
pkg/verify has two tiers and never mixes them.
Tier A, local. Bytes in, answer out, no network at all. The package parses the counterparty's transactions, rebuilds the HTLC script from the signed terms, compares the funding output against it, checks amounts and fees, checks the refund's locktime and that its sequence actually enables that locktime, checks that the claim reveals the preimage of the agreed hashlock, and checks the two refund deadlines are asymmetric enough to be usable. A verdict can be recomputed offline from the same bytes; that is what makes it evidence rather than a report about a server.
Tier B, external facts. Only five things come from outside: whether a txid exists, its
confirmation height and depth, whether a conflicting spend was seen, the tip height, and fee
estimates and inter-block intervals. Nothing else may be fetched, and the engine's Source
interface has no method for anything else.
At least two sources are required and the quorum is validated at construction: a single source is
not a quorum and a repeated name is refused. A positive lookup is accepted only after the returned
bytes hash to the requested txid, so a source cannot substitute a different transaction. A split
answer between sources is ErrDisagree, never a majority vote, and disagreement fails closed.
Absence is reported as a sample: how many sources answered, how many found nothing, and whether the sources looked independent at that moment. It is a probability, not proof, and the UI must show it as such.
Sources are compared on tip hash, tip height and fee estimates. Identical tip hashes across all sources raise a warning: it is the cheapest observable sign of one backend behind several proxies. That heuristic is deliberately weak, and the report records the sources that were used so a user can judge them.
Report.Gate() is the only way past the barrier. It refuses a failed claim or an unverified fact;
a warning passes but is always shown, because a warning describes the evidence rather than the
trade. A single source is the case that forced this: the forked chain has one public indexer today,
"existence is hash-verified but agreement between independent sources is not possible" is a true
warning, and refusing there would just mean no xbt swap can proceed. Failed checks are listed
separately from unverifiable ones, because a failed claim is evidence against the trade while an
unverifiable one is missing evidence.
Bitcoin's constants do not transfer. The fork's block weight limit while RDTS applies is 800,000, its coinbase maturity is 6,480 blocks, and its version 2 headers begin at 961,640 and are 164 bytes. A funding output that traces to an immature coinbase is refused, not warned about, because the maturity period outlasts a swap's timeout. Confirmation depth is translated to wall-clock time from observed inter-block intervals, not from an assumed ten minutes.
pkg/verify/presets.go bakes in the public indexers a configuration starts with. The Bitcoin ones
are Esplora-shaped and all pointed at the same chain head when the list was last checked:
mempool.space (recommended first: the most widely used explorer, so the least likely to be the
counterparty), blockstream.info, btcscan.org and mempool.ninja. The forked chain has one public
explorer, a mining pool's own pruned node, and its entry says so: it answers the tip and recent
blocks, and a transaction older than its retention window is unverifiable, not absent.
Nothing here points at the venue's own gateway, and none of it is a default source: a verdict requires a quorum the caller selects. The list is curated in one place so a user does not have to type URLs, and every preset records its operator and its limitations.
Queries are batched per round: the outpoints of both legs and the funding candidates go in one request, padded to a fixed size, so a single source sees a batch rather than a trade's outpoints in sequence. The residual leak is real and is not fixed by padding:
the relay traffic can join the two;
verification;
The mitigation is structural rather than cryptographic: no venue-operated source may be one of the n, so no single party sees the batch and the offer together. Users should be told that a source sees a set of outpoints at a time, and that a source colluding with the relay can narrow it down.
No broadcasting, no key handling, no custody, and no mempool clone. The library decides; the wallet acts.