Skip to content

Commit

Permalink
fix waiting pending txs loop break logic
Browse files Browse the repository at this point in the history
  • Loading branch information
sh-cha committed Jan 23, 2025
1 parent 9c7791a commit e733737
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions node/broadcaster/broadcaster.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,19 +160,20 @@ func (b *Broadcaster) loadPendingTxs(ctx types.Context, stage types.BasicDB, las
pollingTimer := time.NewTicker(ctx.PollingInterval())
defer pollingTimer.Stop()

WAITLOOP:
for {
if len(pendingTxs) == 0 {
return nil
}

select {
case <-ctx.Done():
return ctx.Err()
case <-timer.C:
break
break WAITLOOP
case <-pollingTimer.C:
}

if len(pendingTxs) == 0 {
return nil
}

txHash, err := hex.DecodeString(pendingTxs[0].TxHash)
if err != nil {
return err
Expand Down

0 comments on commit e733737

Please sign in to comment.