File tree Expand file tree Collapse file tree
Sources/BitcoinCore/Classes Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -112,28 +112,29 @@ class BlockchairApiSyncer {
112112 private func handle( error: Error ) {
113113 listener? . onSyncFailed ( error: error)
114114 }
115- }
116115
117- extension BlockchairApiSyncer : IApiSyncer {
118- var willSync : Bool {
119- true
120- }
121-
122- func sync( ) {
116+ private func syncLastBlock( ) {
123117 Task { [ weak self] in
124118 do {
125- try await self ? . scan ( )
119+ try await self ? . _syncLastBlock ( )
126120 } catch {
127121 self ? . handle ( error: error)
128122 }
129123 }
130124 . store ( in: & tasks)
131125 }
126+ }
132127
133- func syncLastBlock( ) {
128+ extension BlockchairApiSyncer : IApiSyncer {
129+ var willSync : Bool {
130+ true
131+ }
132+
133+ func sync( ) {
134134 Task { [ weak self] in
135135 do {
136- try await self ? . _syncLastBlock ( )
136+ try await self ? . scan ( )
137+ self ? . syncLastBlock ( )
137138 } catch {
138139 self ? . handle ( error: error)
139140 }
Original file line number Diff line number Diff line change @@ -91,8 +91,6 @@ extension ApiSyncer: IApiSyncer {
9191 Task { [ weak self] in await self ? . _sync ( ) } . store ( in: & tasks)
9292 }
9393
94- func syncLastBlock( ) { }
95-
9694 func terminate( ) {
9795 tasks = Set ( )
9896 }
Original file line number Diff line number Diff line change @@ -295,7 +295,6 @@ protocol IApiSyncer {
295295 var listener : IApiSyncerListener ? { get set }
296296 var willSync : Bool { get }
297297 func sync( )
298- func syncLastBlock( )
299298 func terminate( )
300299}
301300
Original file line number Diff line number Diff line change @@ -213,7 +213,6 @@ extension SyncManager: IBlockSyncListener {
213213 let forceAddedBlocks = forceAddedBlocksTotal - storage. apiBlockHashesCount
214214
215215 if forceAddedBlocks >= forceAddedBlocksTotal {
216- apiSyncer. syncLastBlock ( )
217216 syncState = . synced
218217 } else {
219218 syncState = . syncing( progress: Double ( forceAddedBlocks) / Double( forceAddedBlocksTotal) )
You can’t perform that action at this time.
0 commit comments