Skip to content

Commit

Permalink
Merge pull request #2577 from div72/fix-crash-snapshot-corruptio
Browse files Browse the repository at this point in the history
accrual: rebuild snapshot registry on corruption instead of crashing
  • Loading branch information
jamescowens committed Sep 23, 2022
2 parents f29a778 + 6420fcf commit dd57fcf
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/gridcoin/accrual/snapshot.h
Original file line number Diff line number Diff line change
Expand Up @@ -867,7 +867,15 @@ class AccrualSnapshotRegistry
CURRENT_VERSION);

if (!registry_file.IsNull()) {
Unserialize(registry_file);
try {
Unserialize(registry_file);
} catch (const std::ios_base::failure& e) {
if (feof(registry_file.Get())) {
throw SnapshotStateError("unexpected eof while loading the registry.");
}

throw;
}
} else {
m_entries.clear();
}
Expand Down

0 comments on commit dd57fcf

Please sign in to comment.