-
Notifications
You must be signed in to change notification settings - Fork 307
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introduce redesigned bdk_chain
structures
#926
Introduce redesigned bdk_chain
structures
#926
Commits on Mar 24, 2023
-
[bdk_chain_redesign] Introduce
BlockAnchor
trait* Introduce `GraphedTx` struct to access transaction data of graphed transactions. * Ability to insert/access anchors and "seen at" values for graphed transactions. * `Additions` now records changes to anchors and last_seen_at.
Configuration menu - View commit details
-
Copy full SHA for 5ae5fe3 - Browse repository at this point
Copy the full SHA 5ae5fe3View commit details
Commits on Mar 26, 2023
-
[bdk_chain_redesign] Introduce
ChainOracle
andTxIndex
traitsThe 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`.
Configuration menu - View commit details
-
Copy full SHA for 61a8606 - Browse repository at this point
Copy the full SHA 61a8606View commit details
Commits on Mar 27, 2023
-
[bdk_chain_redesign] Add
..in_chain
methodsAdd methods to `TxGraph` and `IndexedTxGraph` that gets in-best-chain data (such as transactions, txouts, unspent txouts).
Configuration menu - View commit details
-
Copy full SHA for 43b648f - Browse repository at this point
Copy the full SHA 43b648fView commit details -
[bdk_chain_redesign] List chain data methods can be try/non-try
Methods that list chain data have try and non-try versions. Both of these versions now return an `Iterator`. * Try versions return `Iterator<Item = Result>`. * Non-try versions require the `ChainOracle` implementation to be `ChainOracle<Error = Infallible>`.
Configuration menu - View commit details
-
Copy full SHA for 784cd34 - Browse repository at this point
Copy the full SHA 784cd34View commit details -
Configuration menu - View commit details
-
Copy full SHA for 6cbb18d - Browse repository at this point
Copy the full SHA 6cbb18dView commit details -
[bdk_chain_redesign] Add
apply_additions
toIndexedTxGraph
* Get mutable index from `IndexedChainGraph`. * Also add `apply_additions` method to `TxIndex` trait.
Configuration menu - View commit details
-
Copy full SHA for d0a2aa8 - Browse repository at this point
Copy the full SHA d0a2aa8View commit details -
Configuration menu - View commit details
-
Copy full SHA for db7883d - Browse repository at this point
Copy the full SHA db7883dView commit details -
Configuration menu - View commit details
-
Copy full SHA for 313965d - Browse repository at this point
Copy the full SHA 313965dView commit details -
Configuration menu - View commit details
-
Copy full SHA for e902c10 - Browse repository at this point
Copy the full SHA e902c10View commit details -
[bdk_chain_redesign]
IndexedTxGraph
keeps track of the last synced ……height This is important as a `ChainOracle` implementation is updated separately to an `IndexedTxGraph`.
Configuration menu - View commit details
-
Copy full SHA for 236c50f - Browse repository at this point
Copy the full SHA 236c50fView commit details
Commits on Mar 28, 2023
-
Configuration menu - View commit details
-
Copy full SHA for 3440a05 - Browse repository at this point
Copy the full SHA 3440a05View commit details -
Configuration menu - View commit details
-
Copy full SHA for 34d0277 - Browse repository at this point
Copy the full SHA 34d0277View commit details
Commits on Mar 30, 2023
-
Configuration menu - View commit details
-
Copy full SHA for 468701a - Browse repository at this point
Copy the full SHA 468701aView commit details -
[bdk_chain_redesign] Make default anchor for
TxGraph
as()
This allows us to use the old API with minimal changes. `TxGraph` methods have also been rearranged to allow for it.
Configuration menu - View commit details
-
Copy full SHA for 8c90617 - Browse repository at this point
Copy the full SHA 8c90617View commit details
Commits on Mar 31, 2023
-
[bdk_chain_redesign] Revert some API changes
Methods of old structures that return transaction(s) no longer return `TxNode`, but `Transaction` as done previously. `TxInGraph` is renamed to `TxNode`, while the internal `TxNode` is renamed to `TxNodeInternal`.
Configuration menu - View commit details
-
Copy full SHA for a1172de - Browse repository at this point
Copy the full SHA a1172deView commit details -
Configuration menu - View commit details
-
Copy full SHA for a63ffe9 - Browse repository at this point
Copy the full SHA a63ffe9View commit details -
[bdk_chain_redesign]
TxGraph
tweaks* Rename `TxNode::last_seen` to `last_seen_unconfirmed` and improve docs * Improve `try_get_chain_position` logic and tweak comments
Configuration menu - View commit details
-
Copy full SHA for 7810059 - Browse repository at this point
Copy the full SHA 7810059View commit details -
[bdk_chain_redesign] Added methods to
LocalChain
Also made the `IndexedTxGraph::index` field public (`index()` and `index_mut()` methods are no longer needed).
Configuration menu - View commit details
-
Copy full SHA for c09cd2a - Browse repository at this point
Copy the full SHA c09cd2aView commit details -
Configuration menu - View commit details
-
Copy full SHA for a7eaebb - Browse repository at this point
Copy the full SHA a7eaebbView commit details
Commits on Apr 5, 2023
-
[bdk_chain_redesign]
chain_oracle::Cache
Introduce `chain_oracle::Cache` which is a cache for requests to the chain oracle. `ChainOracle` has also been moved to the `chain_oracle` module. Introduce `get_tip_in_best_chain` method to the `ChainOracle` trait. This allows for guaranteeing that chain state can be consistent across operations with `IndexedTxGraph`.
Configuration menu - View commit details
-
Copy full SHA for 6e59dce - Browse repository at this point
Copy the full SHA 6e59dceView commit details -
[bdk_chain_redesign] Better names, comments and generic bounds
* Instead of implementing `ChainPosition` for `ObservedIn<BlockId>` to use `FullTxOut` methods (`is_spendable_at` and `is_mature`), we create alternative versions of those methods that require bounds with `Anchor`. This removes all `ObservedIn<A>: ChainPosition` bounds for methods of `IndexedTxGraph`. * Various improvements to comments and names.
Configuration menu - View commit details
-
Copy full SHA for 89cfa4d - Browse repository at this point
Copy the full SHA 89cfa4dView commit details -
[bdk_chain_redesign] Introduce
Append
trait for additionsBefore, we were using `core::ops::AddAsign` but it was not the most appropriate.
Configuration menu - View commit details
-
Copy full SHA for da4cef0 - Browse repository at this point
Copy the full SHA da4cef0View commit details -
[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.
Configuration menu - View commit details
-
Copy full SHA for ddd5e95 - Browse repository at this point
Copy the full SHA ddd5e95View commit details -
Configuration menu - View commit details
-
Copy full SHA for 24cd8c5 - Browse repository at this point
Copy the full SHA 24cd8c5View commit details
Commits on Apr 7, 2023
-
Configuration menu - View commit details
-
Copy full SHA for bff80ec - Browse repository at this point
Copy the full SHA bff80ecView commit details
Commits on Apr 10, 2023
-
[bdk_chain_redesign] Consistent
ChainOracle
The problem with the previous `ChainOracle` interface is that it had no guarantee for consistency. For example, a block deemed to be part of the "best chain" can be reorged out. So when `ChainOracle` is called multiple times for an operation (such as getting the UTXO set), the returned result may be inconsistent. This PR changes `ChainOracle::is_block_in_chain` to take in another input `static_block`, ensuring `block` is an ancestor of `static_block`. Thus, if `static_block` is consistent across the operation, the result will be consistent also. `is_block_in_chain` now returns `Option<bool>`. The `None` case means that the oracle implementation cannot determine whether block is an ancestor of static block. `IndexedTxGraph::list_chain_txouts` handles this case by checking child spends that are in chain, and if so, the parent tx must be in chain too.
Configuration menu - View commit details
-
Copy full SHA for 611d2e3 - Browse repository at this point
Copy the full SHA 611d2e3View commit details -
[bdk_chain_redesign] Simplify
LocalChain
Remove the requirement that evicted blocks should have in-best-chain counterparts in the update.
Configuration menu - View commit details
-
Copy full SHA for ee1060f - Browse repository at this point
Copy the full SHA ee1060fView commit details -
Configuration menu - View commit details
-
Copy full SHA for a7fbe0a - Browse repository at this point
Copy the full SHA a7fbe0aView commit details -
[bdk_chain_redesign] Remove
IndexedTxGraph::last_height
It is better to have this external to this structure.
Configuration menu - View commit details
-
Copy full SHA for 7d92337 - Browse repository at this point
Copy the full SHA 7d92337View commit details
Commits on Apr 12, 2023
-
[bdk_chain_redesign] MOVE
TxIndex
intoindexed_chain_graph.rs
`tx_graph.rs` is rearranged as well.
Configuration menu - View commit details
-
Copy full SHA for 10ab77c - Browse repository at this point
Copy the full SHA 10ab77cView commit details -
Configuration menu - View commit details
-
Copy full SHA for 001efdd - Browse repository at this point
Copy the full SHA 001efddView commit details
Commits on Apr 17, 2023
-
[bdk_chain_redesign] Fix
Anchor
definition + docsPreviously, 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.
Configuration menu - View commit details
-
Copy full SHA for 81436fc - Browse repository at this point
Copy the full SHA 81436fcView commit details
Commits on Apr 19, 2023
-
[bdk_chain_redesign] Remove incomplete logic
`ObservedAs::ConfirmedImplicit` is incomplete, remove for now. `local_chain::ChangeSet` does not need to be a single-element tuple struct.
Configuration menu - View commit details
-
Copy full SHA for 8e36a2e - Browse repository at this point
Copy the full SHA 8e36a2eView commit details -
Configuration menu - View commit details
-
Copy full SHA for 7175a82 - Browse repository at this point
Copy the full SHA 7175a82View commit details
Commits on Apr 20, 2023
-
[bdk_chain_redesign] Test
LocalChain
This is mostly copying over the relevant tests from `SparseChain`. Changes are made to `local_chain::ChangeSet` to re-add the ability to remove blocks.
Configuration menu - View commit details
-
Copy full SHA for 1003fe2 - Browse repository at this point
Copy the full SHA 1003fe2View commit details -
[bdk_chain_redesign] Rm
HashSet
fromTxGraph::relevant_heights
The `HashSet` was used for iterating without duplicate items. However, since `anchors` is a `BTreeSet`, heights are in order. So a single variable tracking last height will be sufficient.
Configuration menu - View commit details
-
Copy full SHA for 6c49570 - Browse repository at this point
Copy the full SHA 6c49570View commit details -
[bdk_chain_redesign] Rm unnecessary code and premature optimisation
* Remove `chain_oracle::CacheBackend` for now as it is not used. * `SparseChain` does not need to implement `ChainOracle`. * Remove filter predicate for `list..` methods of `TxGraph` and `IndexedTxGraph` as this is premature optimisation. * `Append` can be implemented for all `BTreeMap`s and `BTreeSet`s, instead of only `local_chain::ChangeSet`.
Configuration menu - View commit details
-
Copy full SHA for 34a7bf5 - Browse repository at this point
Copy the full SHA 34a7bf5View commit details
Commits on Apr 21, 2023
-
Configuration menu - View commit details
-
Copy full SHA for 03c1283 - Browse repository at this point
Copy the full SHA 03c1283View commit details -
[bdk_chain_redesign] Various tweaks and fixes
The `ConfirmationHeight` trait has been removed in favour of a second method on the `Anchor` trait: `confirmation_height_upper_bound()`. Methods `try_balance_at()` and `balance_at()` of `IndexedTxGraph` have been removed as they do not provide additional functionality. `IndexedTxGraph::insert_relevant_txs` now uses two loops, the first loop indexes all transactions first. This is done as some indexes require ancestor transactions to be indexed first and we cannot guarantee that the input transactions are in topological order.
Configuration menu - View commit details
-
Copy full SHA for f3e7b67 - Browse repository at this point
Copy the full SHA f3e7b67View commit details -
[bdk_chain_redesign] Add test for
insert_relevant_txs
Ensure `insert_relevant_txs` does not require transactions to be in topological order. Other changes: Rm `try_list_owned_txs` as it is useless
Configuration menu - View commit details
-
Copy full SHA for 165b874 - Browse repository at this point
Copy the full SHA 165b874View commit details
Commits on Apr 22, 2023
-
[bdk_chain_redesign] Make
insert_relevant_txs
topologically-agnosticThe `insert_relevant_txs` test has also been changed to used `KeychainTxOutIndex` so that index additions can be checked (`SpkTxOutIndex` has no additions). Additionally, generic bounds of some `IndexedTxGraph` list methods have been fixed.
Configuration menu - View commit details
-
Copy full SHA for ac336aa - Browse repository at this point
Copy the full SHA ac336aaView commit details -
[bdk_chain_redesign] Docs for
is_mature
and `is_confirmed_and_spend……able` Docs are updated to explain why `is_mature` and `is_confirmed_and_spendable` may return false-negatives.
Configuration menu - View commit details
-
Copy full SHA for ecc74ce - Browse repository at this point
Copy the full SHA ecc74ceView commit details -
[bdk_chain_redesign] Change
insert_relevant_txs
methodInstead of forcing all transactions inserted to use the same anchors, we change the API to have unique anchors per transaction. This allows for more flexibility in general. For example, use `Anchor` implementations that contain the position in a block of a transaction.
Configuration menu - View commit details
-
Copy full SHA for 1b15264 - Browse repository at this point
Copy the full SHA 1b15264View commit details
Commits on Apr 25, 2023
-
Configuration menu - View commit details
-
Copy full SHA for f101dde - Browse repository at this point
Copy the full SHA f101ddeView commit details
Commits on Apr 28, 2023
-
[bdk_chain_redesign] Fix
tx_graph::Additions::append
logic* `Additions` now implements `Append` and uses `Append` to implement `append()`. * `append()` logic enforces that `last_seen` values should only increase. * Test written for `append()` with `last_seen` behaviour.
Configuration menu - View commit details
-
Copy full SHA for e536307 - Browse repository at this point
Copy the full SHA e536307View commit details -
[bdk_chain_redesign] Fix calculation bugs.
* `IndexedTxGraph::try_balance` should include "confirmed and spendable" into `confirmed` balance. * `TxGraph::try_list_chain_unspents` filter logic should be reversed.
Configuration menu - View commit details
-
Copy full SHA for 911af34 - Browse repository at this point
Copy the full SHA 911af34View commit details -
[bdk_chain_redesign] Implement
OwnedIndexer
for indexers`SpkTxOutIndex` and `KeychainTxOutIndex` now both implement `OwnedIndexer`.
Configuration menu - View commit details
-
Copy full SHA for 8cd0328 - Browse repository at this point
Copy the full SHA 8cd0328View commit details -
[bdk_chain_redesign] Add tests for
IndexedTxGraph
withLocalChain
These tests cover list_txout, list_utxo and balance methods.
Configuration menu - View commit details
-
Copy full SHA for b799a57 - Browse repository at this point
Copy the full SHA b799a57View commit details