Skip to content

Commit

Permalink
fix: handle reorg in epoch 3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
hugocaillard committed Sep 27, 2024
1 parent c0524b4 commit bc7eb6b
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions components/stacks-network/src/chains_coordinator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -392,17 +392,10 @@ pub async fn start_chains_coordinator(
unreachable!() // TODO(lgalabru): good enough for now - code path unreachable in the context of Devnet
}
StacksChainEvent::ChainUpdatedWithReorg(data) => {
// looks like in nakamoto we have reorgs, lets try that
let block_id = data
.blocks_to_apply
.last()
.unwrap()
.block
.block_identifier
.index;
let reorg_data = format!("{:#?}", data);
std::fs::write(format!("reorgdata-{block_id}.txt"), reorg_data)
.expect("Failed to write reorg data to file");
// reorgs should not happen in devnet
// tests showed that it can happen in epoch 3.0 but should not
// this patch allows to handle it, but further investigation will be done
// with blockchain team in order to avoid this
devnet_event_tx
.send(DevnetEvent::warning("Stacks reorg received".to_string()))
.expect("Unable to send reorg event");
Expand Down

0 comments on commit bc7eb6b

Please sign in to comment.