Skip to content

Commit 3761a44

Browse files
foriequal0remagpie
authored andcommitted
Refactor block::Extension::transtition_to_full()
1 parent 1cefe89 commit 3761a44

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

sync/src/block/extension.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -444,9 +444,8 @@ impl NetworkExtension<Event> for Extension {
444444
if let Some(root) = restore.next_to_feed() {
445445
self.send_chunk_request(&block, &root);
446446
} else {
447-
cdebug!(SYNC, "Transitioning state to {:?}", State::Full);
448447
self.client.force_update_best_block(&block);
449-
self.state = State::Full;
448+
self.transition_to_full();
450449
}
451450
}
452451
State::Full => {
@@ -1037,12 +1036,16 @@ impl Extension {
10371036
if let Some(root) = restore.next_to_feed() {
10381037
self.send_chunk_request(&block, &root);
10391038
} else {
1040-
cdebug!(SYNC, "Transitioning state to {:?}", State::Full);
10411039
self.client.force_update_best_block(&block);
1042-
self.state = State::Full;
1040+
self.transition_to_full();
10431041
}
10441042
}
10451043
}
1044+
1045+
fn transition_to_full(&mut self) {
1046+
cdebug!(SYNC, "Transitioning state to {:?}", State::Full);
1047+
self.state = State::Full;
1048+
}
10461049
}
10471050

10481051
pub struct BlockSyncSender(EventSender<Event>);

0 commit comments

Comments
 (0)