Adapt to lightning-block-sync API changes#874
Adapt to lightning-block-sync API changes#874jkczyz wants to merge 2 commits intolightningdevkit:mainfrom
lightning-block-sync API changes#874Conversation
|
I've assigned @tnull as a reviewer! |
lightning-block-sync API changes
There was a problem hiding this comment.
Thanks for looking into this, unfortunately bindings are currently broken.
Hmm, so, it seems lightningdevkit/rust-lightning#4266 fundamentally broke what BestBlock used to mean, i.e., being a simple data type for the chain tip. Really not loving the change, but I probably should have spoken up on that PR.
@TheBlueMatt any thoughts on still creating a new type for the 'best-sub-chain' that BestBlock now represents and switching the LDK APIs to that in a follow-up to lightningdevkit/rust-lightning#4266, rather than completely changing BestBlock semantics?
In any case, we need to figure something out as the changes currently broke our bindings, and the changes in BestBlock simply can't be exposed via uniffi as-is. I guess we could duplicate the old BestBlock code in this repo, but I'd really prefer if we could revert BestBlock and just use a new type for the semantics.
I don't understand this? A |
For one it's a misnomer / unexpected API now. If something is called It's also unnecessarily inefficient for many cases, as we for example now clone a bunch of
Thankfully it's just a few hashes, not the full
Yeah, fair if we don't deem the inefficiency the additional clones fixing, but from my point of view a more intuitive name would still be worth adopting (before the 0.3 release), even if we just move the old If we think |
350bb80 to
3841a65
Compare
Update to use the new HeaderCache type instead of implementing the Cache trait, pass BestBlock instead of BlockHash to synchronize_listeners, and pass HeaderCache by value to SpvClient::new. Also adapt to BestBlock gaining a previous_blocks field and ChannelManager deserialization returning BestBlock instead of BlockHash. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
UniFFI cannot represent the fixed-size array that upstream's BestBlock carries via `previous_blocks`, so NodeStatus.current_best_block was unusable from Swift, Kotlin, and Python once upstream added that field. Introduce a small ldk-node BestBlock with just hash and height — the pieces bindings can handle — and expose it in place of the upstream type on the public API. Generated with assistance from Claude Code. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
3841a65 to
1f99308
Compare
|
Discussed offline. We'll @TheBlueMatt will rename upstream's |
|
BTW, we'll probably want to merge this rather than wait on the upstream change since another breaking change (updated in #878) is already upstream. |
Update to use the new
HeaderCachetype instead of implementing theCachetrait, passBestBlockinstead ofBlockHashto synchronize_listeners, and passHeaderCacheby value toSpvClient::new.Also adapt to
BestBlockgaining aprevious_blocksfield andChannelManagerdeserialization returningBestBlockinstead ofBlockHash.These changes are from lightningdevkit/rust-lightning#4266.