Skip to content

Commit

Permalink
fix: fix transaction hash nil pointer error
Browse files Browse the repository at this point in the history
This commit ensures 'invalid memory address or nil pointer dereference'
is not thrown when trying to retrieve the transaction hash inside the
rewardservice.
  • Loading branch information
rickstaa committed Dec 18, 2023
1 parent c2f1bde commit 167cbf3
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions eth/rewardservice.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package eth
import (
"context"
"fmt"
"strings"
"sync"

"github.com/ethereum/go-ethereum/core/types"
Expand Down Expand Up @@ -59,8 +60,8 @@ func (s *RewardService) Start(ctx context.Context) error {
if err != nil {
glog.Errorf("Error trying to call reward err=%q", err)
var txHash string
if tx != nil {
txHash = tx.Hash().String()
if tx != nil && !strings.Contains(err.Error(), "context deadline exceeded") {
txHash = tx.Hash().Hex()
}
if monitor.Enabled {
monitor.RewardCallError(ctx, err.Error(), s.tw.LastInitializedRound(), txHash)
Expand Down

0 comments on commit 167cbf3

Please sign in to comment.