28 Commits

Author SHA1 Message Date
Steve Myers
2e4bc3c5e2
Bump bdk version to 1.0.0-alpha.2
Bump bdk_chain to 0.6.0
Bump bdk_electrum to 0.4.0
Bump bdk_esplora to 0.4.0
2023-10-11 17:30:36 -05:00
LLFourn
5e79b81a6a
fix: Remove dependency on unnecessary bdk_chain features 2023-10-04 10:52:12 +11:00
sjeohp
fe654310d7
fix: bump electrum version to 0.18 2023-09-28 10:49:19 -06:00
Vladimir Fomene
d43ae0231f
refactor: improve docs, cleanup unnecessary types and improve code 2023-09-13 13:57:58 +03:00
志宇
32c40ac939
feat(electrum)!: change signature of ElectrumExt
We remove `ElectrumUpdate` and return tuples instead for `ElectrumExt`
methods. We introduce the `IncompleteTxGraph` structure to specifically
hodl the incomplete `TxGraph`.

This change is motivated by @LLFourn's comment: 794bf37e63 (r1305432603)
2023-09-03 01:51:20 +08:00
Vladimir Fomene
6bcbb93233
refactor: Edit ElectrumExt not to use WalletUpdate 2023-09-03 00:54:23 +08:00
Daniela Brozzoni
ea50b6a932
refactor!(chain): Unify ChangeSet nomenclature
This commit renames:

- indexed_tx_graph::IndexedAdditions -> indexed_tx_graph::ChangeSet
- indexed_tx_graph::IndexedAdditions::graph_additions -> indexed_tx_graph::ChangeSet::graph
- indexed_tx_graph::IndexedAdditions::index_additions -> indexed_tx_graph::ChangeSet::indexer
- tx_graph::Additions -> tx_graph::ChangeSet
- keychain::DerivationAdditions -> keychain::ChangeSet
- CanonicalTx::node -> CanonicalTx::tx_node
- CanonicalTx::observed_as -> CanonicalTx::chain_position
- LocalChangeSet -> WalletChangeSet
- LocalChangeSet::chain_changeset -> WalletChangeSet::chain
- LocalChangeSet::indexed_additions -> WalletChangeSet::indexed_tx_graph
- LocalUpdate -> WalletUpdate

This commit also changes the visibility of TxGraph::determine_changeset
to be pub(crate), and the method accepts a TxGraph instead of &TxGraph

This commit removes:
- `TxGraph::insert_txout_preview`
- `TxGraph::insert_tx_preview`
- `insert_anchor_preview`
- `insert_seen_at_preview`

Solves #1022
2023-08-18 11:51:45 +02:00
Daniela Brozzoni
91b0f0ba29
Update crates/electrum to bitcoin 0.30.0 2023-08-03 10:59:04 +02:00
志宇
db15e03bdc
fix: improve more docs and more refactoring
Thank you @vladimirfomene for these suggestions.

* Rename `LocalUpdate::keychain` to `LocalUpdate::last_active_indices`.
* Change docs for `CheckPoint` to be more descriptive.
* Fix incorrect logic in `update_local_chain` for `EsploraExt` and
  `EsploraAsyncExt`.
2023-07-28 11:37:17 +08:00
志宇
eabeb6ccb1
Implement linked-list LocalChain and update chain-src crates/examples
This commit changes the `LocalChain` implementation to have blocks
stored as a linked-list. This allows the data-src thread to hold a
shared ref to a single checkpoint and have access to the whole history
of checkpoints without cloning or keeping a lock on `LocalChain`.

The APIs of `bdk::Wallet`, `esplora` and `electrum` are also updated to
reflect these changes. Note that the `esplora` crate is rewritten to
anchor txs in the confirmation block (using the esplora API's tx status
block_hash). This guarantees 100% consistency between anchor blocks and
their transactions (instead of anchoring txs to the latest tip).
`ExploraExt` now has separate methods for updating the `TxGraph` and
`LocalChain`.

A new method `TxGraph::missing_blocks` is introduced for finding
"floating anchors" of a `TxGraph` update (given a chain).

Additional changes:

* `test_local_chain.rs` is refactored to make test cases easier to
  write. Additional tests are also added.
* Examples are updated.
* Fix `tempfile` dev dependency of `bdk_file_store` to work with MSRV

Co-authored-by: LLFourn <lloyd.fourn@gmail.com>
2023-07-28 11:30:16 +08:00
Steve Myers
f4d2a76661
Bump version to 1.0.0-alpha.1 2023-07-04 12:28:06 -05:00
志宇
75f8b81d58
Update documentation
* Add `warn(missing_docs)` for `bdk_wallet` and `bdk_chain`.
* Add missing documentation.
* Remove `LocalChain::heights` method.
* Remove old TODOs.
2023-06-04 03:32:19 +08:00
Shourya742
ac80829caa
Rename fields of tx_graph::Additions
* Changed `tx` to `txs`
* Changed `txout` to `txouts`
2023-06-04 03:32:18 +08:00
志宇
1c3cbefa4d
[chain_redesign] Remove old structures
Other changes:

* The `async-https` feature of `bdk_esplora` is no longer default.
* Rename `ObservedAs` to `ChainPosition`.
* Set temporary MSRV to 1.60.0 to compile all workspace members will all
  features.
2023-06-04 03:32:18 +08:00
志宇
78a7920ba3
bdk_electrum API improvements and simplifications
* `ElectrumUpdate::missing_full_txs` now returns a `Vec<Txid>` so we
  don't keep a reference to the passed-in `graph`.

* `ElectrumUpdate::finalize*` methods now takes in `missing` txids
  instead of `full_txs`. `Client::batch_transaction_get` is called
within the methods.

Other changes:

* `wallet::ChangeSet` is now made public externally. This is required as
  a wallet db should implement `PersistBackend<wallet::ChangeSet>`.
2023-06-04 03:32:18 +08:00
志宇
92709d03ce
Various tweaks to code arrangement and documentation
As per reviews by @danielabrozzoni and @LLFourn
2023-06-04 03:32:18 +08:00
志宇
f55974a64b
[examples_redesign] Introduce example_cli package
This is the equivalent of `keychain_tracker_example_cli` that works with
the redesigned structures.
2023-06-04 03:32:17 +08:00
志宇
2e3cee4bd0
[electrum_redesign] Introduce redesigned ElectrumExt
There are a number of improvements that can be done, but it is in a
decent state to be usable.

Possible improvements:

* Remove requirement to retry obtaining ALL data after reorg is
  detected. Transactions can be anchored to a lower block (not block
  tip), and an `assume_final_depth` value can be used.

* The logic to finalize an update with confirmation time can be improved
  during reorgs to not require returning an error.
2023-06-04 03:32:17 +08:00
志宇
7261669c09
Add last_seen to the the ConfirmationTime::Unconfirmed variant
This allows us to skip adding an extra input to `Wallet::insert_tx`.

Also remove redundant logic.
2023-06-04 03:32:17 +08:00
Steve Myers
82f9caddab
Bump bdk version to 1.0.0-alpha.0
chain to 0.4.0
electrum to 0.2.0
esplora to 0.2.0
file_store to 0.1.0
2023-03-19 23:03:48 -05:00
rajarshimaitra
24df03afd6
Add documentation fixes 2023-03-15 13:00:45 +08:00
志宇
0505cd7242
Remove transaction-based type parameters and traits 2023-03-08 11:39:25 +13:00
志宇
de9457fce6
Changed inflate_update logic to not depend on Cow
As mentioned by @LLFourn:

1. We have a "sparse chain" from which there is a subset of txids M that are missing from graph.
2. There is also another subset C that are in the graph but their positions have changed.
3. We used the Cow to avoid copying/duplicating in memory transactions in subset C and M

Instead in inflate_update we could remove transactions in subset M and just clone data in subset C (which is usually tiny).
2023-03-08 01:53:09 +13:00
Steve Myers
3a5d727899
Update workspace dependencies to be relative paths 2023-03-03 17:44:08 +01:00
Daniela Brozzoni
8c9bcebc71
Fix the "repository" field in Cargo.toml 2023-03-03 17:44:04 +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
LLFourn
c069b0fb41
Move everything else over 🎉
This completes the move of things from https://github.com/LLFourn/bdk_core_staging
2023-03-02 10:56:36 +01:00
Daniela Brozzoni
949608ab1f
Move bdk_electrum into the bdk repo 🎉
Original repository: 250b4f1dcc/bdk_electrum

Co-authored-by: 志宇 <hello@evanlinjin.me>
Co-authored-by: LLFourn <lloyd.fourn@gmail.com>
2023-03-02 10:56:35 +01:00