Skip to content

Commit

Permalink
blockstore: store merkle root duplicate proofs immediately on detecti…
Browse files Browse the repository at this point in the history
…on (#2638)
  • Loading branch information
AshwinSekar authored Aug 19, 2024
1 parent f9316f8 commit 2958cc3
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 15 deletions.
17 changes: 2 additions & 15 deletions core/src/window_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,21 +166,8 @@ fn run_check_duplicate(
);
let (shred1, shred2) = match shred {
PossibleDuplicateShred::LastIndexConflict(shred, conflict)
| PossibleDuplicateShred::ErasureConflict(shred, conflict) => (shred, conflict),
PossibleDuplicateShred::MerkleRootConflict(shred, conflict) => {
// Although this proof can be immediately stored on detection, we wait until
// here in order to check the feature flag, as storage in blockstore can
// preclude the detection of other duplicate proofs in this slot
if blockstore.has_duplicate_shreds_in_slot(shred_slot) {
return Ok(());
}
blockstore.store_duplicate_slot(
shred_slot,
conflict.clone(),
shred.clone().into_payload(),
)?;
(shred, conflict)
}
| PossibleDuplicateShred::ErasureConflict(shred, conflict)
| PossibleDuplicateShred::MerkleRootConflict(shred, conflict) => (shred, conflict),
PossibleDuplicateShred::ChainedMerkleRootConflict(shred, conflict) => {
if chained_merkle_conflict_duplicate_proofs {
// Although this proof can be immediately stored on detection, we wait until
Expand Down
11 changes: 11 additions & 0 deletions ledger/src/blockstore.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1811,6 +1811,17 @@ impl Blockstore {
);
return true;
};
if let Err(e) = self.store_duplicate_slot(
slot,
conflicting_shred.clone(),
shred.clone().into_payload(),
) {
warn!(
"Unable to store conflicting merkle root duplicate proof for {slot} \
{:?} {e}",
shred.erasure_set(),
);
}
duplicate_shreds.push(PossibleDuplicateShred::MerkleRootConflict(
shred.clone(),
conflicting_shred,
Expand Down

0 comments on commit 2958cc3

Please sign in to comment.