Skip to content

Commit 1238c40

Browse files
committed
Fix bootstrap epoch calculation
1 parent e86a5cf commit 1238c40

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

certstore/snapshot.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ func importSnapshotToDatastoreWithTestingPowerTableFrequency(ctx context.Context
153153
if cert.ECChain == nil || len(cert.ECChain.TipSets) == 0 {
154154
return fmt.Errorf("invalid certificate at first instance %d", cert.GPBFTInstance)
155155
}
156-
snapshotBootstrapEpoch := cert.ECChain.Base().Epoch
156+
snapshotBootstrapEpoch := cert.ECChain.Base().Epoch + m.EC.Finality
157157
if m.BootstrapEpoch != snapshotBootstrapEpoch {
158158
// Delete entries that are written in `OpenOrCreateStore` above.
159159
// Note that if the provided database is non-empty, `OpenOrCreateStore` should

certstore/snapshot_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ func Test_SnapshotExportImportRoundTrip(t *testing.T) {
8484

8585
generatedChain, err := subject.Generate(ctx, certChainLength)
8686
require.NoError(t, err)
87-
m.BootstrapEpoch = generatedChain[0].ECChain.Base().Epoch
87+
m.BootstrapEpoch = generatedChain[0].ECChain.Base().Epoch + m.EC.Finality
8888

8989
ds1 := datastore.NewMapDatastore()
9090
cs, err := OpenOrCreateStore(ctx, ds1, generatedChain[0].GPBFTInstance, initialPowerTable)

0 commit comments

Comments
 (0)