mirror of
https://github.com/mimblewimble/grin.git
synced 2025-01-20 19:11:08 +03:00
'Turn on' PIBD on main-net, in advance of 5.2.0 release (#3750)
* remove non-mainnet check for PIBD requests * remove surplus flag * use matches! macro * fix match logic * correct match logic
This commit is contained in:
parent
f6b3d5a8f6
commit
0649ba9645
1 changed files with 4 additions and 22 deletions
|
@ -37,7 +37,6 @@ pub struct StateSync {
|
||||||
prev_state_sync: Option<DateTime<Utc>>,
|
prev_state_sync: Option<DateTime<Utc>>,
|
||||||
state_sync_peer: Option<Arc<Peer>>,
|
state_sync_peer: Option<Arc<Peer>>,
|
||||||
|
|
||||||
pibd_aborted: bool,
|
|
||||||
earliest_zero_pibd_peer_time: Option<DateTime<Utc>>,
|
earliest_zero_pibd_peer_time: Option<DateTime<Utc>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,16 +52,10 @@ impl StateSync {
|
||||||
chain,
|
chain,
|
||||||
prev_state_sync: None,
|
prev_state_sync: None,
|
||||||
state_sync_peer: None,
|
state_sync_peer: None,
|
||||||
pibd_aborted: false,
|
|
||||||
earliest_zero_pibd_peer_time: None,
|
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
|
/// Record earliest time at which we had no suitable
|
||||||
/// peers for continuing PIBD
|
/// peers for continuing PIBD
|
||||||
pub fn set_earliest_zero_pibd_peer_time(&mut self, t: Option<DateTime<Utc>>) {
|
pub fn set_earliest_zero_pibd_peer_time(&mut self, t: Option<DateTime<Utc>>) {
|
||||||
|
@ -94,20 +87,10 @@ impl StateSync {
|
||||||
|
|
||||||
// Determine whether we're going to try using PIBD or whether we've already given up
|
// Determine whether we're going to try using PIBD or whether we've already given up
|
||||||
// on it
|
// on it
|
||||||
let using_pibd =
|
let using_pibd = !matches!(
|
||||||
if let SyncStatus::TxHashsetPibd { aborted: true, .. } = self.sync_state.status() {
|
self.sync_state.status(),
|
||||||
false
|
SyncStatus::TxHashsetPibd { aborted: true, .. },
|
||||||
} 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
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// Check whether we've errored and should restart pibd
|
// Check whether we've errored and should restart pibd
|
||||||
if using_pibd {
|
if using_pibd {
|
||||||
|
@ -332,7 +315,6 @@ impl StateSync {
|
||||||
.update_pibd_progress(true, true, 0, 1, &archive_header);
|
.update_pibd_progress(true, true, 0, 1, &archive_header);
|
||||||
self.sync_state
|
self.sync_state
|
||||||
.set_sync_error(chain::Error::AbortingPIBDError);
|
.set_sync_error(chain::Error::AbortingPIBDError);
|
||||||
self.set_pibd_aborted();
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue