Skip to content

Commit

Permalink
Skip re-reading entries that were just written
Browse files Browse the repository at this point in the history
This addresses #360.
  • Loading branch information
mhutchinson committed Nov 18, 2024
1 parent 5e497c3 commit 84d03d9
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions trusted_applet/internal/storage/slots/journal.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,19 +164,9 @@ func (j *Journal) Update(data []byte) error {
return fmt.Errorf("failed to write blocks: %v", err)
}

// Attempt to re-read the entry we just wrote to make sure that all is well...
br := newBlockReader(j.dev, j.nextBlock)
latest, err := unmarshalEntry(br)
if err != nil {
return fmt.Errorf("failed to re-scan written entry: %v", err)
}
if got, want := latest.Revision, e.Revision; got != want {
return fmt.Errorf("journal error, latest entry revision %d != written revision %d", got, want)
}

// Finally, update the journal state.
j.nextBlock += numBlocks
j.current = *latest
j.current = e

return nil
}
Expand Down

0 comments on commit 84d03d9

Please sign in to comment.