{"record":{"id":"b69d02f7206d1107","repo":"nautechsystems/nautilus_trader","slug":"verified-inclusion-header-does-not-match-receip","errorCode":null,"errorMessage":"Verified inclusion header {} does not match receipt hash {}","messagePattern":"Verified inclusion header (.+?) does not match receipt hash (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/blockchain/src/execution/client.rs","lineNumber":4802,"sourceCode":"        OrderSide::Buy => {\n            anyhow::ensure!(\n                quote_amount.is_positive() && quote_amount.unsigned_abs() == plan.amount_in,\n                \"Finalized Swap input {quote_amount} does not match the persisted amount {}\",\n                plan.amount_in\n            );\n            anyhow::ensure!(\n                base_amount.is_negative(),\n                \"Finalized Swap base amount {base_amount} is not a BUY output\"\n            );\n            raw_amount_to_quantity(\n                base_amount.unsigned_abs(),\n                plan.pool.get_base_token().decimals,\n            )?\n        }\n    };\n\n    let block = &included.finality.inclusion_header;\n    anyhow::ensure!(\n        block.number == included.block_number\n            && block.hash == included.receipt.block_hash.to_string(),\n        \"Verified inclusion header {} does not match receipt hash {}\",\n        included.block_number,\n        included.receipt.block_hash\n    );\n    let timestamp_ns = block\n        .timestamp\n        .checked_mul(NANOSECONDS_IN_SECOND)\n        .ok_or_else(|| anyhow::anyhow!(\"Finalized block timestamp overflows nanoseconds\"))?;\n    let mut swap = event.to_pool_swap(\n        plan.pool.chain.clone(),\n        plan.instrument_id,\n        plan.pool.pool_identifier,\n        UnixNanos::from(timestamp_ns),\n    );\n    swap.calculate_trade_info(&plan.pool.token0, &plan.pool.token1, None)?;\n    let trade = swap","sourceCodeStart":4784,"sourceCodeEnd":4820,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/blockchain/src/execution/client.rs#L4784-L4820","documentation":"The library cross-checks the verified inclusion header against the finalized receipt: header number must equal the included block number and header hash must equal the receipt's block hash. A mismatch means the header used to prove finality describes a different block than the one containing the receipt — a reorg, stale header, or inconsistent data source.","triggerScenarios":"included.finality.inclusion_header was fetched before/after the receipt such that a reorg changed the canonical block at that height; the header came from a different provider than the receipt; receipt.block_hash decoded from a differently-cased or differently-encoded hash string.","commonSituations":"Chain reorganization between header fetch and receipt confirmation; mixing providers with different canonical views (e.g. a load-balanced RPC where one node lags); header cached from an earlier verification run and reused after the chain advanced.","solutions":["Re-fetch both the inclusion header and receipt from the same RPC endpoint after finality and re-run verification","Detect and wait out reorgs: confirm the block is canonical at finality depth before comparing hashes","Disable/align caching so the header is not reused across verification attempts","Normalize hash encoding (checksum/case) before comparison if hashes come as strings from different sources"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if block.number != included.block_number || block.hash != included.receipt.block_hash.to_string() {\n    return Err(anyhow!(\"inclusion header stale or reorged\"));\n}","typeGuard":null,"tryCatchPattern":"match verify_inclusion_header(&header, &receipt) {\n    Err(e) if is_hash_mismatch(&e) => { refresh_header_and_receipt(tx_hash).await?; verify_inclusion_header(...)? }\n    other => other,\n}","preventionTips":["Fetch header and receipt from the same provider in the same verification pass","Wait for finality depth before caching headers","Never reuse inclusion headers across verification attempts","Normalize hash string encoding before equality comparison"],"tags":["blockchain","finality","reorg","hash-mismatch"],"backgroundTag":"checksum-mismatch","analyzedSha":"18893faf8b356be3320add8de2f861b0b647cf06","analyzedAt":"2026-09-08T20:49:34.690Z","contentChangedAt":"2026-09-08T20:49:34.690Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}