This commit is contained in:
Rafael Sampaio 2024-09-16 09:28:26 -03:00 committed by Chen Kai
parent 26b40a9534
commit bb07079737

View file

@ -40,7 +40,6 @@ func rpcMarshalBlock(block *types.Block, fullTx bool, chainId *big.Int) (map[str
fields["withdrawals"] = block.Withdrawals() fields["withdrawals"] = block.Withdrawals()
} }
return fields, nil return fields, nil
} }
func RPCMarshalHeader(head *types.Header) map[string]interface{} { func RPCMarshalHeader(head *types.Header) map[string]interface{} {
@ -89,7 +88,6 @@ func newRPCTransactionFromBlockIndex(b *types.Block, index uint64, chainId *big.
} }
func newRPCTransaction(tx *types.Transaction, blockHash common.Hash, blockNumber uint64, blockTime uint64, index uint64, baseFee *big.Int, chainId *big.Int) *RPCTransaction { func newRPCTransaction(tx *types.Transaction, blockHash common.Hash, blockNumber uint64, blockTime uint64, index uint64, baseFee *big.Int, chainId *big.Int) *RPCTransaction {
config := &params.ChainConfig{ config := &params.ChainConfig{
ChainID: chainId, ChainID: chainId,
} }
@ -207,12 +205,10 @@ type API struct {
} }
func (p *API) ChainId() hexutil.Uint64 { func (p *API) ChainId() hexutil.Uint64 {
return (hexutil.Uint64)(p.ChainID.Uint64()) return (hexutil.Uint64)(p.ChainID.Uint64())
} }
func (p *API) GetBlockByHash(hash *common.Hash, fullTransactions bool) (map[string]interface{}, error) { func (p *API) GetBlockByHash(hash *common.Hash, fullTransactions bool) (map[string]interface{}, error) {
blockHeader, err := p.History.GetBlockHeader(hash.Bytes()) blockHeader, err := p.History.GetBlockHeader(hash.Bytes())
if err != nil { if err != nil {
log.Error(err.Error()) log.Error(err.Error())
@ -227,5 +223,4 @@ func (p *API) GetBlockByHash(hash *common.Hash, fullTransactions bool) (map[stri
block := types.NewBlockWithHeader(blockHeader).WithBody(*blockBody) block := types.NewBlockWithHeader(blockHeader).WithBody(*blockBody)
return rpcMarshalBlock(block, fullTransactions, p.ChainID) return rpcMarshalBlock(block, fullTransactions, p.ChainID)
} }