bdk icon indicating copy to clipboard operation
bdk copied to clipboard

core: allow serialization of SyncResponse

Open icota opened this issue 7 months ago • 3 comments

Description

The rationale behind this is to allow a separate instance of the same wallet be updated on a device that's not necessarily connected. Like a hardware wallet.

A connected device gets the response, serializes it with serde and passes the Update to the air-gapped one

Checklists

All Submissions:

  • [x] I've signed all my commits
  • [x] I followed the contribution guidelines
  • [x] I ran cargo fmt and cargo clippy before committing

icota avatar May 09 '25 15:05 icota

@icota have you considered using ChangeSets instead? Serializing CheckPoints is a bit odd since it is a linked list and the resultant serialization would be super nested.

Also updates may have repeated elements, whereas ChangeSets only include what is changed.

evanlinjin avatar May 14 '25 04:05 evanlinjin

@icota have you considered using ChangeSets instead?

No, I have not. Are you suggesting I use staged after apply_update to get the ChangeSet? How do I apply that on the other side?

icota avatar May 14 '25 07:05 icota

@icota Yes. That is a good point about applying it on the other side. I forgot that bdk_wallet::Wallet does not have an apply_changeset method (whereas the core structures from bdk_chain do).

Just made a draft PR to add Wallet::apply_changeset: https://github.com/bitcoindevkit/bdk_wallet/pull/231

evanlinjin avatar May 15 '25 05:05 evanlinjin