13 Commits

Author SHA1 Message Date
rajarshimaitra
8cd0328eec
[bdk_chain_redesign] Implement OwnedIndexer for indexers
`SpkTxOutIndex` and `KeychainTxOutIndex` now both implement
`OwnedIndexer`.
2023-04-28 19:09:52 +08:00
志宇
81436fcd72
[bdk_chain_redesign] Fix Anchor definition + docs
Previously, I have misunderstood the definition of anchor. If a tx is
anchored in a block, it does not necessarily mean it is confirmed in
that block. The tx can be confirmed in an ancestor block of the anchor
block.

With this new definition, we need a new trait `ConfirmationHeight` that
has one method `confirmation_height`. This trait can be used to extend
`Anchor` for those implementations that can give us the exact
conirmation height of a tx (which is useful in most cases).

Another change is to add another variant to the `ObservedAs` enum;
`ObservedAs::ConfirmedImplicit(A)`. If a tx does not have an anchor, but
another tx that spends it has an anchor that in in the best chain, we
can assume that tx is also in the best chain. The logic of
`TxGraph::try_get_chain_position` is also changed to reflect this.

Some methods from `IndexedTxGraph` have been moved to `TxGraph` as they
do not require the `Indexer`. Some `TxGraph` methods have been renamed
for clarity and consistency.

Also more docs are added.
2023-04-18 00:02:14 +08:00
志宇
10ab77c549
[bdk_chain_redesign] MOVE TxIndex into indexed_chain_graph.rs
`tx_graph.rs` is rearranged as well.
2023-04-12 11:24:05 +08:00
志宇
ddd5e951f5
[bdk_chain_redesign] Modify signature of TxIndex
This makes the API of `TxIndex` more consistent between scanning in data
and checking whether certain data is relevant.
2023-04-05 18:17:08 +08:00
志宇
a63ffe9739
[bdk_chain_redesign] Simplify TxIndex 2023-03-31 13:45:15 +08:00
志宇
d0a2aa83be
[bdk_chain_redesign] Add apply_additions to IndexedTxGraph
* Get mutable index from `IndexedChainGraph`.
* Also add `apply_additions` method to `TxIndex` trait.
2023-03-27 16:02:21 +08:00
志宇
43b648fee0
[bdk_chain_redesign] Add ..in_chain methods
Add methods to `TxGraph` and `IndexedTxGraph` that gets in-best-chain
data (such as transactions, txouts, unspent txouts).
2023-03-27 12:42:59 +08:00
志宇
61a8606fbc
[bdk_chain_redesign] Introduce ChainOracle and TxIndex traits
The chain oracle keeps track of the best chain, while the transaction
index indexes transaction data in relation to script pubkeys.

This commit also includes initial work on `IndexedTxGraph`.
2023-03-26 11:03:35 +08:00
rajarshimaitra
24df03afd6
Add documentation fixes 2023-03-15 13:00:45 +08:00
Steve Myers
38ef170ed1
Make bdk and bdk_chain work under 1.57.0
- rewrite some parts of the code to deal with older borrow checker
- downgraded hashbrown
2023-03-03 17:44:09 +01:00
Daniela Brozzoni
c61b3604e1
Fix cargo clippy warnings
Disabled warnings for nursery/tmp_plan as it's going to be replaced
anyways
2023-03-03 17:44:03 +01:00
Daniela Brozzoni
303a1703c9
Rust fmt 2023-03-02 12:27:52 +01:00
Daniela Brozzoni
37dfa77d9d
Move bdk_chain into the bdk repo 🎉
Original repository: 250b4f1dcc/bdk_chain

Co-authored-by: Steve Myers <steve@notmandatory.org>
Co-authored-by: 志宇 <hello@evanlinjin.me>
Co-authored-by: LLFourn <lloyd.fourn@gmail.com>
Co-authored-by: rajarshimaitra <rajarshi149@gmail.com>
Co-authored-by: LagginTimes <wzc110@gmail.com>
Co-authored-by: Steve Myers <steve@notmandatory.org>
Co-authored-by: Vladimir Fomene <vladimirfomene@gmail.com>
2023-03-02 10:56:33 +01:00