Avalanche
هل أنت مستعد لاستدعاء هذا في الإنتاج؟
الخطة المجانية تغطي المشاريع الشخصية. الدفع حسب الاستخدام يتوسع دون بطاقة.
Avalanche
الخطة المجانية تغطي المشاريع الشخصية. الدفع حسب الاستخدام يتوسع دون بطاقة.
A chain reorganization, or reorg, happens when the node you are reading from replaces a block it previously reported as the tip with a different block at the same height, so a transaction that appeared confirmed is rewound and may land in a different block — or not at all. On the Avalanche C-Chain this is uncommon and shallow: Snowman consensus finalizes blocks within roughly one to two seconds, so once a block is accepted it is effectively permanent, and reorgs are confined to the brief, unfinalized moment right at the tip. Even so, an application that reads the very latest block before finality can observe one, and if it credits a balance or ships a product off an orphaned block it ends up with state that no longer matches the canonical C-Chain. That is why even on a fast-finality chain you must detect reorgs and reconcile state rather than assume the tip never changes.
parentHash does not match the hash you recorded for the previous height, or a block hash at a known height that differs from what you stored. A newBlockHeaders subscription or polling eth_getBlockByNumber both surface these mismatches.parentHash to your last recorded hash. Either way, keep a short ring buffer of recent height-to-hash mappings so you can locate where the chains diverged.newBlockHeaders subscriptions for low-latency detection that rides Avalanche's ~1-2s cadence; fall back to polling eth_getBlockByNumber when a subscription is unavailable or for a periodic reconciliation sweep that catches anything a dropped subscription missed.