-
Notifications
You must be signed in to change notification settings - Fork 47
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
Add compact block filter client via Kyoto #591
base: master
Are you sure you want to change the base?
Conversation
Just for fun: Binary size when including Kyoto, building the aarch64 binary on macOS using the release-smaller profile (libbdkffi.dylib): 9.7MB Not bad at all for what is likely to be one of the most popular clients one day. |
Awesome thank you for checking that out. Props to |
9433c63
to
d391af5
Compare
d391af5
to
44b0dea
Compare
44b0dea
to
a12ab3e
Compare
f64bfbb
to
48cbd2a
Compare
You can imagine my disappointment with this error message after hacking on this PR again. I'm trying to express the new It's been so long but maybe that is what I had in mind with the callback interface in the first place lol. Open to new ideas, but until we can return objects from enum variants I think we may have to stick with callbacks... |
f57905a
to
4609fe1
Compare
I consider this ready for review now. Some updates, I added live tests for android, JVM, swift, and python. Users now have to build a Do we really need a separate live test in android when the JVM one exists? It's basically the exact same code and it would likely just increase the maintenance burden for no real benefit IMO. Should I add docstrings? I think so, but I wanted to confirm |
To answer your questions @rustaceanrob:
Awesome! I'll try to review this again next week. |
8861ae8
to
31653bd
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just writing down some stuff as I build and test.
I got it working on the Android example wallet! So far so good. I'll take a closer look at the code before giving the final ACK. My first little API-related comment is that the At the moment this is what I do to pull the new blocks out of the events: override fun dialog(dialog: String) {
if (dialog.contains("peer height")) {
val height = dialog.split("peer height: ")[1].split(" ")[0]
triggerSnackbar("New block mined: $height")
}
} Which is basically a custom parsing of the string just to get what I need. I wonder if a Just to showcase my use of it, here is the simple version of the idea, where a snackbar shows when new blocks are mined: new-blocks.mp4 |
The best known peer height is found when connecting to a peer, but our height may not yet match theirs yet. The For reference, I believe you can achieve the same effect in terms of the client height by using |
31653bd
to
3531825
Compare
Oh sweet yes I had not looked at all the methods carefully enough. It was easy to update the app to use that instead. 👍 |
Clean up from the call:
I also got fixated on |
cf0eb71
to
2f1a80d
Compare
2344bdc
to
b81c548
Compare
Rebased and updated to Also introduced, I think that is a preferable and unambiguous API, but will still get feedback before I change this PR |
4a6f9f7
to
b5b3fa5
Compare
5ca066c
to
d1b98fd
Compare
Small note: the Android library is missing a dependency on the implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.8.1") |
3cb4250
to
54fc561
Compare
Added to |
Thanks to @thunderbiscuit for getting the work started initially.
54fc561
to
f83ff3e
Compare
Description
Adds a compact block filter backend via Kyoto.
Notes to the reviewers
This description has been updated to the latest forced push as of Jan 29
Architectural notes:
The language semantics of Rust make it difficult to access the same type in two different place within a project. Due to this the
bdk_kyoto
"client" is separated into smaller component types that handle logs, warnings, and wallet updates. Because the target languages for the bindings are garbage collected/reference counted, I think it is an advantage to unite all of these parts into a singleClient
type. When a user builds a new node, they receive aLightNode
andClient
.The
LightNode
must be run to do anything, and a user would do so withLightNode.run()
.The
Client
is responsible for everything else:next_log
Update
Taking into account previous conversations, this was conveyed as a more intuitive approach than using callbacks to handle events.
Some additions in particular:
add_revealed_scripts
that uses a&Wallet
. This would be called after a user creates a transaction or reveals a receiving addressis_running
function to check on the nodeScanType
. This is to prevent dangerous guess-work when building the client. When creating a new wallet, all that should occur is a quick sync to add the tip of the blockchain and addition of this block hash to the wallet database. This is accomplished withScanType::New
. Recoveries are handled withScanType::Recovery
where the user can select a particular height to scan from. Lastly, syncing from the last known block hash by the wallet is accomplished withScanType::Sync
, which is the default.Changelog notice
Checklists
All Submissions:
cargo fmt
andcargo clippy
before committingNew Features:
Bugfixes: