Skip to content

Commit

Permalink
txwatcher: Add nil check before calling the blockchain rpc
Browse files Browse the repository at this point in the history
We encountered an error with a missing blockchain client in #74. This
was not reproducible by now so we hope this log will help solving
this issue in the future.
  • Loading branch information
nepet committed Jul 17, 2022
1 parent 26b3785 commit 6135d8d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions txwatcher/rpctxwatcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ type BlockchainRpcTxWatcher struct {
}

func (s *BlockchainRpcTxWatcher) GetBlockHeight() (uint32, error) {
if s.blockchain == nil {
return 0, fmt.Errorf("missing blockchain rpc client")
}

blockheight, err := s.blockchain.GetBlockHeight()
if err != nil {
return 0, err
Expand Down

0 comments on commit 6135d8d

Please sign in to comment.