@@ -90,36 +90,37 @@ class SyncStateSchedulerActor(
90
90
self ! BloomFilterResult (value)
91
91
}
92
92
93
- def waitingForBloomFilterToLoad (lastReceivedCommand : Option [(SyncStateSchedulerActorCommand , ActorRef )]): Receive = {
94
- case BloomFilterResult (result) =>
95
- log.debug(
96
- s " Loaded ${result.writtenElements} already known elements from storage to bloom filter the error while loading " +
97
- s " was ${result.error}"
98
- )
99
- lastReceivedCommand match {
100
- case Some ((startSignal : StartSyncingTo , sender)) =>
101
- val initStats = ProcessingStatistics ().addSaved(result.writtenElements)
102
- val initState = startSyncing(startSignal.stateRoot, startSignal.blockNumber)
103
- context become (syncing(
104
- initState,
105
- DownloaderState (),
106
- initStats,
107
- startSignal.blockNumber,
108
- sender,
109
- Queue (),
110
- processing = false ,
111
- None
112
- ))
113
- case Some ((restartSignal : RestartRequested .type , sender)) =>
114
- sender ! WaitingForNewTargetBlock
115
- context.become(idle(ProcessingStatistics ().addSaved(result.writtenElements)))
116
- case _ =>
117
- context.become(idle(ProcessingStatistics ().addSaved(result.writtenElements)))
118
- }
93
+ def waitingForBloomFilterToLoad (lastReceivedCommand : Option [(SyncStateSchedulerActorCommand , ActorRef )]): Receive =
94
+ handleCommonMessages orElse {
95
+ case BloomFilterResult (result) =>
96
+ log.debug(
97
+ s " Loaded ${result.writtenElements} already known elements from storage to bloom filter the error while loading " +
98
+ s " was ${result.error}"
99
+ )
100
+ lastReceivedCommand match {
101
+ case Some ((startSignal : StartSyncingTo , sender)) =>
102
+ val initStats = ProcessingStatistics ().addSaved(result.writtenElements)
103
+ val initState = startSyncing(startSignal.stateRoot, startSignal.blockNumber)
104
+ context become (syncing(
105
+ initState,
106
+ DownloaderState (),
107
+ initStats,
108
+ startSignal.blockNumber,
109
+ sender,
110
+ Queue (),
111
+ processing = false ,
112
+ None
113
+ ))
114
+ case Some ((restartSignal : RestartRequested .type , sender)) =>
115
+ sender ! WaitingForNewTargetBlock
116
+ context.become(idle(ProcessingStatistics ().addSaved(result.writtenElements)))
117
+ case _ =>
118
+ context.become(idle(ProcessingStatistics ().addSaved(result.writtenElements)))
119
+ }
119
120
120
- case command : SyncStateSchedulerActorCommand =>
121
- context.become(waitingForBloomFilterToLoad(Some ((command, sender()))))
122
- }
121
+ case command : SyncStateSchedulerActorCommand =>
122
+ context.become(waitingForBloomFilterToLoad(Some ((command, sender()))))
123
+ }
123
124
124
125
private def startSyncing (root : ByteString , bn : BigInt ): SchedulerState = {
125
126
timers.startTimerAtFixedRate(PrintInfoKey , PrintInfo , 30 .seconds)
@@ -130,7 +131,7 @@ class SyncStateSchedulerActor(
130
131
initState
131
132
}
132
133
133
- def idle (processingStatistics : ProcessingStatistics ): Receive = {
134
+ def idle (processingStatistics : ProcessingStatistics ): Receive = handleCommonMessages orElse {
134
135
case StartSyncingTo (root, bn) =>
135
136
val state1 = startSyncing(root, bn)
136
137
context become (syncing(
0 commit comments