diff --git a/changelog.md b/changelog.md index 66136741a3..434d69161e 100644 --- a/changelog.md +++ b/changelog.md @@ -28,6 +28,7 @@ * [3253](https://github.com/zeta-chain/node/pull/3253) - fix solana inbound version 0 queries and move tss keysign prior to relayer key checking * [3278](https://github.com/zeta-chain/node/pull/3278) - enforce checksum format for asset address in ZRC20 * [3289](https://github.com/zeta-chain/node/pull/3289) - remove all dynamic peer discovery (zetaclient) +* [3314](https://github.com/zeta-chain/node/pull/3314) - update `last_scanned_block_number` metrics more frequently for Solana chain ## v23.0.0 diff --git a/zetaclient/chains/solana/observer/inbound.go b/zetaclient/chains/solana/observer/inbound.go index 6eab1242ac..6cc1c8d84c 100644 --- a/zetaclient/chains/solana/observer/inbound.go +++ b/zetaclient/chains/solana/observer/inbound.go @@ -81,6 +81,12 @@ func (ob *Observer) ObserveInbound(ctx context.Context) error { ob.WithLastTxScanned(lastSig.String()) } + // query last finalized 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 lastSig := solana.MustSignatureFromBase58(ob.LastTxScanned()) signatures, err := solanarpc.GetSignaturesForAddressUntil(ctx, ob.solClient, ob.gatewayID, lastSig, pageLimit) @@ -88,7 +94,13 @@ func (ob *Observer) ObserveInbound(ctx context.Context) error { ob.Logger().Inbound.Err(err).Msg("error GetSignaturesForAddressUntil") return err } - if len(signatures) > 0 { + + // update metrics if no new signatures found + if len(signatures) == 0 { + if errSlot == nil { + ob.WithLastBlockScanned(lastSlot) + } + } else { ob.Logger().Inbound.Info().Msgf("ObserveInbound: got %d signatures for chain %d", len(signatures), chainID) }