Skip to content

Commit f06256f

Browse files
Merge pull request #401 from StephenButtolph/fix-multiple-start
fix multiple engine startups
2 parents 3c73ab9 + d9b7685 commit f06256f

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

snow/engine/common/bootstrapper.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ type Bootstrapper struct {
4545
acceptedVotes map[[32]byte]uint64
4646

4747
// current weight
48-
weight uint64
48+
started bool
49+
weight uint64
4950
}
5051

5152
// Initialize implements the Engine interface.
@@ -67,6 +68,7 @@ func (b *Bootstrapper) Initialize(config Config) error {
6768

6869
// Startup implements the Engine interface.
6970
func (b *Bootstrapper) Startup() error {
71+
b.started = true
7072
if b.pendingAcceptedFrontier.Len() == 0 {
7173
b.Ctx.Log.Info("Bootstrapping skipped due to no provided bootstraps")
7274
return b.Bootstrapable.ForceAccepted(ids.Set{})
@@ -180,6 +182,9 @@ func (b *Bootstrapper) Accepted(validatorID ids.ShortID, requestID uint32, conta
180182

181183
// Connected implements the Engine interface.
182184
func (b *Bootstrapper) Connected(validatorID ids.ShortID) error {
185+
if b.started {
186+
return nil
187+
}
183188
weight, ok := b.Beacons.GetWeight(validatorID)
184189
if !ok {
185190
return nil

0 commit comments

Comments
 (0)