Open LLFourn opened 1 year ago
Discussed in dev call today and this will be addressed after the alpha milestone since it can be done without affecting the bdk_wallet
API.
This I think shouldn't be done in beta but rather 2.0.0. LocalChain
will suffice for now and we can introduce a BlockGraph
as a drop in replacement later on.
After #937 all changsets are monotone except for
LocalChain
. After #1002 it becomes much easier to makeLocalChain
monotone too. The reason you want this is so that changesets can be applied in any order. Without this the user's application has to make sure each changeset is applied to the persistence baclkend in order and so should lock the backend and the chain until it has successfully written to disk.The approach to doing this is simple: Make it possible to insert chain data that does not necessarily connect to the existing chain when applying a changeset. Rather just make sense of each fact provided by a changeset i.e. "at this height there existed a block with this hash which was a child of a block at this height with this hash" etc. This allows
LocalChain
to keep track of multiple chains and have multiple tips. it only needs to index by height the longest one (with tiebreak by blockhash -- verify this claim with respect to consensus rules I think you will find this is a good enough approximation).This doesn't need to be done before
1.0-alpha.1
but should be done before1.0