@@ -37,7 +37,6 @@ pub struct StateSync {
37
37
prev_state_sync : Option < DateTime < Utc > > ,
38
38
state_sync_peer : Option < Arc < Peer > > ,
39
39
40
- pibd_aborted : bool ,
41
40
earliest_zero_pibd_peer_time : Option < DateTime < Utc > > ,
42
41
}
43
42
@@ -53,16 +52,10 @@ impl StateSync {
53
52
chain,
54
53
prev_state_sync : None ,
55
54
state_sync_peer : None ,
56
- pibd_aborted : false ,
57
55
earliest_zero_pibd_peer_time : None ,
58
56
}
59
57
}
60
58
61
- /// Flag to abort PIBD process
62
- pub fn set_pibd_aborted ( & mut self ) {
63
- self . pibd_aborted = true ;
64
- }
65
-
66
59
/// Record earliest time at which we had no suitable
67
60
/// peers for continuing PIBD
68
61
pub fn set_earliest_zero_pibd_peer_time ( & mut self , t : Option < DateTime < Utc > > ) {
@@ -94,20 +87,10 @@ impl StateSync {
94
87
95
88
// Determine whether we're going to try using PIBD or whether we've already given up
96
89
// 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
+ ) ;
111
94
112
95
// Check whether we've errored and should restart pibd
113
96
if using_pibd {
@@ -332,7 +315,6 @@ impl StateSync {
332
315
. update_pibd_progress ( true , true , 0 , 1 , & archive_header) ;
333
316
self . sync_state
334
317
. set_sync_error ( chain:: Error :: AbortingPIBDError ) ;
335
- self . set_pibd_aborted ( ) ;
336
318
return false ;
337
319
}
338
320
} else {
0 commit comments