mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
fix: use saturating sub for getting safe and finalized hashes (#9792)
This commit is contained in:
@ -57,11 +57,11 @@ impl Command {
|
|||||||
};
|
};
|
||||||
|
|
||||||
let head_block_hash = block.hash();
|
let head_block_hash = block.hash();
|
||||||
let safe_block_hash =
|
let safe_block_hash = block_provider
|
||||||
block_provider.get_block_by_number((block.number - 32).into(), false);
|
.get_block_by_number(block.number.saturating_sub(32).into(), false);
|
||||||
|
|
||||||
let finalized_block_hash =
|
let finalized_block_hash = block_provider
|
||||||
block_provider.get_block_by_number((block.number - 64).into(), false);
|
.get_block_by_number(block.number.saturating_sub(64).into(), false);
|
||||||
|
|
||||||
let (safe, finalized) = tokio::join!(safe_block_hash, finalized_block_hash,);
|
let (safe, finalized) = tokio::join!(safe_block_hash, finalized_block_hash,);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user