// and issuance memory. The Chain type uses Store to load state
// from storage and persist validated data.
type Store interface {
- Height() uint64
- GetBlock(uint64) (*legacy.Block, error)
+ Height(context.Context) (uint64, error)
+ GetBlock(context.Context, uint64) (*legacy.Block, error)
LatestSnapshot(context.Context) (*state.Snapshot, uint64, error)
- SaveBlock(*legacy.Block) error
+ SaveBlock(context.Context, *legacy.Block) error
FinalizeBlock(context.Context, uint64) error
SaveSnapshot(context.Context, uint64, *state.Snapshot) error
}
}
c.state.cond.L = new(sync.Mutex)
- c.state.height = store.Height()
+ c.state.height, _ = store.Height(ctx)
// Note that c.height.n may still be zero here.
if heights != nil {