handle-a-payment-reorged-out
Use when a credited crypto payment disappears from the canonical chain. Detects the reorg, halts fulfilment, and re-clears the payment only when it reappears with the right confirmations.
- License 许可
- MIT
- 最近更新
- 2026-11-12
- Stars
- ★ 81
- Forks
- 17
01 前言 Front Matter
- name
- handle-a-payment-reorged-out
- description
- Use when a credited crypto payment disappears from the canonical chain. Detects the reorg, halts fulfilment, and re-clears the payment only when it reappears with the right confirmations.
02 资源文件 3
- 许可证LICENSE1.0 KB
- 参考文档SOURCE.md354 B
- 参考文档TRUST.auto.yaml2.2 KB
03 SKILL.md 正文
Handle a payment that reorgs out
A tx seen in a block is not a tx in the canonical chain. When the source tx vanishes from the head, any fulfilment already triggered is unbacked; detect it, freeze downstream actions, and re-clear on canonical evidence.
Procedure
- Watch the head each block: re-check that each credited tx hash is still in its block and that the block is still canonical.
cast tx $TXHASH --rpc-url $RPC | grep -E "blockNumber|blockHash"Compare thatblockHashwith the block you credited against. - On a mismatch, mark the payment
reorgedand stop any fulfilment that can still be stopped (shipping, further sends, entitlement grants). - Re-derive the canonical chain and look for the tx in the new blocks:
cast receipt $TXHASH --rpc-url $RPC— a differentblockNumbermeans the tx was re-included later; a null result means it is not on the canonical chain. - Distinguish a re-inclusion (tx re-mined elsewhere) from a drop (tx gone, possibly replaced by a higher-fee tx or never valid).
- Re-clear the payment only when the tx is canonical and accumulated confirmations exceed the value-tiered threshold.
- If the tx never returns, void the credit and notify the counterparty with the hash and the block-hash mismatch as evidence.
- Log the head block hashes around the incident so the depth and cause are reconstructable.
Pitfalls
- Crediting at first inclusion on a probabilistic chain with no reorg watch; the policy, not the incident, is the failure.
- Assuming a disappeared tx is a double-spend attack when a natural 2-block reorg explains it.
- Fulfilling instantly on soft-confirm and being unable to claw back a shipped good.
- Re-crediting twice when the tx reappears: match on tx hash and suppress the duplicate.
- Watching only your own tx and missing that the whole block was reorged, invalidating sibling payments too.
- A tx can be re-included with a different effect if it was one of several in the block; re-check the whole batch, not one hash.
- Re-clear logic that keys on amount can double-credit when two identical payments exist; key on tx hash.
Verification
cast tx $TXHASH --rpc-url $RPC | grep blockHash
# must equal the blockHash of the current canonical block at that height
Report the tx hash, the block hash at credit time versus now, the reorg depth, and the payment's final status.
04 同仓库更多 Skills
recipe-performance
Diagnose a specific MetaMask user flow's real-app performance and Sentry critical-user-flow telemetry with deterministic mm-harness recipes. Use for CUF boundaries, cold/warm/background-resume behavior, latency regressions, lifecycle tags, duplicate or blocking network requests, long tasks, layout/paint cost, screen redraws, React rerenders, or browser trace analysis where tests alone cannot prove the real app.
mexc-spot-websocket
MEXC Spot WebSocket workflows for public streams, protobuf handling, depth maintenance, listen keys, and private streams without exposing API keys.
mexc-spot-rest
MEXC Spot REST workflows for public data, signed account requests, orders, wallet/admin actions, and secure signing without exposing API keys.
mexc-futures-websocket
MEXC Futures WebSocket workflows for public streams, private account/order/position streams, ping/pong, subscriptions, and depth maintenance.
0xklen-version-and-refresh-sanctions-lists
暂无简介
verify-tests-cover-changed-lines
Use when a PR adds code that the existing suite may not exercise. Measures patch coverage — the share of newly changed lines hit by tests — before approving.