Add test of sync callbacks#1022
Draft
thunderbiscuit wants to merge 1 commit into
Draft
Conversation
Member
Author
|
Just putting this here to remember: our current implementation of the callback for sync is not perfect, because if you just want to know how many scripts are being synced, you need to do a bit of workaround to do it instead of just pulling the data out of the type. This is not an issue at the ffi layer but the Rust layer. Issue here: bitcoindevkit/bdk#2220. Currently logging the number of scripts being synced for Tatooine with this (works but is clearly not great). class SyncCallback : SyncScriptInspector {
private val logger = KotlinLogging.logger {}
var totalSynced = 0
// On the first run of the callback, log the number of scripts that will be inspected.
override fun inspect(script: Script, total: ULong) {
if (totalSynced == 0) logger.info { "Syncing $total scripts in this sync" }
totalSynced++
}
}Note that this triggers only once the sync is started, and so the number of scripts is unknown until the sync starts. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
WIP. I'd like to add one for the
FullScanScriptInspectoras well.Description
Notes to the reviewers
Documentation
bdk_walletbitcoinuniffiChangelog
Checklists
All Submissions:
cargo fmtandcargo clippybefore committingchangelog:*labelNew Features:
Bugfixes: