Node/Solana: Allow reobservation of confirmed messages (#3769)

* Node/Solana: Allow reobservation of confirmed messages

* Add check for finalized watcher

* Tweak finalized change
This commit is contained in:
bruce-riley 2024-02-07 10:01:41 -06:00 committed by GitHub
parent c7a7d1a56b
commit 3f75eca90e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 10 additions and 2 deletions

View File

@ -851,8 +851,16 @@ func (s *SolanaWatcher) processMessageAccount(logger *zap.Logger, data []byte, a
return
}
if commitment != s.commitment {
logger.Debug("skipping message which does not match the watcher commitment", zap.Stringer("account", acc), zap.String("message commitment", string(commitment)), zap.String("watcher commitment", string(s.commitment)))
return
if isReobservation && s.commitment == rpc.CommitmentFinalized {
// There is only a single reobservation request channel for each chain, which is assigned to the finalized watcher.
// If someone requests reobservation of a confirmed message, we should allow the observation to go through.
logger.Info("allowing reobservation although the commitment level does not match the watcher",
zap.Stringer("account", acc), zap.String("message commitment", string(commitment)), zap.String("watcher commitment", string(s.commitment)),
)
} else {
logger.Debug("skipping message which does not match the watcher commitment", zap.Stringer("account", acc), zap.String("message commitment", string(commitment)), zap.String("watcher commitment", string(s.commitment)))
return
}
}
// As of 2023-11-09, Pythnet has a bug which is not zeroing out these fields appropriately. This carve out should be removed after a fix is deployed.