fix: sealed header should not be immutable borrowed (#6456)

This commit is contained in:
yjh
2024-02-08 03:26:26 +08:00
committed by GitHub
parent 7a57d89575
commit 29e8aab08a
44 changed files with 464 additions and 385 deletions

View File

@ -259,7 +259,7 @@ impl Command {
Arc::clone(&best_block),
Bytes::default(),
OptimismPayloadBuilderAttributes::try_new(
best_block.hash,
best_block.hash(),
OptimismPayloadAttributes {
payload_attributes: payload_attrs,
transactions: None,
@ -274,7 +274,7 @@ impl Command {
let payload_config = PayloadConfig::new(
Arc::clone(&best_block),
Bytes::default(),
EthPayloadBuilderAttributes::try_new(best_block.hash, payload_attrs)?,
EthPayloadBuilderAttributes::try_new(best_block.hash(), payload_attrs)?,
self.chain.clone(),
);

View File

@ -189,7 +189,7 @@ impl Command {
match get_single_header(&client, BlockHashOrNumber::Number(block)).await {
Ok(tip_header) => {
info!(target: "reth::cli", ?block, "Successfully fetched block");
return Ok(tip_header.hash)
return Ok(tip_header.hash())
}
Err(error) => {
error!(target: "reth::cli", ?block, %error, "Failed to fetch the block. Retrying...");

View File

@ -164,15 +164,15 @@ impl<DB> NodeState<DB> {
);
}
BeaconConsensusEngineEvent::CanonicalBlockAdded(block) => {
info!(number=block.number, hash=?block.hash, "Block added to canonical chain");
info!(number=block.number, hash=?block.hash(), "Block added to canonical chain");
}
BeaconConsensusEngineEvent::CanonicalChainCommitted(head, elapsed) => {
self.latest_block = Some(head.number);
info!(number=head.number, hash=?head.hash, ?elapsed, "Canonical chain committed");
info!(number=head.number, hash=?head.hash(), ?elapsed, "Canonical chain committed");
}
BeaconConsensusEngineEvent::ForkBlockAdded(block) => {
info!(number=block.number, hash=?block.hash, "Block added to fork chain");
info!(number=block.number, hash=?block.hash(), "Block added to fork chain");
}
}
}

View File

@ -210,13 +210,13 @@ pub fn insert_genesis_header<DB: Database>(
tx: &<DB as Database>::TXMut,
chain: Arc<ChainSpec>,
) -> ProviderResult<()> {
let header = chain.sealed_genesis_header();
let (header, block_hash) = chain.sealed_genesis_header().split();
tx.put::<tables::CanonicalHeaders>(0, header.hash)?;
tx.put::<tables::HeaderNumbers>(header.hash, 0)?;
tx.put::<tables::CanonicalHeaders>(0, block_hash)?;
tx.put::<tables::HeaderNumbers>(block_hash, 0)?;
tx.put::<tables::BlockBodyIndices>(0, Default::default())?;
tx.put::<tables::HeaderTD>(0, header.difficulty.into())?;
tx.put::<tables::Headers>(0, header.header)?;
tx.put::<tables::Headers>(0, header)?;
Ok(())
}