Skip to content

Commit c7025bb

Browse files
committed
Fix possible nil tx.To() in callBundle
1 parent e3897dc commit c7025bb

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

internal/ethapi/api.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2238,11 +2238,15 @@ func (s *BundleAPI) CallBundle(ctx context.Context, encodedTxs []hexutil.Bytes,
22382238
if err != nil {
22392239
return nil, fmt.Errorf("err: %w; txhash %s", err, tx.Hash())
22402240
}
2241+
to := "0x"
2242+
if tx.To() != nil {
2243+
to = tx.To().String()
2244+
}
22412245
jsonResult := map[string]interface{}{
22422246
"txHash": txHash,
22432247
"gasUsed": receipt.GasUsed,
22442248
"fromAddress": from.String(),
2245-
"toAddress": tx.To().String(),
2249+
"toAddress": to,
22462250
}
22472251
totalGasUsed += receipt.GasUsed
22482252
gasFeesTx := new(big.Int).Mul(big.NewInt(int64(receipt.GasUsed)), tx.GasPrice())

0 commit comments

Comments
 (0)