Skip to content

Commit 0649ba9

Browse files
authored
'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
1 parent f6b3d5a commit 0649ba9

File tree

1 file changed

+4
-22
lines changed

1 file changed

+4
-22
lines changed

servers/src/grin/sync/state_sync.rs

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ pub struct StateSync {
3737
prev_state_sync: Option<DateTime<Utc>>,
3838
state_sync_peer: Option<Arc<Peer>>,
3939

40-
pibd_aborted: bool,
4140
earliest_zero_pibd_peer_time: Option<DateTime<Utc>>,
4241
}
4342

@@ -53,16 +52,10 @@ impl StateSync {
5352
chain,
5453
prev_state_sync: None,
5554
state_sync_peer: None,
56-
pibd_aborted: false,
5755
earliest_zero_pibd_peer_time: None,
5856
}
5957
}
6058

61-
/// Flag to abort PIBD process
62-
pub fn set_pibd_aborted(&mut self) {
63-
self.pibd_aborted = true;
64-
}
65-
6659
/// Record earliest time at which we had no suitable
6760
/// peers for continuing PIBD
6861
pub fn set_earliest_zero_pibd_peer_time(&mut self, t: Option<DateTime<Utc>>) {
@@ -94,20 +87,10 @@ impl StateSync {
9487

9588
// Determine whether we're going to try using PIBD or whether we've already given up
9689
// on it
97-
let using_pibd =
98-
if let SyncStatus::TxHashsetPibd { aborted: true, .. } = self.sync_state.status() {
99-
false
100-
} else if self.pibd_aborted {
101-
false
102-
} else {
103-
// Only on testing chains for now
104-
if global::get_chain_type() != global::ChainTypes::Mainnet {
105-
true
106-
//false
107-
} else {
108-
false
109-
}
110-
};
90+
let using_pibd = !matches!(
91+
self.sync_state.status(),
92+
SyncStatus::TxHashsetPibd { aborted: true, .. },
93+
);
11194

11295
// Check whether we've errored and should restart pibd
11396
if using_pibd {
@@ -332,7 +315,6 @@ impl StateSync {
332315
.update_pibd_progress(true, true, 0, 1, &archive_header);
333316
self.sync_state
334317
.set_sync_error(chain::Error::AbortingPIBDError);
335-
self.set_pibd_aborted();
336318
return false;
337319
}
338320
} else {

0 commit comments

Comments
 (0)