Skip to content

Commit fc51729

Browse files
committed
more rename
1 parent c411016 commit fc51729

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

simplex/storage.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ func newStorage(ctx context.Context, config *Config, qcDeserializer *QCDeseriali
7777
log: config.Log,
7878
}
7979

80-
// set the initial storage height to the number of blocks indexed
8180
lastAccepted, err := config.VM.LastAccepted(ctx)
8281
if err != nil {
8382
return nil, err
@@ -136,15 +135,15 @@ func (s *Storage) Retrieve(seq uint64) (simplex.VerifiedBlock, simplex.Finalizat
136135
}
137136

138137
// Index indexes the finalization in the storage.
139-
// It stores the finalization bytes at the current height and increments the height.
138+
// It stores the finalization bytes and increments numBlocks.
140139
func (s *Storage) Index(ctx context.Context, block simplex.VerifiedBlock, finalization simplex.Finalization) error {
141140
bh := block.BlockHeader()
142-
currentHeight := s.numBlocks.Load()
143-
if currentHeight != bh.Seq {
141+
numBlocks := s.numBlocks.Load()
142+
if numBlocks != bh.Seq {
144143
s.log.Error("Attempted to index block with mismatched sequence number",
145-
zap.Uint64("expected", currentHeight),
144+
zap.Uint64("expected", numBlocks),
146145
zap.Uint64("got", bh.Seq))
147-
return fmt.Errorf("%w: expected %d, got %d", errUnexpectedSeq, currentHeight, bh.Seq)
146+
return fmt.Errorf("%w: expected %d, got %d", errUnexpectedSeq, numBlocks, bh.Seq)
148147
}
149148

150149
if s.lastIndexedDigest != bh.Prev {

0 commit comments

Comments
 (0)