fromBlock: the next block the client wantsparentBlockHash: the hash of the block immediately beforefromBlock, meaning the last block the client already trusts
fromBlock on the current chain.
If the hashes match, the stream starts normally. If they do not match, the
chain changed between the client’s last processed block and fromBlock. The
client cannot safely resume from this block, and Portal returns HTTP 409 Conflict.
For example, after this reorg the block N+1 that the client may have already
processed is no longer on the current chain:
If the client resumes with fromBlock = N+2 and parentBlockHash = hash(N+1),
Portal sees that N+1 is not the parent of the next block on the current
chain and reports the conflict.
Conflict response body
erroris the envelope that every failing Portal response carries. Match onerror.code(base_block_mismatchhere) rather than onerror.message, which is prose and can change. See Error handling for the full contract.previousBlocksis an array of{ number, hash }pairs from the current chain at and below the conflict point. It stays at the top level, besideerror.- The array length is arbitrary, but the array always contains at least the
parent of the requested
fromBlock. - The array is in ascending order: the lowest block number comes first, and the last entry is the most recent block at or below the conflict point.
Recovering from a conflict
- Walk
previousBlocksfrom its last entry (the most recent block) and look for a block whose(number, hash)pair you have already processed and stored. - If you find a shared block at height
K, remove data derived from later blocks and resume the stream withfromBlock = K + 1andparentBlockHash = hash(K). - If no block in
previousBlocksmatches your records, the divergence is deeper than the returned slice. Open a new stream with afromBlockfurther in the past and repeat the search. PassparentBlockHashon every retry as well, so that each conflict narrows the search instead of repeating it.
EVM fork recovery
Handle HTTP 409 while reading recent EVM blocks.
Solana fork recovery
Handle HTTP 409 while reading recent Solana blocks.
409 from the finalized stream only means the
stored hash is stale, for example carried over from an unfinalized block. The
recovery procedure is the same.