Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/hotfix-37.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
omurovch committed Jan 22, 2024
2 parents 4956962 + 662d6dc commit b455b3a
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,17 +46,6 @@ class BlockchairApiSyncer(
}
}

override fun syncLastBlock() {
syncLastBlockSingle()
.subscribeOn(Schedulers.io())
.observeOn(Schedulers.io())
.subscribe({}, {
handleError(it)
}).let {
disposables.add(it)
}
}

override fun terminate() {
disposables.clear()
}
Expand All @@ -66,7 +55,7 @@ class BlockchairApiSyncer(
listener?.onSyncFailed(error)
}

private fun syncLastBlockSingle(): Single<Unit> = Single.create {
private fun fetchLastBlock() {
val blockHeaderItem = lastBlockProvider.lastBlockHeader()
val header = BlockHeader(
version = 0,
Expand All @@ -85,6 +74,7 @@ class BlockchairApiSyncer(
val allKeys = storage.getPublicKeys()
val stopHeight = storage.downloadedTransactionsBestBlockHeight()
fetchRecursive(allKeys, allKeys, stopHeight)
fetchLastBlock()

apiSyncStateManager.restored = true
listener?.onSyncSuccess()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,6 @@ class ApiSyncer(
disposables.add(disposable)
}

override fun syncLastBlock() {}

private fun handle(keys: List<PublicKey>, blockHashes: List<BlockHash>) {
publicKeyManager.addKeys(keys)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,6 @@ interface IApiSyncer {
val willSync: Boolean

fun sync()
fun syncLastBlock()
fun terminate()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,6 @@ class SyncManager(
val forceAddedBlocks = forceAddedBlocksTotal - storage.getApiBlockHashesCount()
syncState = when {
forceAddedBlocks >= forceAddedBlocksTotal -> {
apiSyncer.syncLastBlock()
KitState.Synced
}

Expand Down

0 comments on commit b455b3a

Please sign in to comment.