Skip to content

Commit 66f4943

Browse files
committed
Refactor block::Extension::transtition_to_full()
1 parent bbbf439 commit 66f4943

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
@@ -467,9 +467,8 @@ impl NetworkExtension<Event> for Extension {
467467
if let Some(root) = restore.next_to_feed() {
468468
self.send_chunk_request(&block, &root);
469469
} else {
470-
cdebug!(SYNC, "Transitioning state to {:?}", State::Full);
471470
self.client.force_update_best_block(&block);
472-
self.state = State::Full;
471+
self.transition_to_full();
473472
}
474473
}
475474
State::Full => {
@@ -1041,12 +1040,16 @@ impl Extension {
10411040
if let Some(root) = restore.next_to_feed() {
10421041
self.send_chunk_request(&block, &root);
10431042
} else {
1044-
cdebug!(SYNC, "Transitioning state to {:?}", State::Full);
10451043
self.client.force_update_best_block(&block);
1046-
self.state = State::Full;
1044+
self.transition_to_full();
10471045
}
10481046
}
10491047
}
1048+
1049+
fn transition_to_full(&mut self) {
1050+
cdebug!(SYNC, "Transitioning state to {:?}", State::Full);
1051+
self.state = State::Full;
1052+
}
10501053
}
10511054

10521055
pub struct BlockSyncSender(EventSender<Event>);

0 commit comments

Comments
 (0)