From ad5d463ceb8b2de58eef56366652caf675f960a5 Mon Sep 17 00:00:00 2001 From: islishude Date: Thu, 27 Mar 2025 16:07:47 +0800 Subject: [PATCH] ethclient: change Hash field of rpcBlock to pointer --- ethclient/ethclient.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ethclient/ethclient.go b/ethclient/ethclient.go index 352e6abc2c..32e1f4d7b8 100644 --- a/ethclient/ethclient.go +++ b/ethclient/ethclient.go @@ -131,7 +131,7 @@ func (ec *Client) BlockReceipts(ctx context.Context, blockNrOrHash rpc.BlockNumb } type rpcBlock struct { - Hash common.Hash `json:"hash"` + Hash *common.Hash `json:"hash"` Transactions []rpcTransaction `json:"transactions"` UncleHashes []common.Hash `json:"uncles"` Withdrawals []*types.Withdrawal `json:"withdrawals,omitempty"` @@ -198,8 +198,8 @@ func (ec *Client) getBlock(ctx context.Context, method string, args ...interface // Fill the sender cache of transactions in the block. txs := make([]*types.Transaction, len(body.Transactions)) for i, tx := range body.Transactions { - if tx.From != nil { - setSenderFromServer(tx.tx, *tx.From, body.Hash) + if tx.From != nil && body.Hash != nil { + setSenderFromServer(tx.tx, *tx.From, *body.Hash) } txs[i] = tx.tx }