LLFourn / bdk_core_staging

Staging area for bdk_core initial development
15 stars 12 forks source link

Make `SparseChain` apply_changeset return error in the case it tries to insert a tx after latest checkpoint. #131

Closed LLFourn closed 1 year ago

LLFourn commented 1 year ago

We have down the route of not allowing inconsistent changes in apply_changeset in chain graph. I think this is the right way. For better or worse applications may generate their own changesets. We shouldn't allow inserting a tx at a position higher than the latest checkpoint even in apply changeset.

Note we should not check here whether a tx has moved without having changed the block hash it was previously in. That would be overkill and make the whole system less flexible. We just want to make sure that you aren't able to violate the invariants we want to enforce through the changeset APIs.

evanlinjin commented 1 year ago

What invariants do we want to enforce through the changeset APIs?

LLFourn commented 1 year ago

None right now.