@@ -137,44 +137,47 @@ func (e *EVMBackend) EthBlockFromTendermint(
137137
138138 txReceiptsResp , err := queryClient .TxReceiptsByBlockHeight (types .ContextWithHeight (block .Height ), req )
139139 if err != nil {
140- e .logger .Debugf ("TxReceiptsByBlockHeight fail: %s" , err .Error ())
141- return nil , err
140+ e .logger .WithError (err ).Debugln ("TxReceiptsByBlockHeight failed" )
142141 }
143142
144143 gasUsed := big .NewInt (0 )
145144
146- ethRPCTxs := make ([]interface {}, 0 , len (txReceiptsResp .Receipts ))
147-
148- for _ , receipt := range txReceiptsResp .Receipts {
149- hash := common .HexToHash (receipt .Hash )
150- if fullTx {
151- // full txs from receipts
152- tx , err := types .NewTransactionFromData (
153- receipt .Data ,
154- common .HexToAddress (receipt .From ),
155- hash ,
156- common .HexToHash (receipt .BlockHash ),
157- receipt .BlockHeight ,
158- receipt .Index ,
159- )
160-
161- if err != nil {
162- e .logger .WithError (err ).Warningf ("NewTransactionFromData for receipt %s failed" , hash )
163- continue
145+ ethRPCTxs := []interface {}{}
146+
147+ if txReceiptsResp != nil {
148+
149+ for _ , receipt := range txReceiptsResp .Receipts {
150+ hash := common .HexToHash (receipt .Hash )
151+ if fullTx {
152+ // full txs from receipts
153+ tx , err := types .NewTransactionFromData (
154+ receipt .Data ,
155+ common .HexToAddress (receipt .From ),
156+ hash ,
157+ common .HexToHash (receipt .BlockHash ),
158+ receipt .BlockHeight ,
159+ receipt .Index ,
160+ )
161+
162+ if err != nil {
163+ e .logger .WithError (err ).Warningf ("NewTransactionFromData for receipt %s failed" , hash )
164+ continue
165+ }
166+
167+ ethRPCTxs = append (ethRPCTxs , tx )
168+ gasUsed .Add (gasUsed , new (big.Int ).SetUint64 (receipt .Result .GasUsed ))
169+ } else {
170+ // simply hashes
171+ ethRPCTxs = append (ethRPCTxs , hash )
164172 }
165-
166- ethRPCTxs = append (ethRPCTxs , tx )
167- gasUsed .Add (gasUsed , new (big.Int ).SetUint64 (receipt .Result .GasUsed ))
168- } else {
169- // simply hashes
170- ethRPCTxs = append (ethRPCTxs , hash )
171173 }
172174 }
173175
174176 blockBloomResp , err := queryClient .BlockBloom (types .ContextWithHeight (block .Height ), & evmtypes.QueryBlockBloomRequest {})
175177 if err != nil {
176- e .logger .WithError (err ).Debugln ("failed to query BlockBloom at height" , block .Height )
177- blockBloomResp .Bloom = ethtypes.Bloom {}.Bytes ()
178+ e .logger .WithError (err ).Debugln ("failed to query BlockBloom" , "height" , block .Height )
179+
180+ blockBloomResp = & evmtypes.QueryBlockBloomResponse {Bloom : ethtypes.Bloom {}.Bytes ()}
178181 }
179182
180183 bloom := ethtypes .BytesToBloom (blockBloomResp .Bloom )
0 commit comments