Skip to content

Commit

Permalink
update slot only if RPC returns nil error
Browse files Browse the repository at this point in the history
  • Loading branch information
ws4charlie committed Dec 17, 2024
1 parent 68d9eae commit 02b1732
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions zetaclient/chains/solana/observer/inbound.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,9 @@ func (ob *Observer) ObserveInbound(ctx context.Context) error {
}

// query last finalized slot
lastSlot, err := ob.solClient.GetSlot(ctx, rpc.CommitmentFinalized)
if err != nil {
ob.Logger().Inbound.Err(err).Msg("unable to get last slot")
lastSlot, errSlot := ob.solClient.GetSlot(ctx, rpc.CommitmentFinalized)
if errSlot != nil {
ob.Logger().Inbound.Err(errSlot).Msg("unable to get last slot")
}

// get all signatures for the gateway address since last scanned signature
Expand All @@ -96,7 +96,7 @@ func (ob *Observer) ObserveInbound(ctx context.Context) error {
}

// update metrics if no new signatures found
if len(signatures) == 0 {
if len(signatures) == 0 && errSlot == nil {
ob.WithLastBlockScanned(lastSlot)
} else {
ob.Logger().Inbound.Info().Msgf("ObserveInbound: got %d signatures for chain %d", len(signatures), chainID)
Expand Down

0 comments on commit 02b1732

Please sign in to comment.