Skip to content

Commit

Permalink
eth, internal/ethapi: fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
CaraWang committed Nov 6, 2023
1 parent f00be4b commit c867cce
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion eth/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -641,7 +641,7 @@ func (api *PrivateDebugAPI) GetAccessibleState(from, to rpc.BlockNumber) (uint64
func (api *PrivateDebugAPI) GetBlockReceipts(blockHash common.Hash) ([]map[string]interface{}, error) {
if receipts := api.eth.blockchain.GetReceiptsByHash(blockHash); receipts != nil {
if block := api.eth.blockchain.GetBlockByHash(blockHash); block != nil {
return ethapi.ToTxReceipts(block.Header().Number.Uint64(), blockHash, receipts, block)
return ethapi.ToTxReceipts(api.eth.APIBackend.ChainConfig(), block.Header().Number.Uint64(), blockHash, receipts, block)
}
}
return nil, errors.New("unknown receipts")
Expand Down
7 changes: 3 additions & 4 deletions internal/ethapi/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -1916,11 +1916,10 @@ func (s *PublicTransactionPoolAPI) GetTransactionReceiptsByBlockNumber(ctx conte
return nil, fmt.Errorf("block %d not found", blockNumber)
}

return ToTxReceipts(blockNumber, blockHash, receipts, block)
return ToTxReceipts(s.b.ChainConfig(), blockNumber, blockHash, receipts, block)
}

func ToTxReceipts(blockNumber uint64, blockHash common.Hash, receipts types.Receipts, block *types.Block) ([]map[string]interface{}, error) {

func ToTxReceipts(config *params.ChainConfig, blockNumber uint64, blockHash common.Hash, receipts types.Receipts, block *types.Block) ([]map[string]interface{}, error) {
txs := block.Transactions()
if len(txs) != len(receipts) {
return nil, fmt.Errorf("txs length doesn't equal to receipts' length")
Expand All @@ -1929,7 +1928,7 @@ func ToTxReceipts(blockNumber uint64, blockHash common.Hash, receipts types.Rece
txReceipts := make([]map[string]interface{}, 0, len(txs))
for idx, receipt := range receipts {
tx := txs[idx]
signer := types.MakeSigner(s.b.ChainConfig(), block.Number())
signer := types.MakeSigner(config, block.Number())
from, _ := types.Sender(signer, tx)

fields := map[string]interface{}{
Expand Down

0 comments on commit c867cce

Please sign in to comment.