Skip to content

Commit 07d486e

Browse files
martinconicacud
authored andcommitted
fix: chain backend should not be used for ultra light nodes (#5310)
1 parent 8477d79 commit 07d486e

1 file changed

Lines changed: 12 additions & 10 deletions

File tree

pkg/node/node.go

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -500,17 +500,19 @@ func NewBee(
500500
b.apiCloser = apiServer
501501
}
502502

503-
// Sync the with the given Ethereum backend:
504-
isSynced, _, err := transaction.IsSynced(ctx, chainBackend, maxDelay)
505-
if err != nil {
506-
return nil, fmt.Errorf("is synced: %w", err)
507-
}
508-
if !isSynced {
509-
logger.Info("waiting to sync with the blockchain backend")
510-
511-
err := transaction.WaitSynced(ctx, logger, chainBackend, maxDelay)
503+
if chainEnabled {
504+
// Sync the with the given Ethereum backend:
505+
isSynced, _, err := transaction.IsSynced(ctx, chainBackend, maxDelay)
512506
if err != nil {
513-
return nil, fmt.Errorf("waiting backend sync: %w", err)
507+
return nil, fmt.Errorf("is synced: %w", err)
508+
}
509+
if !isSynced {
510+
logger.Info("waiting to sync with the blockchain backend")
511+
512+
err := transaction.WaitSynced(ctx, logger, chainBackend, maxDelay)
513+
if err != nil {
514+
return nil, fmt.Errorf("waiting backend sync: %w", err)
515+
}
514516
}
515517
}
516518

0 commit comments

Comments
 (0)