Skip to content

Commit 0d1b99b

Browse files
authored
fix: chain backend should not be used for ultra light nodes (#5310)
1 parent d5a095c commit 0d1b99b

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

pkg/node/node.go

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -489,17 +489,19 @@ func NewBee(
489489
b.apiCloser = apiServer
490490
}
491491

492-
// Sync the with the given Ethereum backend:
493-
isSynced, _, err := transaction.IsSynced(ctx, chainBackend, maxDelay)
494-
if err != nil {
495-
return nil, fmt.Errorf("is synced: %w", err)
496-
}
497-
if !isSynced {
498-
logger.Info("waiting to sync with the blockchain backend")
499-
500-
err := transaction.WaitSynced(ctx, logger, chainBackend, maxDelay)
492+
if chainEnabled {
493+
// Sync the with the given Ethereum backend:
494+
isSynced, _, err := transaction.IsSynced(ctx, chainBackend, maxDelay)
501495
if err != nil {
502-
return nil, fmt.Errorf("waiting backend sync: %w", err)
496+
return nil, fmt.Errorf("is synced: %w", err)
497+
}
498+
if !isSynced {
499+
logger.Info("waiting to sync with the blockchain backend")
500+
501+
err := transaction.WaitSynced(ctx, logger, chainBackend, maxDelay)
502+
if err != nil {
503+
return nil, fmt.Errorf("waiting backend sync: %w", err)
504+
}
503505
}
504506
}
505507

0 commit comments

Comments
 (0)