From b0c33c5b0c7364c6e5a9fa115211aad90e9c0e3f Mon Sep 17 00:00:00 2001 From: xiaodino Date: Thu, 28 Mar 2024 09:25:21 -0700 Subject: [PATCH] =?UTF-8?q?Revert=20"fix(relayer):=20func=20WaitConfirmati?= =?UTF-8?q?ons=20should=20not=20wait=20forever=20for=20ethe=E2=80=A6"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 5578687ba139659c0f80f6785db1614e68a4b789. --- packages/relayer/processor/process_message.go | 1 - packages/relayer/types.go | 14 ++------------ 2 files changed, 2 insertions(+), 13 deletions(-) diff --git a/packages/relayer/processor/process_message.go b/packages/relayer/processor/process_message.go index 6c46dbb08e..dbb77794ae 100644 --- a/packages/relayer/processor/process_message.go +++ b/packages/relayer/processor/process_message.go @@ -84,7 +84,6 @@ func (p *Processor) processMessage( slog.Info("waiting for confirmations", "msgHash", common.BytesToHash(msgBody.Event.MsgHash[:]).Hex(), - "txHash", msgBody.Event.Raw.TxHash, ) if err := p.waitForConfirmations(ctx, msgBody.Event.Raw.TxHash, msgBody.Event.Raw.BlockNumber); err != nil { diff --git a/packages/relayer/types.go b/packages/relayer/types.go index 804f09ba9d..66d0e82e64 100644 --- a/packages/relayer/types.go +++ b/packages/relayer/types.go @@ -68,10 +68,7 @@ var ( // WaitConfirmations won't return before N blocks confirmations have been seen // on destination chain, or context is cancelled. -// txHash is from Raw.TxHash in event or SignalServiceChainDataSynced. func WaitConfirmations(ctx context.Context, confirmer confirmer, confirmations uint64, txHash common.Hash) error { - notFoundCount := 0 - checkConfs := func() error { receipt, err := confirmer.TransactionReceipt(ctx, txHash) if err != nil { @@ -86,7 +83,7 @@ func WaitConfirmations(ctx context.Context, confirmer confirmer, confirmations u want := receipt.BlockNumber.Uint64() + confirmations if latest < want { - slog.Info("waiting for confirmations", "latestBlockNum", latest, "wantBlockNum", want, "txHash", txHash.Hex()) + slog.Info("waiting for confirmations", "latestBlockNum", latest, "wantBlockNum", want) return errStillWaiting } @@ -110,14 +107,7 @@ func WaitConfirmations(ctx context.Context, confirmer confirmer, confirmations u return ctx.Err() case <-ticker.C: if err := checkConfs(); err != nil { - if err == ethereum.NotFound { - notFoundCount++ - if notFoundCount >= 10 { - return err - } - - continue - } else if err == errStillWaiting { + if err == ethereum.NotFound || err == errStillWaiting { continue }