diff --git a/bridge/standard/pkg/transfer/transfer.go b/bridge/standard/pkg/transfer/transfer.go index 47a2f6473..35a63f314 100644 --- a/bridge/standard/pkg/transfer/transfer.go +++ b/bridge/standard/pkg/transfer/transfer.go @@ -156,13 +156,15 @@ func NewTransferToL1( }, nil } -func (t *Transfer) Do(ctx context.Context) <-chan TransferStatus { +func (t *Transfer) Do(pctx context.Context) <-chan TransferStatus { statusChan := make(chan TransferStatus) go func() { defer close(statusChan) statusChan <- TransferStatus{Message: "Setting up initial transfer..."} + ctx, cancel := context.WithTimeout(pctx, 5*time.Minute) + defer cancel() opts, err := t.signer.GetAuthWithCtx(ctx, t.srcChainID) if err != nil { statusChan <- TransferStatus{ @@ -194,6 +196,8 @@ func (t *Transfer) Do(ctx context.Context) <-chan TransferStatus { Message: fmt.Sprintf("Transfer initiated with hash %s. Waiting for it to be mined...", tx.Hash().Hex()), } + ctx, cancel = context.WithTimeout(pctx, 5*time.Minute) + defer cancel() receipt, err := bind.WaitMined(ctx, t.srcClient, tx) if err != nil { statusChan <- TransferStatus{ @@ -235,6 +239,8 @@ func (t *Transfer) Do(ctx context.Context) <-chan TransferStatus { Message: "Waiting for transfer to be finalized...", } + ctx, cancel = context.WithTimeout(pctx, 5*time.Minute) + defer cancel() switch err := t.destFilterer.WaitForTransferFinalized(ctx, t.destInitialBlock, transferIdx); { case err == nil: statusChan <- TransferStatus{Message: "Transfer finalized. Bridging complete."}