Giter Site home page Giter Site logo

Comments (8)

rajarshimaitra avatar rajarshimaitra commented on July 28, 2024 1

I am working on this next..

from bdk_core_staging.

LLFourn avatar LLFourn commented on July 28, 2024

Side note this means removing insert_txid from chain graph since this is incompatible with this design.

from bdk_core_staging.

evanlinjin avatar evanlinjin commented on July 28, 2024

We want to have the chaingraph enforce that for every txid in sparse_chain there is a full tx in the graph. To do this we'll have to make those fields private and we'll have to have an error case when the changeset is applied.

For the rules of applying the changeset, I think as long as the update chain's txid is included in either graphs (whether it be in original or the update) we can allow the update.

This allows the following logic:

  1. Grab txids of given scriptPubKeys.
  2. Formulate initial update (nothing in txgraph).
  3. Find missing transactions (by looking at original graph).
  4. Fetch missing transactions and add to update's graph.
  5. Apply update chaingraph (which does not contain full txs of every txid mentioned in update.chain, but collectively with the original chaingraph, all txs will exist).

from bdk_core_staging.

LLFourn avatar LLFourn commented on July 28, 2024

@evanlinjin I think we should provide this guarantee as the API can result in unintentional unwraps when you think a full tx should be there but it isn't. For electrum I don't think the update process should start with a ChainGraph at all:

  1. grab txids of given script pubkeys.
  2. Figure out which of these we need full transactions for i.e. return something like a HashSet<Txid> or maybe a Vec<(Txid, I)> where I is TxHeight in this case.
  3. Fetch those full transactions and transform them into ChainGraph<TxHeight> with only the transactions in missing set.
  4. Apply the ChainGraph.

from bdk_core_staging.

evanlinjin avatar evanlinjin commented on July 28, 2024

@LLFourn what about transactions being confirmed? Because they might already exist in the mempool of the original chain

from bdk_core_staging.

LLFourn avatar LLFourn commented on July 28, 2024

@evanlinjin the update ChainGraph<TxHeight> will have the updated height of the transactions. I don't see a problem. The TxHeight of the transaction in the original chain is ignored as part of this. We only care whether it is present in the original ChainGraph or not.

from bdk_core_staging.

LLFourn avatar LLFourn commented on July 28, 2024

The best way to go about this might be to do electrum with the current API first. It's not too hard to figure out which transactions are missing and you need to fetch with the current API. Once we can see what that looks like we can try and optimize both the electurm API and the chaingraph API to make it simple to document and explain,

from bdk_core_staging.

rajarshimaitra avatar rajarshimaitra commented on July 28, 2024

For ref, I tried the electrum sync with existing API in #77 ..

from bdk_core_staging.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.