From e55d05d3ab9241caff76c0e576f5e6b6a6a5a743 Mon Sep 17 00:00:00 2001 From: maskpp Date: Thu, 31 Mar 2022 11:37:33 +0800 Subject: [PATCH] optimizate code (#63) --- core/blockchain.go | 2 +- core/types/l2trace_block.go | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/core/blockchain.go b/core/blockchain.go index 8fa121a785..a34779ee76 100644 --- a/core/blockchain.go +++ b/core/blockchain.go @@ -1363,7 +1363,7 @@ func (bc *BlockChain) writeBlockResult(state *state.StateDB, block *types.Block, } } - blockResult.BlockTrace = types.NewTraceBlock(bc.chainConfig, block, coinbase) + blockResult.BlockTrace = types.NewTraceBlock(bc.chainConfig, block, &coinbase) for i, tx := range block.Transactions() { evmTrace := blockResult.ExecutionResults[i] diff --git a/core/types/l2trace_block.go b/core/types/l2trace_block.go index 50d1983171..6b85209367 100644 --- a/core/types/l2trace_block.go +++ b/core/types/l2trace_block.go @@ -9,14 +9,14 @@ import ( ) type BlockTrace struct { - Number *big.Int `json:"number"` - Hash common.Hash `json:"hash"` - GasLimit uint64 `json:"gasLimit"` - Difficulty *big.Int `json:"difficulty"` - BaseFee *big.Int `json:"baseFee"` - Coinbase AccountProofWrapper `json:"coinbase"` - Time uint64 `json:"time"` - Transactions []*TransactionTrace `json:"transactions"` + Number *big.Int `json:"number"` + Hash common.Hash `json:"hash"` + GasLimit uint64 `json:"gasLimit"` + Difficulty *big.Int `json:"difficulty"` + BaseFee *big.Int `json:"baseFee"` + Coinbase *AccountProofWrapper `json:"coinbase"` + Time uint64 `json:"time"` + Transactions []*TransactionTrace `json:"transactions"` } type TransactionTrace struct { @@ -36,7 +36,7 @@ type TransactionTrace struct { } // NewTraceBlock supports necessary fields for roller. -func NewTraceBlock(config *params.ChainConfig, block *Block, coinbase AccountProofWrapper) *BlockTrace { +func NewTraceBlock(config *params.ChainConfig, block *Block, coinbase *AccountProofWrapper) *BlockTrace { txs := make([]*TransactionTrace, block.Transactions().Len()) for i, tx := range block.Transactions() { txs[i] = newTraceTransaction(tx, block.NumberU64(), config)