Comments (8)
I am working on this next..
from bdk_core_staging.
Side note this means removing insert_txid
from chain graph since this is incompatible with this design.
from bdk_core_staging.
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:
- Grab txids of given scriptPubKeys.
- Formulate initial update (nothing in txgraph).
- Find missing transactions (by looking at original graph).
- Fetch missing transactions and add to update's graph.
- 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.
@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:
- grab txids of given script pubkeys.
- Figure out which of these we need full transactions for i.e. return something like a
HashSet<Txid>
or maybe aVec<(Txid, I)>
whereI
isTxHeight
in this case. - Fetch those full transactions and transform them into
ChainGraph<TxHeight>
with only the transactions in missing set. - Apply the
ChainGraph
.
from bdk_core_staging.
@LLFourn what about transactions being confirmed? Because they might already exist in the mempool of the original chain
from bdk_core_staging.
@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.
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.
For ref, I tried the electrum sync with existing API in #77 ..
from bdk_core_staging.
Related Issues (20)
- `KeychainTxOutIndex::script_pubkeys_of_keychain` might be broken HOT 1
- Inflate_changeset must not produce a changeset that has conflicts HOT 3
- Add `TxGraph` fee test with missing inputs
- new address and next_unused should return a changeset HOT 1
- Add more cases for `append_keychain_derivation_indices` test
- Testing blockchain examples HOT 7
- "ChangeSet" API is error prone in multi-threaded contexts HOT 1
- Inflate_changeset is unsound in multi-threaded contexts
- KeychainTxOutIndex should look ahead
- Make CLI output nice HOT 2
- Esplora and Electrum should not have Reorg error
- Add async API for esplora HOT 2
- Allow marking utxos as "spent" even when they're not HOT 3
- Decide on MSRV for bdk_chain HOT 4
- Add KeychainTxOutIndex::reserve_next_unused_spk
- `KeychainTracker` should be `Tracker<T>`
- Iterators over spks should have their own iterator type
- Applying block APIs
- Extract file_store out of bdk_chain
- ARCHIVE THIS REPO
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bdk_core_staging.