Skip to content

Commit

Permalink
fix: reset subdag index when epoch changes
Browse files Browse the repository at this point in the history
  • Loading branch information
daltoncoder committed May 29, 2024
1 parent d412bad commit 94dbfe3
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions core/application/src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -850,10 +850,14 @@ impl<B: Backend> State<B> {
// increment epoch
current_epoch += 1;

// Set the new committee, epoch, and reset sub dag index
self.committee_info.set(current_epoch, new_committee);

self.metadata
.set(Metadata::Epoch, Value::Epoch(current_epoch));
// epoch is changing so a new committee starts and subdag starts back at 0
self.metadata
.set(Metadata::SubDagIndex, Value::SubDagIndex(0));
TransactionResponse::Success(ExecutionData::EpochChange)
} else {
self.committee_info.set(current_epoch, current_committee);
Expand Down

0 comments on commit 94dbfe3

Please sign in to comment.