Skip to content

Commit 0788bc5

Browse files
authored
A0-0000: Workaround for updating from version 13 (#1894)
# Description Strongly suggests older nodes to actually download our blocks. ## Type of change - Bug fix (non-breaking change which fixes an issue) # Checklist:
1 parent ea1e23b commit 0788bc5

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

finality-aleph/src/sync/service.rs

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ use crate::{
2020
session::SessionBoundaryInfo,
2121
sync::{
2222
data::{
23-
NetworkData, PreRequest, Request, ResponseItem, ResponseItems, State, VersionWrapper,
24-
VersionedNetworkData,
23+
BranchKnowledge, NetworkData, PreRequest, Request, ResponseItem, ResponseItems, State,
24+
VersionWrapper, VersionedNetworkData,
2525
},
2626
forest::ExtensionRequest,
2727
handler::{Action, DatabaseIO, Error as HandlerError, HandleStateAction, Handler},
@@ -713,7 +713,25 @@ where
713713
}
714714
}
715715

716+
fn hacky_workaround_for_cooperation_with_version_13_during_update(
717+
&mut self,
718+
own_new_header: UnverifiedHeaderFor<J>,
719+
) {
720+
let branch_knowledge = BranchKnowledge::LowestId(own_new_header.id());
721+
// send the request for our newest block to 10 random peers, as long as at least one of
722+
// them is running v13, all the v13s will eventually get the block
723+
for _ in 0..10 {
724+
let pre_request = PreRequest::new(
725+
own_new_header.clone(),
726+
branch_knowledge.clone(),
727+
HashSet::new(),
728+
);
729+
self.send_request(pre_request);
730+
}
731+
}
732+
716733
fn handle_own_block(&mut self, block: B) {
734+
self.hacky_workaround_for_cooperation_with_version_13_during_update(block.header().clone());
717735
match self.handler.handle_own_block(block) {
718736
Ok(maybe_proof) => {
719737
self.process_equivocation_proofs(maybe_proof);

0 commit comments

Comments
 (0)