13 Commits

Author SHA1 Message Date
志宇
b206a985cf
fix: Even more refactoring to code and documentation
Thank you to @LLFourn and @danielabrozzoni for these suggestions.
2023-08-01 18:31:22 +08:00
志宇
bea8e5aff4
fix: TxGraph::missing_blocks logic
Added additional tests for unnecessary duplicate heights
2023-07-28 11:37:17 +08: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
志宇
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
志宇
5860704b2d
Implement redesigned versions of EsploraExt and EsploraAsyncExt
All associated examples are also updated.
2023-06-04 03:32:18 +08:00
志宇
e69fccb15f
[wallet_redesign] Update Wallet with redesigned structures 2023-06-04 03:32:14 +08:00
Daniela Brozzoni
0aaf420f6d
examples: exit if balance < SEND_AMOUNT 2023-03-08 15:41:49 +01:00
志宇
9d26121dbc
Improve stdout output for wallet esplora/electrum examples 2023-03-08 15:28:56 +13:00
志宇
69cf6d7924
Use os-specific temp dir for wallet_esplora example 2023-03-07 10:59:13 +13:00
志宇
b3836cb308
Use hardcoded send amount for wallet_esplora example 2023-03-07 10:47:13 +13:00
Daniela Brozzoni
b082932268
Add the wallet_esplora example 2023-03-03 17:55:23 +01:00
LLFourn
b5559767db
Rename the stub wallet examples 2023-03-02 10:56:38 +01:00