Per review, drop the separate truncate mode and use its logic for
has_prefix instead. Order amounts are stored without trailing zeros
(1.50 as "1.5"), so the plain string prefix check let the 1.5 order
claim a 1.51 payment meant for a concurrent order on the same address.
Truncate the received amount to the larger of the atom precision and
the order's own decimals, then compare exactly: overpayment below the
atom precision still matches, underpayment and overpayment of a full
atom no longer do.
Truncate the received amount to the atom precision before an exact comparison, so overpayment below the atom precision still matches while concurrent orders on one address (1.50, 1.51, ...) never claim each other's payments.
Block scanning gives every slot one chance. A skipped or abandoned slot,
a restart, or an incomplete lookback range loses a payment for good, and
nothing finds it again.
Once a Solana order has been expired for a minute (up to two hours), look
it up once in the receiving token accounts' own history:
- token accounts: the wallet's associated token account, derived locally,
plus any other account from getTokenAccountsByOwner when the node
supports it (publicnode's free tier rejects that method);
- getSignaturesForAddress back to the order's creation time, keeping
successful signatures inside the order window that no order has used;
- getTransaction, parsed with parseTransaction and checked with the
existing orderTransferMatch. A match is marked confirming and then
follows the normal confirm and callback flow.
RPC errors leave the order for the next round. Cost: a few RPC calls per
expired Solana order plus one getTransaction per candidate payment.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Add a Solana reconciliation task that backfills recent waiting, expired, and failed orders by scanning token accounts, signatures, and parsed transactions for matching SPL transfers.
Reuse shared order matching for realtime transfer handling, return DB errors from MarkConfirming, and keep confirming orders eligible when the on-chain payment timestamp was inside the order window even if final confirmation happens after expiry.