Skip to content

Commit

Permalink
minor cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
jonastheis committed Jul 30, 2024
1 parent 9dc17cb commit dbdbc88
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 23 deletions.
21 changes: 0 additions & 21 deletions core/blockchain.go
Original file line number Diff line number Diff line change
Expand Up @@ -1803,27 +1803,6 @@ func (bc *BlockChain) insertChain(chain types.Blocks, verifySeals bool) (int, er
return it.index, err
}

// PreprocessBlock processes block on top of the chain to calculate receipts, bloom and state root
func (bc *BlockChain) PreprocessBlock(block *types.Block) (common.Hash, types.Bloom, common.Hash, uint64, error) {
// Retrieve the parent block and it's state to execute on top
parent := bc.CurrentBlock().Header()
if parent == nil {
parent = bc.GetHeader(block.ParentHash(), block.NumberU64()-1)
}
statedb, err := state.New(parent.Root, bc.stateCache, bc.snaps)
if err != nil {
return common.Hash{}, types.Bloom{}, common.Hash{}, 0, err
}
receipts, _, usedGas, err := bc.processor.Process(block, statedb, bc.vmConfig)
if err != nil {
return common.Hash{}, types.Bloom{}, common.Hash{}, 0, err
}
receiptSha := types.DeriveSha(receipts, trie.NewStackTrie(nil))
bloom := types.CreateBloom(receipts)
stateRoot := statedb.GetRootHash()
return receiptSha, bloom, stateRoot, usedGas, nil
}

func (bc *BlockChain) BuildAndWriteBlock(parentBlock *types.Block, header *types.Header, txs types.Transactions) (WriteStatus, error) {
if !bc.chainmu.TryLock() {
return NonStatTy, errInsertionInterrupted
Expand Down
4 changes: 2 additions & 2 deletions rollup/da_syncer/da/da.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ type PartialHeader struct {
Time uint64
BaseFee *big.Int
GasLimit uint64
Difficulty *big.Int
Difficulty uint64
ExtraData []byte
}

Expand All @@ -51,7 +51,7 @@ func (h *PartialHeader) ToHeader() *types.Header {
Time: h.Time,
BaseFee: h.BaseFee,
GasLimit: h.GasLimit,
Difficulty: h.Difficulty,
Difficulty: new(big.Int).SetUint64(h.Difficulty),
Extra: h.ExtraData,
}
}
Expand Down

0 comments on commit dbdbc88

Please sign in to comment.