Skip to content

Commit

Permalink
Fix bug in StartPost (#1714)
Browse files Browse the repository at this point in the history
case statement was missing fallthrough. Updates tests accordingly.

## Motivation
Spotted while working on #1700 (but probably unrelated).

## Changes
Fix case statement

## Test Plan
Updated tests accordingly.
  • Loading branch information
lrettig authored and noamnelke committed Mar 12, 2020
1 parent ed1af10 commit 6a06041
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
1 change: 0 additions & 1 deletion activation/activation.go
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,6 @@ func (b *Builder) StartPost(rewardAddress types.Address, dataDir string, space u
case InitDone:
return fmt.Errorf("already initialized")
case InitInProgress:
default:
return fmt.Errorf("already started")
}
}
Expand Down
9 changes: 8 additions & 1 deletion activation/activation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -727,7 +727,14 @@ func TestStartPost(t *testing.T) {
assert.Nil(t, builder.commitment)
assert.Equal(t, postProver.Cfg().SpacePerUnit, uint64(1000))

// Initialize.
// Attempt to initialize again
assert.Nil(t, builder.commitment)
err = builder.StartPost(coinbase2, drive, 1024)
assert.EqualError(t, err, "already started")
assert.Nil(t, builder.commitment)

// Reinitialize.
builder = NewBuilder(id, coinbase, &MockSigning{}, activationDb, &FaultyNetMock{}, layers, layersPerEpoch, nipstBuilder, postProver, layerClock, &mockSyncer{}, db, lg.WithName("atxBuilder2"))
assert.Nil(t, builder.commitment)
err = builder.StartPost(coinbase2, drive, 1024)
assert.NoError(t, err)
Expand Down

0 comments on commit 6a06041

Please sign in to comment.