Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge hot fix 37.2 #643

Merged
merged 3 commits into from
Jan 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading