Add code to handle a race condition around first_preprocess

This commit is contained in:
Luke Parker
2023-08-26 21:09:57 -04:00
parent c245bcdc9b
commit 9adefa4c2c
2 changed files with 18 additions and 4 deletions

View File

@@ -92,7 +92,7 @@ impl<'a, D: Db> MainDb<'a, D> {
}
txn.put(key, preprocess);
}
pub fn first_preprocess<G: Get>(getter: &G, id: [u8; 32]) -> Vec<u8> {
getter.get(Self::first_preprocess_key(id)).expect("asked for first preprocess we never saved")
pub fn first_preprocess<G: Get>(getter: &G, id: [u8; 32]) -> Option<Vec<u8>> {
getter.get(Self::first_preprocess_key(id))
}
}