Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'Turn on' PIBD on main-net, in advance of 5.2.0 release #3750

Merged
merged 5 commits into from
Jun 6, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 4 additions & 22 deletions servers/src/grin/sync/state_sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ pub struct StateSync {
prev_state_sync: Option<DateTime<Utc>>,
state_sync_peer: Option<Arc<Peer>>,

pibd_aborted: bool,
earliest_zero_pibd_peer_time: Option<DateTime<Utc>>,
}

Expand All @@ -53,16 +52,10 @@ impl StateSync {
chain,
prev_state_sync: None,
state_sync_peer: None,
pibd_aborted: false,
earliest_zero_pibd_peer_time: None,
}
}

/// Flag to abort PIBD process
pub fn set_pibd_aborted(&mut self) {
self.pibd_aborted = true;
}

/// Record earliest time at which we had no suitable
/// peers for continuing PIBD
pub fn set_earliest_zero_pibd_peer_time(&mut self, t: Option<DateTime<Utc>>) {
Expand Down Expand Up @@ -94,20 +87,10 @@ impl StateSync {

// Determine whether we're going to try using PIBD or whether we've already given up
// on it
let using_pibd =
if let SyncStatus::TxHashsetPibd { aborted: true, .. } = self.sync_state.status() {
false
} else if self.pibd_aborted {
false
} else {
// Only on testing chains for now
if global::get_chain_type() != global::ChainTypes::Mainnet {
true
//false
} else {
false
}
};
let using_pibd = !matches!(
self.sync_state.status(),
SyncStatus::TxHashsetPibd { aborted: true, .. },
);

// Check whether we've errored and should restart pibd
if using_pibd {
Expand Down Expand Up @@ -332,7 +315,6 @@ impl StateSync {
.update_pibd_progress(true, true, 0, 1, &archive_header);
self.sync_state
.set_sync_error(chain::Error::AbortingPIBDError);
self.set_pibd_aborted();
return false;
}
} else {
Expand Down