optimizate code (#63)

This commit is contained in:
maskpp 2022-03-31 11:37:33 +08:00 committed by GitHub
parent 360115e61f
commit e55d05d3ab
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 10 deletions

View file

@ -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]

View file

@ -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)