fix(hive): overflow when timestamp is u64::max (#14132)

This commit is contained in:
joshieDo
2025-01-31 20:53:48 +00:00
committed by GitHub
parent 3e0cd2eb3d
commit d30a1b6c7d
2 changed files with 8 additions and 7 deletions

View File

@ -116,11 +116,11 @@ pub async fn maintain_transaction_pool<N, Client, P, St, Tasks>(
last_seen_block_number: latest.number(),
pending_basefee: latest
.next_block_base_fee(
chain_spec.base_fee_params_at_timestamp(latest.timestamp() + 12),
chain_spec.base_fee_params_at_timestamp(latest.timestamp().saturating_add(12)),
)
.unwrap_or_default(),
pending_blob_fee: latest.maybe_next_block_blob_fee(
chain_spec.blob_params_at_timestamp(latest.timestamp() + 12),
chain_spec.blob_params_at_timestamp(latest.timestamp().saturating_add(12)),
),
};
pool.set_block_info(info);
@ -276,11 +276,12 @@ pub async fn maintain_transaction_pool<N, Client, P, St, Tasks>(
let pending_block_base_fee = new_tip
.header()
.next_block_base_fee(
chain_spec.base_fee_params_at_timestamp(new_tip.timestamp() + 12),
chain_spec
.base_fee_params_at_timestamp(new_tip.timestamp().saturating_add(12)),
)
.unwrap_or_default();
let pending_block_blob_fee = new_tip.header().maybe_next_block_blob_fee(
chain_spec.blob_params_at_timestamp(new_tip.timestamp() + 12),
chain_spec.blob_params_at_timestamp(new_tip.timestamp().saturating_add(12)),
);
// we know all changed account in the new chain
@ -382,11 +383,11 @@ pub async fn maintain_transaction_pool<N, Client, P, St, Tasks>(
let pending_block_base_fee = tip
.header()
.next_block_base_fee(
chain_spec.base_fee_params_at_timestamp(tip.timestamp() + 12),
chain_spec.base_fee_params_at_timestamp(tip.timestamp().saturating_add(12)),
)
.unwrap_or_default();
let pending_block_blob_fee = tip.header().maybe_next_block_blob_fee(
chain_spec.blob_params_at_timestamp(tip.timestamp() + 12),
chain_spec.blob_params_at_timestamp(tip.timestamp().saturating_add(12)),
);
let first_block = blocks.first();