From b780b3dab24193ae6d30c5fa5af9048f74ba9616 Mon Sep 17 00:00:00 2001 From: tbjump Date: Mon, 17 Jul 2023 19:28:14 +0000 Subject: [PATCH] node/processor: Remove dead code --- node/pkg/processor/message.go | 34 --------------------------------- node/pkg/processor/processor.go | 29 ---------------------------- 2 files changed, 63 deletions(-) diff --git a/node/pkg/processor/message.go b/node/pkg/processor/message.go index 43238fa3d4..54c042f18a 100644 --- a/node/pkg/processor/message.go +++ b/node/pkg/processor/message.go @@ -4,7 +4,6 @@ import ( "context" "encoding/hex" - "github.com/certusone/wormhole/node/pkg/db" "github.com/mr-tron/base58" "github.com/prometheus/client_golang/prometheus" @@ -95,39 +94,6 @@ func (p *Processor) handleMessage(ctx context.Context, k *common.MessagePublicat return } - // Ignore incoming observations when our database already has a quorum VAA for it. - // This can occur when we're receiving late observations due to node catchup, and - // processing those won't do us any good. - // - // Exception: if an observation is made within the settlement time (30s), we'll - // process it so other nodes won't consider it a miss. - - if existing, err := p.getSignedVAA(*db.VaaIDFromVAA(&v.VAA)); err == nil { - if k.Timestamp.Sub(existing.Timestamp) > settlementTime { - p.logger.Info("ignoring observation since we already have a quorum VAA for it", - zap.Stringer("emitter_chain", k.EmitterChain), - zap.Stringer("emitter_address", k.EmitterAddress), - zap.String("emitter_address_b58", base58.Encode(k.EmitterAddress.Bytes())), - zap.Uint32("nonce", k.Nonce), - zap.Stringer("txhash", k.TxHash), - zap.String("txhash_b58", base58.Encode(k.TxHash.Bytes())), - zap.Time("timestamp", k.Timestamp), - zap.String("message_id", v.MessageID()), - zap.Duration("settlement_time", settlementTime), - ) - return - } - } else if err != db.ErrVAANotFound { - p.logger.Error("failed to get VAA from db", - zap.Stringer("emitter_chain", k.EmitterChain), - zap.Stringer("emitter_address", k.EmitterAddress), - zap.Uint32("nonce", k.Nonce), - zap.Stringer("txhash", k.TxHash), - zap.Time("timestamp", k.Timestamp), - zap.Error(err), - ) - } - // Generate digest of the unsigned VAA. digest := v.SigningDigest() diff --git a/node/pkg/processor/processor.go b/node/pkg/processor/processor.go index a1454066d6..22a7be9202 100644 --- a/node/pkg/processor/processor.go +++ b/node/pkg/processor/processor.go @@ -327,32 +327,3 @@ func (p *Processor) haveSignedVAA(id db.VAAID) bool { return ok } - -func (p *Processor) getSignedVAA(id db.VAAID) (*vaa.VAA, error) { - - if id.EmitterChain == vaa.ChainIDPythNet { - key := fmt.Sprintf("%v/%v", id.EmitterAddress, id.Sequence) - ret, exists := p.pythnetVaas[key] - if exists { - return ret.v, nil - } - - return nil, db.ErrVAANotFound - } - - if p.db == nil { - return nil, db.ErrVAANotFound - } - - vb, err := p.db.GetSignedVAABytes(id) - if err != nil { - return nil, err - } - - vaa, err := vaa.Unmarshal(vb) - if err != nil { - panic("failed to unmarshal VAA from db") - } - - return vaa, err -}