Skip to content
This repository has been archived by the owner on Oct 28, 2022. It is now read-only.

Commit

Permalink
Merge pull request #403 from horizontalsystems/bugfix
Browse files Browse the repository at this point in the history
Notify syncFinished to syncStateListener when peer is synced (#400)
  • Loading branch information
ant013 authored Jun 26, 2019
2 parents 9cd93c4 + a4378f7 commit 31b4bc7
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions BitcoinCore/BitcoinCore/Blocks/InitialBlockDownload.swift
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ public class InitialBlockDownload {
syncedPeers.append(peer)

subject.onNext(.onPeerSynced(peer: peer))
syncStateListener.syncFinished()
}

private func setPeerNotSynced(_ peer: IPeer) {
Expand Down
4 changes: 4 additions & 0 deletions BitcoinCore/BitcoinCore/Core/KitStateProvider.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ extension KitStateProvider: ISyncStateListener {
currentBestBlockHeight = height
}

func syncFinished() {
syncState = .synced
}

func currentBestBlockHeightUpdated(height: Int32, maxBlockHeight: Int32) {
if currentBestBlockHeight < height {
currentBestBlockHeight = height
Expand Down
1 change: 1 addition & 0 deletions BitcoinCore/BitcoinCore/Core/Protocols.swift
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@ protocol IConnectionTimeoutManager: class {
}

protocol ISyncStateListener: class {
func syncFinished()
func syncStarted()
func syncStopped()
func initialBestBlockHeightUpdated(height: Int32)
Expand Down

0 comments on commit 31b4bc7

Please sign in to comment.