Skip to content

Commit 7fb2f6a

Browse files
committed
[bugfix] Fixing a bug which caused the validator matrix to not have enough validator awareness. This happened in case of a node going down in one era and coming back up in a different one, but being able to apply finality signatures to the era in which it went offline.
1 parent 057cf21 commit 7fb2f6a

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

node/src/reactor/main_reactor/validate.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,22 @@ impl MainReactor {
148148
return Ok(None);
149149
}
150150

151+
// If the node was validating in the previous era there is a chance that it didn't get a
152+
// chance to apply it's finality signature to the last (or some of the last) blocks of that
153+
// era. If that's true - it it might try to do that and for that it needs to have the
154+
// validator matrix updated with appropriate era data.
155+
let number_of_switch_blocks = recent_switch_block_headers.len();
156+
for i in 0..(number_of_switch_blocks - 1) {
157+
if let Some(block) = recent_switch_block_headers.get(i) {
158+
if let Some(validator_weights) = block.next_era_validator_weights() {
159+
self.validator_matrix.register_validator_weights(
160+
block.era_id().successor(),
161+
validator_weights.clone(),
162+
);
163+
}
164+
}
165+
}
166+
151167
if let HighestOrphanedBlockResult::Orphan(highest_orphaned_block_header) =
152168
self.storage.get_highest_orphaned_block_header()
153169
{

0 commit comments

Comments
 (0)