Skip to content

Commit

Permalink
patches bug in chained Merkle root update
Browse files Browse the repository at this point in the history
  • Loading branch information
behzadnouri committed Jun 11, 2024
1 parent 362c605 commit b954a46
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions turbine/src/broadcast_stage/standard_broadcast_run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -243,20 +243,20 @@ impl StandardBroadcastRun {
return Err(Error::DuplicateSlotBroadcast(bank.slot()));
}
// Reinitialize state for this slot.
let chained_merkle_root = (self.slot == bank.parent_slot())
.then_some(self.chained_merkle_root)
.ok_or_else(|| {
broadcast_utils::get_chained_merkle_root_from_parent(
bank.slot(),
bank.parent_slot(),
blockstore,
)
})
.unwrap_or_else(|err| {
error!("Unknown chained Merkle root: {err:?}");
let chained_merkle_root = if self.slot == bank.parent_slot() {
self.chained_merkle_root
} else {
broadcast_utils::get_chained_merkle_root_from_parent(
bank.slot(),
bank.parent_slot(),
blockstore,
)
.unwrap_or_else(|err: Error| {
error!("Unknown chained Merkle root: {err}");
process_stats.err_unknown_chained_merkle_root += 1;
Hash::default()
});
})
};
self.slot = bank.slot();
self.parent = bank.parent_slot();
self.chained_merkle_root = chained_merkle_root;
Expand Down

0 comments on commit b954a46

Please sign in to comment.