Skip to content
This repository has been archived by the owner on Sep 23, 2023. It is now read-only.

Commit

Permalink
pool: don't warn at Ctrl+C
Browse files Browse the repository at this point in the history
  • Loading branch information
AskAlexSharov committed Aug 11, 2023
1 parent a17eaec commit 309e0bd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
7 changes: 4 additions & 3 deletions txpool/fetch.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package txpool

import (
"context"
"errors"
"fmt"
"sync"
"time"
Expand Down Expand Up @@ -473,7 +474,7 @@ func (f *Fetch) handleStateChanges(ctx context.Context, client StateChangesClien
if err = f.threadSafeParseStateChangeTxn(func(parseContext *types2.TxParseContext) error {
_, err := parseContext.ParseTransaction(change.Txs[i], 0, minedTxs.Txs[i], minedTxs.Senders.At(i), false /* hasEnvelope */, false /* wrappedWithBlobs */, nil)
return err
}); err != nil {
}); err != nil && !errors.Is(err, context.Canceled) {
f.logger.Warn("stream.Recv", "err", err)
continue
}
Expand All @@ -486,7 +487,7 @@ func (f *Fetch) handleStateChanges(ctx context.Context, client StateChangesClien
if err = f.threadSafeParseStateChangeTxn(func(parseContext *types2.TxParseContext) error {
_, err = parseContext.ParseTransaction(change.Txs[i], 0, unwindTxs.Txs[i], unwindTxs.Senders.At(i), false /* hasEnvelope */, false /* wrappedWithBlobs */, nil)
return err
}); err != nil {
}); err != nil && !errors.Is(err, context.Canceled) {
f.logger.Warn("stream.Recv", "err", err)
continue
}
Expand All @@ -497,7 +498,7 @@ func (f *Fetch) handleStateChanges(ctx context.Context, client StateChangesClien
// unwrapped version here (we would need to re-wrap the tx with its blobs & kzg commitments).
if err := f.db.View(ctx, func(tx kv.Tx) error {
return f.pool.OnNewBlock(ctx, req, unwindTxs, minedTxs, tx)
}); err != nil {
}); err != nil && !errors.Is(err, context.Canceled) {
f.logger.Warn("onNewBlock", "err", err)
}
if f.wg != nil {
Expand Down
4 changes: 2 additions & 2 deletions txpool/pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ func (p *TxPool) OnNewBlock(ctx context.Context, stateChanges *remote.StateChang
p.lastSeenBlock.Store(stateChanges.ChangeBatch[len(stateChanges.ChangeBatch)-1].BlockHeight)
if !p.started.Load() {
if err := p.fromDB(ctx, tx, coreTx); err != nil {
return fmt.Errorf("loading txs from DB: %w", err)
return fmt.Errorf("OnNewBlock: loading txs from DB: %w", err)
}
}

Expand Down Expand Up @@ -940,7 +940,7 @@ func (p *TxPool) AddLocalTxs(ctx context.Context, newTransactions types.TxSlots,

if !p.Started() {
if err := p.fromDB(ctx, tx, coreTx); err != nil {
return nil, fmt.Errorf("loading txs from DB: %w", err)
return nil, fmt.Errorf("AddLocalTxs: loading txs from DB: %w", err)
}
if p.started.CompareAndSwap(false, true) {
p.logger.Info("[txpool] Started")
Expand Down

0 comments on commit 309e0bd

Please sign in to comment.