bdk icon indicating copy to clipboard operation
bdk copied to clipboard

Improve docs on `ChangeSet` persistence requirements

Open tnull opened this issue 1 year ago • 0 comments

Describe the enhancement
Currently, the docs for bdk_wallet::ChangeSet are not super clear on what requirements implementations of WalletPersister need to fulfill.

In Discord, we established that:

  • Sub-ChangeSets (i.e., local_chain, tx_graph, indexer) may get persisted independently/non-atomically. I.e., in case of a persistence-failure-and-restart scenario subsequent persist calls would deliver sub-ChangeSets that are still mergable. This means that the persisted state wouldn't be corrupted by a persistence failure of one of the sub-ChangeSets.
  • However, the ordering of persistence calls might matter, as "(..) the localchain tip is used by block-by-block chain sources as a reference as to where to sync from, so I would persist that last", i.e., "I would write in this order: indexer, tx_graph, local_chain" (@evanlinjin)

It would be good to add all of these specifics and details to the ChangeSet/WalletPersister docs. Use case
Being able to implement WalletPersister without screwing up.

tnull avatar Sep 12 '24 07:09 tnull