LLFourn / bdk_core_staging

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

Make TxGraph Error free #134

Closed LLFourn closed 1 year ago

LLFourn commented 1 year ago

commits:

  1. Add test for bug I found where ChainGraph would be OK with the TxGraph only having txout for the chain transaction rather than a full transaction.
  2. Removes error case from TxGraph's API. See #132
  3. Checks for conflicts in ChainGraph::apply_changeset

Note: we currently check for conflicts in the changeset with the chain graph's own state but not within the changeset itself which can lead to an inconsistent ChainGraph (conflicting txs).

Fixes #132

evanlinjin commented 1 year ago

@LLFourn What was the conclusion of our talk this morning? Are we planning to include or exclude all errors, or have the ability to check Additions for any non-monotone changes?

As non-monotone behavior of TxGraph will result in non-monotonicity of structures such as TxOutIndex and ChainGraph (that depend on TxGraph).

LLFourn commented 1 year ago

@evanlinjin Since we model the blockchain data source as always giving correct info in general I think we should just not have error cases when the blockchain contradicts itself for now. I think the right way to solve this for users who want guarantees that this can't happen is to use full transactions only.

LLFourn commented 1 year ago

In the end @evanlinjin and I decided to remove this conflict resolution stuff in apply changeset and follow the approach that "apply changeset" is only safe if you got the changeset from the creation method itself. This keeps this simpler for now.