]> Untitled Git - bdk/log
bdk
2 years agoMerge bitcoindevkit/bdk#990: Pin base64 to 0.21.0 to keep the MSRV to 1.57.0
Daniela Brozzoni [Wed, 24 May 2023 15:49:51 +0000 (17:49 +0200)]
Merge bitcoindevkit/bdk#990: Pin base64 to 0.21.0 to keep the MSRV to 1.57.0

df74b23f315007cc36d3a12904380f861326fb32 Pin base64 to 0.21.0 to keep the MSRV to 1.57.0 (Daniela Brozzoni)

Pull request description:

  Fixes #986

  ### Changelog notice

  - Pin base64 to 0.21.0

  ### Checklists

  #### All Submissions:

  * [x] I've signed all my commits
  * [x] I followed the [contribution guidelines](https://github.com/bitcoindevkit/bdk/blob/master/CONTRIBUTING.md)
  * [x] I ran `cargo fmt` and `cargo clippy` before committing

ACKs for top commit:
  notmandatory:
    ACK df74b23f315007cc36d3a12904380f861326fb32

Tree-SHA512: fb11db0771542b074b7605e4af9ec655c22106b1d3451e27103d2f81686270efb44d8687f8312b5b7ab724f03e8f24c349a9f4f3b6e0c89ed9550b121f526ce7

2 years agoPin base64 to 0.21.0 to keep the MSRV to 1.57.0
Daniela Brozzoni [Wed, 24 May 2023 14:12:34 +0000 (16:12 +0200)]
Pin base64 to 0.21.0 to keep the MSRV to 1.57.0

2 years agoMerge bitcoindevkit/bdk#981: Fixed typos in CONTRIBUTING.md
Daniela Brozzoni [Thu, 18 May 2023 10:36:16 +0000 (12:36 +0200)]
Merge bitcoindevkit/bdk#981: Fixed typos in CONTRIBUTING.md

c7a045fa54a8183899d90730249c06c3f538b027 Fixed typos in CONTRIBUTING.md (Jon Marrs)

Pull request description:

  ### Description

  Fixed typos in CONTRIBUTING.md

  ### Checklists

  #### All Submissions:

  * [x] I've signed all my commits
  * [x] I followed the [contribution guidelines](https://github.com/bitcoindevkit/bdk/blob/master/CONTRIBUTING.md)

ACKs for top commit:
  thunderbiscuit:
    ACK c7a045fa54a8183899d90730249c06c3f538b027.

Tree-SHA512: de66f4be7c7fd608f5a74e51c5666f4fe6b962c5a8345c08c7b1da2551f81b9adfb28c58f0991ac6c985fa5c31f3eb7d17f99edf136b04945cefa24b28eaee19

2 years agoFixed typos in CONTRIBUTING.md
Jon Marrs [Wed, 17 May 2023 04:39:18 +0000 (21:39 -0700)]
Fixed typos in CONTRIBUTING.md

2 years agoMerge bitcoindevkit/bdk#975: Improve `txout` listing and balance APIs for redesigned...
志宇 [Thu, 11 May 2023 13:00:23 +0000 (21:00 +0800)]
Merge bitcoindevkit/bdk#975: Improve `txout` listing and balance APIs for redesigned structures

ed89de752cf20cb80deefda3ddf65a137b669288 Improve txout filter/listing method docs for `TxGraph` (志宇)
fb75aa94a9f47d53ce7246c14d739fc53dc38197 Clarify `TxGraph::try_filter_chain_unspents` logic (志宇)
96b10751325dc1bced09f9e864438216400e4ba3 Fix and improve `Persist::commit` method (志宇)
e01d17d59bd6177bf5e457232219669782b727b7 Improve `txout` listing and balance APIs for redesigned structures (志宇)

Pull request description:

  ### Description

  As noted in https://github.com/bitcoindevkit/bdk/issues/971#issuecomment-1542408941.

  Instead of relying on a `OwnedIndexer` trait to filter for relevant txouts, we move the listing and balance methods from `IndexedTxGraph` to `TxGraph` and add an additional input (list of relevant outpoints) to these methods.

  This provides a simpler implementation and a more flexible API.

  #### Other Fixes

  The `Persist::commit` method is fixed in 96b10751325dc1bced09f9e864438216400e4ba3.

  Previously, regardless of whether writing to persistence backend is successful or not, the logic always cleared `self.staged`. This is changed to only clear `self.staged` after successful write.

  Additionally, the written changeset (if any) is returned, and `PersistBackend::write_changes` will not be called if `self.staged` is empty.

  ### Notes to the reviewers

  Yes, slightly more boilerplate to do the same things, but less code to maintain and a much more flexible API. Very worth it IMO.

  ### Changelog notice

  ### Checklists

  #### All Submissions:

  * [x] I've signed all my commits
  * [x] I followed the [contribution guidelines](https://github.com/bitcoindevkit/bdk/blob/master/CONTRIBUTING.md)
  * [x] I ran `cargo fmt` and `cargo clippy` before committing

  #### New Features:

  * [x] I've added tests for the new feature
  * [x] I've added docs for the new feature

ACKs for top commit:
  LLFourn:
    ACK ed89de752cf20cb80deefda3ddf65a137b669288

Tree-SHA512: efae18c13ee74eff801febca61cb16bf4d8f3203ced96172b9ef555d8d2a749a382f87d024e8c92aacbab7eb4e50a8337de798e10524291ad80c6b35c4dc0161

2 years agoImprove txout filter/listing method docs for `TxGraph`
志宇 [Thu, 11 May 2023 04:43:49 +0000 (12:43 +0800)]
Improve txout filter/listing method docs for `TxGraph`

Rename the `S` trait bound to `OI` (outpoint index) to emphasize it's
not only for spk indexing.

2 years agoClarify `TxGraph::try_filter_chain_unspents` logic
志宇 [Thu, 11 May 2023 03:59:57 +0000 (11:59 +0800)]
Clarify `TxGraph::try_filter_chain_unspents` logic

2 years agoFix and improve `Persist::commit` method
志宇 [Thu, 11 May 2023 03:49:33 +0000 (11:49 +0800)]
Fix and improve `Persist::commit` method

Previously, regardless of whether writing to persistence backend is
successful or not, the logic always cleared `self.staged`. This is
changed to only clear `self.staged` after successful write.

Additionally, the written changeset (if any) is returned, and
`PersistBackend::write_changes` will not be called if `self.staged` is
empty.

2 years agoImprove `txout` listing and balance APIs for redesigned structures
志宇 [Wed, 10 May 2023 06:14:29 +0000 (14:14 +0800)]
Improve `txout` listing and balance APIs for redesigned structures

Instead of relying on a `OwnedIndexer` trait to filter for relevant
txouts, we move the listing and balance methods from `IndexedTxGraph` to
`TxGraph` and add an additional input (list of relevant outpoints) to
these methods.

This provides a simpler implementation and a more flexible API.

2 years agoMerge bitcoindevkit/bdk#965: Implement persistence with the new structures
志宇 [Wed, 10 May 2023 15:23:49 +0000 (23:23 +0800)]
Merge bitcoindevkit/bdk#965: Implement persistence with the new structures

4963240599364c6520d0a6ecae97db77cc7b8ba8 Add more `impl`s for `Append` and docs for file store `magic` (志宇)
2aa08a5898545f670df9ed9c4804231f321d811a [persist_redesign] Introduce redesigned `persist` types (志宇)

Pull request description:

  ### Description

  This is part of #895 and #971

  * Introduce a more generic version of the `keychain::persist::*` structures that only needs a single generic for the changeset type.

  Additional changes:

  * The `Append` trait has a new method `is_empty`.
  * Introduce `Store` structure for `bdk_file_store` (which implements `PersistBackend`).

  ### Changelog notice

  ### Checklists

  #### All Submissions:

  * [x] I've signed all my commits
  * [x] I followed the [contribution guidelines](https://github.com/bitcoindevkit/bdk/blob/master/CONTRIBUTING.md)
  * [x] I ran `cargo fmt` and `cargo clippy` before committing

  #### New Features:

  * [x] I've added tests for the new feature
  * [x] I've added docs for the new feature

Top commit has no ACKs.

Tree-SHA512: 0211fbe7d7e27805d3ed3a80b42f184cdff1cebb32fd559aa9838e4a7f7c7e47b6c366b6ef68e299f876bafed549b8d1d8b8cc0366bf5b61db079504a565b9b4

2 years agoAdd more `impl`s for `Append` and docs for file store `magic`
志宇 [Wed, 10 May 2023 06:48:26 +0000 (14:48 +0800)]
Add more `impl`s for `Append` and docs for file store `magic`

2 years ago[persist_redesign] Introduce redesigned `persist` types
志宇 [Tue, 9 May 2023 01:59:42 +0000 (09:59 +0800)]
[persist_redesign] Introduce redesigned `persist` types

This is a more generic version of `keychain::persist::*` structures.

Additional changes:

* The `Append` trait has a new method `is_empty`.
* Introduce `Store` structure for `bdk_file_store`.

2 years agoMerge pull request #963 from evanlinjin/chain_redesign_tweaks
志宇 [Fri, 5 May 2023 12:11:11 +0000 (20:11 +0800)]
Merge pull request #963 from evanlinjin/chain_redesign_tweaks

Various tweaks to redesigned structures

2 years ago[chain_redesign] Rename `LocalChain::inner()` to `blocks()`
志宇 [Fri, 5 May 2023 11:49:30 +0000 (19:49 +0800)]
[chain_redesign] Rename `LocalChain::inner()` to `blocks()`

Also, we can get rid of `LocalChain::get_blockhash`, since we can
already expose the internal map.

Additionally, tests and docs are improved.

2 years ago[chain_redesign] Various `LocalChain` improvements
志宇 [Fri, 5 May 2023 08:55:21 +0000 (16:55 +0800)]
[chain_redesign] Various `LocalChain` improvements

* Introduce `LocalChain::inner` method to get the inner map of block
  height to hash.
* Replace `LocalChain::get_block` (which outputted `BlockId`, thus able
  to return invalid representation) with `get_blockhash` that just
returns a `BlockHash`.
* Remove `TODO` comments that should be github tickets.

2 years ago[chain_redesign] `BlockId` should not implement `Anchor`
志宇 [Wed, 3 May 2023 08:03:23 +0000 (16:03 +0800)]
[chain_redesign] `BlockId` should not implement `Anchor`

If `BlockId` implements `Anchor`, the meaning is ambiguous. We cannot
tell whether it means the tx is anchors at the block, or whether it also
means the tx is confirmed at that block.

Instead, `ConfirmationHeightAnchor` and `ConfirmationTimeAnchor` structs
are introduced as non-ambiguous `Anchor` implementations.

Additionally, `TxGraph::relevant_heights` is removed because it is also
ambiguous. What heights are deemed relevant? A simpler and more flexible
method `TxGraph::all_anchors` is introduced instead.

2 years ago[chain_redesign] Relax generic constraints
志宇 [Wed, 3 May 2023 07:20:49 +0000 (15:20 +0800)]
[chain_redesign] Relax generic constraints

2 years ago[chain_redesign] Add `LocalChain::insert_block`
志宇 [Wed, 3 May 2023 07:01:39 +0000 (15:01 +0800)]
[chain_redesign] Add `LocalChain::insert_block`

2 years ago[chain_redesign] Change behavior of `try_get_chain_position`
志宇 [Wed, 3 May 2023 03:43:16 +0000 (11:43 +0800)]
[chain_redesign] Change behavior of `try_get_chain_position`

`TxGraph::try_get_chain_position` used to always exclude unconfirmed
transactions with last_seen value of 0. However, what is the point of
including a transaction in the graph if it cannot be part of the chain
history? Additionally, maybe sometimes we don't wish to use the
last_seen field at all.

The new behavior will consider unconfirmed transactions with last_seen
of 0.

2 years agoMerge pull request #927 from LagginTimes/custom_spk_iterator
志宇 [Tue, 2 May 2023 09:36:51 +0000 (17:36 +0800)]
Merge pull request #927 from LagginTimes/custom_spk_iterator

Custom spk iterator

2 years agoImplement SpkIterator
Wei [Wed, 22 Mar 2023 09:00:08 +0000 (17:00 +0800)]
Implement SpkIterator

SpkIterator was created with its own nth() and next() implementations
and its own new() and new_with_range() constructors.

Co-authored-by: 志宇 <hello@evanlinjin.me>
2 years agoMerge commit 'refs/pull/960/head' of github.com:bitcoindevkit/bdk
Steve Myers [Mon, 1 May 2023 20:40:35 +0000 (15:40 -0500)]
Merge commit 'refs/pull/960/head' of github.com:bitcoindevkit/bdk

Reenable code coverage upload to Coveralls, only for /crates repos

2 years agoMerge pull request #959 from rajarshimaitra/test-graph-2
志宇 [Mon, 1 May 2023 06:53:30 +0000 (14:53 +0800)]
Merge pull request #959 from rajarshimaitra/test-graph-2

Cleanup IndexedTxGraph test.

2 years agoMerge pull request #953 from benthecarman/kwu
Lloyd Fournier [Mon, 1 May 2023 03:22:44 +0000 (13:22 +1000)]
Merge pull request #953 from benthecarman/kwu

Add sat_per_kwu to FeeRate

2 years agoFilter code coverage report results
Steve Myers [Sat, 29 Apr 2023 20:47:08 +0000 (15:47 -0500)]
Filter code coverage report results

2 years agoReenable code coverage upload to Coveralls, only for ./crates packages
Steve Myers [Sat, 29 Apr 2023 14:18:35 +0000 (09:18 -0500)]
Reenable code coverage upload to Coveralls, only for ./crates packages

2 years agoTest cleanup and added documentation.
rajarshimaitra [Sat, 29 Apr 2023 11:57:12 +0000 (17:27 +0530)]
Test cleanup and added documentation.

- Explainer doc added for the test.
- Test code simplified.
- One more edge cases added.

2 years agoMerge bitcoindevkit/bdk#926: Introduce redesigned `bdk_chain` structures
Daniela Brozzoni [Fri, 28 Apr 2023 16:47:13 +0000 (18:47 +0200)]
Merge bitcoindevkit/bdk#926: Introduce redesigned `bdk_chain` structures

b799a5728b7e08a18059ffee7fe7ee6078354977 [bdk_chain_redesign] Add tests for `IndexedTxGraph` with `LocalChain` (rajarshimaitra)
8cd0328eec0b55f10dd085597a435b689b37444a [bdk_chain_redesign] Implement `OwnedIndexer` for indexers (rajarshimaitra)
911af34f509ad0b4c86c0be819d79b202679e3e5 [bdk_chain_redesign] Fix calculation bugs. (rajarshimaitra)
e536307e5c5532fc0cac0657a26609cfd26115bf [bdk_chain_redesign] Fix `tx_graph::Additions::append` logic (志宇)
f101dde09b6067c17b0b64ea3e3efd358a32a820 [bdk_chain_redesign] Fix `tx_graph::Additions::append` logic (志宇)
1b152647c557d2ff492cd241999c5320f7c4f6c5 [bdk_chain_redesign] Change `insert_relevant_txs` method (志宇)
ecc74ce4cd1ab0c51c2e9bcaa4f7d53390dd4d9b [bdk_chain_redesign] Docs for `is_mature` and `is_confirmed_and_spendable` (志宇)
ac336aa32f485cb253ac7ea5cae3b4bcc78cf507 [bdk_chain_redesign] Make `insert_relevant_txs` topologically-agnostic (志宇)
165b874dfedb2e05a7ea5d56e6f80577ada48d73 [bdk_chain_redesign] Add test for `insert_relevant_txs` (志宇)
f3e7b67bf1195eadf48a8f26f960b3f39d6134f7 [bdk_chain_redesign] Various tweaks and fixes (志宇)
03c128311a687249238fb109f804cde25ffddad2 [bdk_chain_redesign] Revert changes to `SparseChain` (志宇)
34a7bf5afe2d78db47b149f4958f0a0365b017d0 [bdk_chain_redesign] Rm unnecessary code and premature optimisation (志宇)
6c495707423cc7ce26c3027893dc812281b73053 [bdk_chain_redesign] Rm `HashSet` from `TxGraph::relevant_heights` (志宇)
1003fe2ee6167e110b0195e2431560b5b222e2f1 [bdk_chain_redesign] Test `LocalChain` (志宇)
7175a82c04b0a3f0c5716f4a37e122da70b8ceac [bdk_chain_redesign] Add tests for `TxGraph::relevant_heights` (志宇)
8e36a2e5f6d0fe2813dca9a13005e0b1be7e94c3 [bdk_chain_redesign] Remove incomplete logic (志宇)
81436fcd72a3c45bb10a098be28de0116322d22d [bdk_chain_redesign] Fix `Anchor` definition + docs (志宇)
001efdd1cb658f3a2929ffcf9047e6b07e9bd15c Include tests for new updates of TxGraph (rajarshimaitra)
10ab77c549e597d0d8157d94ae6fa3b4d39fd5dc [bdk_chain_redesign] MOVE `TxIndex` into `indexed_chain_graph.rs` (志宇)
7d92337b932fdcfec7008da8ed81f2b4b6e7a069 [bdk_chain_redesign] Remove `IndexedTxGraph::last_height` (志宇)
a7fbe0ac672cde6c308737fc98020f6693071a5f [bdk_chain_redesign] Documentation improvements (志宇)
ee1060f2ff168e6aaffa41882be2b319729f7de8 [bdk_chain_redesign] Simplify `LocalChain` (志宇)
611d2e3ea2ed9249ddf04e0f9089642160e5c901 [bdk_chain_redesign] Consistent `ChainOracle` (志宇)
bff80ec378fab29556099f9830bcb42911658710 [bdk_chain_redesign] Improve `BlockAnchor` docs (志宇)
24cd8c5cc7f3a6bd0db2bd45642f08a28ea5337a [bdk_chain_redesign] More tweaks and renamings (志宇)
ddd5e951f5ec77070034c7390a635d8d5bd7cb85 [bdk_chain_redesign] Modify signature of `TxIndex` (志宇)
da4cef044d4a3ad0f44ff1e33936c93c38c2f774 [bdk_chain_redesign] Introduce `Append` trait for additions (志宇)
89cfa4d78e059f9fe2544b690bbbf90e92b3efee [bdk_chain_redesign] Better names, comments and generic bounds (志宇)
6e59dce10b66212d7180cadabba887cc4d20fc32 [bdk_chain_redesign] `chain_oracle::Cache` (志宇)
a7eaebbb77f8794c5ff3717aaf0cf73dd5a77480 [bdk_chain_redesign] Add serde support for `IndexedAdditions` (志宇)
c09cd2afce4e649caa2797628edaffae08a60628 [bdk_chain_redesign] Added methods to `LocalChain` (志宇)
7810059ed0f23cae7dee61fe587a1c8f3f49480a [bdk_chain_redesign] `TxGraph` tweaks (志宇)
a63ffe97397cd14bc0a13ea5e96ceddf8b63a4f0 [bdk_chain_redesign] Simplify `TxIndex` (志宇)
a1172def7df478c61076b0d99d5d0f5f9cd99da6 [bdk_chain_redesign] Revert some API changes (志宇)
8c906170c96919cd8c65e306b8351fe01e139fd4 [bdk_chain_redesign] Make default anchor for `TxGraph` as `()` (志宇)
468701a1295c90761749e1bb46cc201cc7f95613 [bdk_chain_redesign] Initial work on `LocalChain`. (志宇)
34d0277e44fd054c8d463dfa756d8531ccda3ca9 [bdk_chain_redesign] Rm anchor type param for structs that don't use it (志宇)
3440a057110fbbcc653f2f8c7d58175472299bae [bdk_chain_redesign] Add docs (志宇)
236c50fa7bace29a0373dd16416ecebbb6dc1ae8 [bdk_chain_redesign] `IndexedTxGraph` keeps track of the last synced height (志宇)
e902c10295ba430bf0522b92ffab68cd60bd1666 [bdk_chain_redesign] Fix `apply_additions` logic for `IndexedTxGraph`. (志宇)
313965d8c84f5de43cafa58c7bd9250aea93b22c [bdk_chain_redesign] `mut_index` should be `index_mut` (志宇)
db7883d813e97229340c32a8fa82a9a13bac7361 [bdk_chain_redesign] Add balance methods to `IndexedTxGraph` (志宇)
d0a2aa83befce5dda26f8b3ae05449f6967df25a [bdk_chain_redesign] Add `apply_additions` to `IndexedTxGraph` (志宇)
6cbb18d409d84ea0c399d9b3ecb0cdb49cc0b32e [bdk_chain_redesign] MOVE: `IndexedTxGraph` into submodule (志宇)
784cd34e3db727659dbb26c428ed9096927286c1 [bdk_chain_redesign] List chain data methods can be try/non-try (志宇)
43b648fee02291858dfcab9b639c55a0bc3fad81 [bdk_chain_redesign] Add `..in_chain` methods (志宇)
61a8606fbcaec933f915c4f0600cd6f5e35636e8 [bdk_chain_redesign] Introduce `ChainOracle` and `TxIndex` traits (志宇)
5ae5fe30ebd53d72fe567509506ae0cda7a3a244 [bdk_chain_redesign] Introduce `BlockAnchor` trait (志宇)

Pull request description:

  ### Description

  This is part of #895

  The initial `bdk_chain` structures allowed updating to be done without blocking IO (alongside many other benefits). However, the requirement to have transactions "perfectly positioned" in our `SparseChain` increased complexity of the syncing API. Updates needed to be meticulously crafted to properly connect with the original `SparseChain`. Additionally, it forced us to keep a local copy of the "best chain" data (which may not always be needed depending on the chain source).

  The redesigned structures, as introduced by this PR, fixes these shortcomings.

  1. Instead of `SparseChain`, we introduce the ability to `Anchor` a transaction to multiple blocks that may or may not be in the same chain history. We expand `TxGraph` to records these anchors (while still maintaining the *monotone* nature of `TxGraph`). When updating our new `TxGraph`, we don't need to complicated *are-we-connected* checks that we need for `SparseChain`.
  2. The chain source, in combination with our new`TxGraph` is all that we need to determine the "chain position" of a transaction. The chain source only needs to implement a single trait `ChainOracle`. This typically does not need to be updated (as it is remote), although we can have a special `ChainOracle` implementation that is stored locally. This only needs block height and hash information, reducing the scope of *non-monotine* structures that need to be updated.

  **What is done:**

  * `TxGraph` includes anchors (ids of blocks that the tx is seen in) and last-seem unix timestamp (for determining which non-confirmed tx we should consider as part of "best chain" if there are conflicts). This structure continues to be fully "monotone"; we can introduce data in any manner and not risk resulting in an inconsistent state.
  * `LocalChain` includes the "checkpoint" logic of `SparseChain` but removes the `txid` data. `LocalChain` implements the `ChainOracle` trait. Any blockchain-source can also implement the `ChainOracle` trait.
  * `IndexedTxGraph` is introduced and contains two fields; an internal `TxGraph` struct and a `TxIndex` implementation. These two fields will be updated atomically and can replace the functionality of `keychain::Tracker`.

  **What is in-progress:**

  * ~@evanlinjin: The `TxIndex` trait should not have `is_{}_relevant` methods as we cannot guarantee this across all transaction indexes. We should introduce extension traits for these (https://github.com/bitcoindevkit/bdk/pull/926#discussion_r1159286393).~
  * ~@evanlinjin: `BlockAnchor` should be defined as "if this block is in chain, then this tx must be in chain". Therefore, the anchor does not provide us with the exact confirmation height of the tx. We need to introduce an extension trait `ExactConfirmationHeightAnchor` for certain operations (https://github.com/bitcoindevkit/bdk/pull/926#discussion_r1155480352).~

  **What will be done external to this PR:**

  * @rajarshimaitra: Persisting `indexed_tx_graph::Additions` (#937).
  * @notmandatory: Update examples to use redesigned structures.
  * Update `bdk::Wallet` to use the redesigned structures.

  ### Changelog notice

  * Initial implementation of the `bdk_chain` redesign (as mentioned in #895). Currently, only the `bdk_chain` core structures are implemented. Persistence and updates to the current examples and `bdk::Wallet` will be done in separate PRs.

  ### Checklists

  #### All Submissions:

  * [x] I've signed all my commits
  * [x] I followed the [contribution guidelines](https://github.com/bitcoindevkit/bdk/blob/master/CONTRIBUTING.md)
  * [x] I ran `cargo fmt` and `cargo clippy` before committing

  #### New Features:

  * [x] I've added tests for the new feature
  * [x] I've added docs for the new feature

ACKs for top commit:
  rajarshimaitra:
    ACK https://github.com/bitcoindevkit/bdk/pull/926/commits/b799a5728b7e08a18059ffee7fe7ee6078354977
  danielabrozzoni:
    Partial ACK b799a5728b7e08a18059ffee7fe7ee6078354977 - good job! I haven't looked at the tests or at the methods implementations in depth, but I have reviewed the architecture and it looks good. I have a few non-blocking questions.

Tree-SHA512: 8c386354cbd02f0701b5134991b65d206a54d19a2e78ab204e6ff1fa78a18f16299051bc0bf4ff4d2f5a0adab9b15658fa53cd0de2ca16969f4bf6a485225082

2 years ago[bdk_chain_redesign] Add tests for `IndexedTxGraph` with `LocalChain`
rajarshimaitra [Thu, 27 Apr 2023 14:09:21 +0000 (19:39 +0530)]
[bdk_chain_redesign] Add tests for `IndexedTxGraph` with `LocalChain`

These tests cover list_txout, list_utxo and balance methods.

2 years ago[bdk_chain_redesign] Implement `OwnedIndexer` for indexers
rajarshimaitra [Thu, 27 Apr 2023 14:08:35 +0000 (19:38 +0530)]
[bdk_chain_redesign] Implement `OwnedIndexer` for indexers

`SpkTxOutIndex` and `KeychainTxOutIndex` now both implement
`OwnedIndexer`.

2 years ago[bdk_chain_redesign] Fix calculation bugs.
rajarshimaitra [Thu, 27 Apr 2023 14:08:25 +0000 (19:38 +0530)]
[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.

2 years ago[bdk_chain_redesign] Fix `tx_graph::Additions::append` logic
志宇 [Fri, 28 Apr 2023 10:54:36 +0000 (18:54 +0800)]
[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.

2 years agoAdd sat_per_kwu to FeeRate
benthecarman [Thu, 27 Apr 2023 01:25:25 +0000 (20:25 -0500)]
Add sat_per_kwu to FeeRate

2 years ago[bdk_chain_redesign] Fix `tx_graph::Additions::append` logic
志宇 [Tue, 25 Apr 2023 17:09:19 +0000 (01:09 +0800)]
[bdk_chain_redesign] Fix `tx_graph::Additions::append` logic

2 years ago[bdk_chain_redesign] Change `insert_relevant_txs` method
志宇 [Sat, 22 Apr 2023 16:12:41 +0000 (00:12 +0800)]
[bdk_chain_redesign] Change `insert_relevant_txs` method

Instead 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.

2 years ago[bdk_chain_redesign] Docs for `is_mature` and `is_confirmed_and_spendable`
志宇 [Sat, 22 Apr 2023 15:39:49 +0000 (23:39 +0800)]
[bdk_chain_redesign] Docs for `is_mature` and `is_confirmed_and_spendable`

Docs are updated to explain why `is_mature` and
`is_confirmed_and_spendable` may return false-negatives.

2 years ago[bdk_chain_redesign] Make `insert_relevant_txs` topologically-agnostic
志宇 [Sat, 22 Apr 2023 14:56:51 +0000 (22:56 +0800)]
[bdk_chain_redesign] Make `insert_relevant_txs` topologically-agnostic

The `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.

2 years ago[bdk_chain_redesign] Add test for `insert_relevant_txs`
志宇 [Fri, 21 Apr 2023 06:39:13 +0000 (14:39 +0800)]
[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

2 years ago[bdk_chain_redesign] Various tweaks and fixes
志宇 [Fri, 21 Apr 2023 05:29:44 +0000 (13:29 +0800)]
[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.

2 years ago[bdk_chain_redesign] Revert changes to `SparseChain`
志宇 [Fri, 21 Apr 2023 04:33:03 +0000 (12:33 +0800)]
[bdk_chain_redesign] Revert changes to `SparseChain`

2 years ago[bdk_chain_redesign] Rm unnecessary code and premature optimisation
志宇 [Thu, 20 Apr 2023 10:07:26 +0000 (18:07 +0800)]
[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`.

2 years ago[bdk_chain_redesign] Rm `HashSet` from `TxGraph::relevant_heights`
志宇 [Thu, 20 Apr 2023 07:56:28 +0000 (15:56 +0800)]
[bdk_chain_redesign] Rm `HashSet` from `TxGraph::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.

2 years ago[bdk_chain_redesign] Test `LocalChain`
志宇 [Thu, 20 Apr 2023 07:29:20 +0000 (15:29 +0800)]
[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.

2 years ago[bdk_chain_redesign] Add tests for `TxGraph::relevant_heights`
志宇 [Wed, 19 Apr 2023 08:14:52 +0000 (16:14 +0800)]
[bdk_chain_redesign] Add tests for `TxGraph::relevant_heights`

2 years ago[bdk_chain_redesign] Remove incomplete logic
志宇 [Wed, 19 Apr 2023 04:21:39 +0000 (12:21 +0800)]
[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.

2 years ago[bdk_chain_redesign] Fix `Anchor` definition + docs
志宇 [Mon, 17 Apr 2023 15:25:57 +0000 (23:25 +0800)]
[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.

2 years agoMerge bitcoindevkit/bdk#932: Fix policy condition calculation
Steve Myers [Sat, 15 Apr 2023 03:46:02 +0000 (22:46 -0500)]
Merge bitcoindevkit/bdk#932: Fix policy condition calculation

ebd6103e6597e0a66470541d2fcd25709ea77866 Fix policy condition calculation (Alekos Filini)

Pull request description:

  ### Description

  When constructing the `Condition` struct we recursively call `get_condition` on all the items in a threshold and short-circuit if there's an error somewhere (for example, because the policy-path hasn't been provided for a specific threshold).

  This can cause issues when the user doesn't care about a subtree, because we still try to call `get_condition` on all the items and fail if something is missing, even if the specific subtree isn't selected and won't be used later on.

  This commit changes the logic so that we first filter only the `selected` items, and then unwrap the error using the question mark. If errors happened somewhere else they will be ignored, as they should.

  ### Notes to the reviewers

  I think it makes sense to backport this to `0.27`: even though it's not a critical issue (and there's a workaround[^1] for the bug) it may be a while before the new `1.0` is released. I wouldn't do a release just for this, but I would just leave it there and maybe in a few weeks if there are other fixes to be backported to pre-1.0 they could all be released.

  ### Changelog notice

  - Fixed a bug in the policy condition calculation

  ### Checklists

  #### All Submissions:

  * [x] I've signed all my commits
  * [x] I followed the [contribution guidelines](https://github.com/bitcoindevkit/bdk/blob/master/CONTRIBUTING.md)
  * [x] I ran `cargo fmt` and `cargo clippy` before committing

  #### New Features:

  * [ ] I've added tests for the new feature
  * [ ] I've added docs for the new feature

  #### Bugfixes:

  * [ ] This pull request breaks the existing API
  * [x] I've added tests to reproduce the issue which are now passing
  * [ ] I'm linking the issue being fixed by this PR

  [^1]: The workaround is to simply set the items in the policy tree even if they won't be used. For example, if the item causing troubles is a `thresh(1, ...)` just set `[0]` in the policy path for that id.

ACKs for top commit:
  notmandatory:
    ACK ebd6103e6597e0a66470541d2fcd25709ea77866

Tree-SHA512: 1e0c6140e47ead3a518656cab660932b40f9e67425ce144f072267c30fd5cae5923ba943d9682af050c8f314756c522260abb68b104b9eeaae597319612984db

2 years agoInclude tests for new updates of TxGraph
rajarshimaitra [Sat, 8 Apr 2023 15:32:33 +0000 (21:02 +0530)]
Include tests for new updates of TxGraph

2 years ago[bdk_chain_redesign] MOVE `TxIndex` into `indexed_chain_graph.rs`
志宇 [Wed, 12 Apr 2023 03:24:05 +0000 (11:24 +0800)]
[bdk_chain_redesign] MOVE `TxIndex` into `indexed_chain_graph.rs`

`tx_graph.rs` is rearranged as well.

2 years ago[bdk_chain_redesign] Remove `IndexedTxGraph::last_height`
志宇 [Mon, 10 Apr 2023 08:51:16 +0000 (16:51 +0800)]
[bdk_chain_redesign] Remove `IndexedTxGraph::last_height`

It is better to have this external to this structure.

2 years ago[bdk_chain_redesign] Documentation improvements
志宇 [Mon, 10 Apr 2023 08:23:10 +0000 (16:23 +0800)]
[bdk_chain_redesign] Documentation improvements

2 years ago[bdk_chain_redesign] Simplify `LocalChain`
志宇 [Mon, 10 Apr 2023 07:04:20 +0000 (15:04 +0800)]
[bdk_chain_redesign] Simplify `LocalChain`

Remove the requirement that evicted blocks should have in-best-chain
counterparts in the update.

2 years ago[bdk_chain_redesign] Consistent `ChainOracle`
志宇 [Mon, 10 Apr 2023 05:03:51 +0000 (13:03 +0800)]
[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.

2 years ago[bdk_chain_redesign] Improve `BlockAnchor` docs
志宇 [Fri, 7 Apr 2023 01:23:00 +0000 (09:23 +0800)]
[bdk_chain_redesign] Improve `BlockAnchor` docs

2 years ago[bdk_chain_redesign] More tweaks and renamings
志宇 [Wed, 5 Apr 2023 11:13:42 +0000 (19:13 +0800)]
[bdk_chain_redesign] More tweaks and renamings

2 years ago[bdk_chain_redesign] Modify signature of `TxIndex`
志宇 [Wed, 5 Apr 2023 10:17:08 +0000 (18:17 +0800)]
[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.

2 years ago[bdk_chain_redesign] Introduce `Append` trait for additions
志宇 [Wed, 5 Apr 2023 09:29:20 +0000 (17:29 +0800)]
[bdk_chain_redesign] Introduce `Append` trait for additions

Before, we were using `core::ops::AddAsign` but it was not the most
appropriate.

2 years ago[bdk_chain_redesign] Better names, comments and generic bounds
志宇 [Wed, 5 Apr 2023 08:39:54 +0000 (16:39 +0800)]
[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.

2 years ago[bdk_chain_redesign] `chain_oracle::Cache`
志宇 [Wed, 5 Apr 2023 02:57:26 +0000 (10:57 +0800)]
[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`.

2 years agoFix policy condition calculation
Alekos Filini [Fri, 31 Mar 2023 18:08:23 +0000 (20:08 +0200)]
Fix policy condition calculation

When constructing the `Condition` struct we recursively call
`get_condition` on all the items in a threshold and short-circuit if
there's an error somewhere (for example, because the policy-path hasn't
been provided for a specific threshold).

This can cause issues when the user doesn't care about a subtree, because
we still try to call `get_condition` on all the items and fail if
something is missing, even if the specific subtree isn't selected and
won't be used later on.

This commit changes the logic so that we first filter only the `selected`
items, and then unwrap the error using the question mark. If errors
happened somewhere else they will be ignored, as it should.

2 years ago[bdk_chain_redesign] Add serde support for `IndexedAdditions`
志宇 [Fri, 31 Mar 2023 14:55:57 +0000 (22:55 +0800)]
[bdk_chain_redesign] Add serde support for `IndexedAdditions`

2 years ago[bdk_chain_redesign] Added methods to `LocalChain`
志宇 [Fri, 31 Mar 2023 14:42:47 +0000 (22:42 +0800)]
[bdk_chain_redesign] Added methods to `LocalChain`

Also made the `IndexedTxGraph::index` field public (`index()` and
`index_mut()` methods are no longer needed).

2 years ago[bdk_chain_redesign] `TxGraph` tweaks
志宇 [Fri, 31 Mar 2023 06:15:34 +0000 (14:15 +0800)]
[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

2 years ago[bdk_chain_redesign] Simplify `TxIndex`
志宇 [Fri, 31 Mar 2023 04:39:00 +0000 (12:39 +0800)]
[bdk_chain_redesign] Simplify `TxIndex`

2 years ago[bdk_chain_redesign] Revert some API changes
志宇 [Thu, 30 Mar 2023 10:33:53 +0000 (18:33 +0800)]
[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`.

2 years ago[bdk_chain_redesign] Make default anchor for `TxGraph` as `()`
志宇 [Thu, 30 Mar 2023 10:14:44 +0000 (18:14 +0800)]
[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.

2 years ago[bdk_chain_redesign] Initial work on `LocalChain`.
志宇 [Wed, 29 Mar 2023 14:45:01 +0000 (22:45 +0800)]
[bdk_chain_redesign] Initial work on `LocalChain`.

2 years ago[bdk_chain_redesign] Rm anchor type param for structs that don't use it
志宇 [Tue, 28 Mar 2023 06:58:59 +0000 (14:58 +0800)]
[bdk_chain_redesign] Rm anchor type param for structs that don't use it

2 years ago[bdk_chain_redesign] Add docs
志宇 [Tue, 28 Mar 2023 02:58:23 +0000 (10:58 +0800)]
[bdk_chain_redesign] Add docs

2 years ago[bdk_chain_redesign] `IndexedTxGraph` keeps track of the last synced height
志宇 [Mon, 27 Mar 2023 14:42:39 +0000 (22:42 +0800)]
[bdk_chain_redesign] `IndexedTxGraph` keeps track of the last synced height

This is important as a `ChainOracle` implementation is updated
separately to an `IndexedTxGraph`.

2 years ago[bdk_chain_redesign] Fix `apply_additions` logic for `IndexedTxGraph`.
志宇 [Mon, 27 Mar 2023 13:51:11 +0000 (21:51 +0800)]
[bdk_chain_redesign] Fix `apply_additions` logic for `IndexedTxGraph`.

2 years ago[bdk_chain_redesign] `mut_index` should be `index_mut`
志宇 [Mon, 27 Mar 2023 12:56:42 +0000 (20:56 +0800)]
[bdk_chain_redesign] `mut_index` should be `index_mut`

2 years ago[bdk_chain_redesign] Add balance methods to `IndexedTxGraph`
志宇 [Mon, 27 Mar 2023 11:55:57 +0000 (19:55 +0800)]
[bdk_chain_redesign] Add balance methods to `IndexedTxGraph`

2 years ago[bdk_chain_redesign] Add `apply_additions` to `IndexedTxGraph`
志宇 [Mon, 27 Mar 2023 07:36:37 +0000 (15:36 +0800)]
[bdk_chain_redesign] Add `apply_additions` to `IndexedTxGraph`

* Get mutable index from `IndexedChainGraph`.
* Also add `apply_additions` method to `TxIndex` trait.

2 years ago[bdk_chain_redesign] MOVE: `IndexedTxGraph` into submodule
志宇 [Mon, 27 Mar 2023 06:21:10 +0000 (14:21 +0800)]
[bdk_chain_redesign] MOVE: `IndexedTxGraph` into submodule

2 years ago[bdk_chain_redesign] List chain data methods can be try/non-try
志宇 [Mon, 27 Mar 2023 05:59:51 +0000 (13:59 +0800)]
[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>`.

2 years ago[bdk_chain_redesign] Add `..in_chain` methods
志宇 [Sun, 26 Mar 2023 03:24:30 +0000 (11:24 +0800)]
[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).

2 years ago[bdk_chain_redesign] Introduce `ChainOracle` and `TxIndex` traits
志宇 [Fri, 24 Mar 2023 07:47:39 +0000 (15:47 +0800)]
[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`.

2 years ago[bdk_chain_redesign] Introduce `BlockAnchor` trait
志宇 [Fri, 24 Mar 2023 01:23:36 +0000 (09:23 +0800)]
[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.

2 years agoAdd description to file_store cargo metadata
Steve Myers [Mon, 20 Mar 2023 17:45:33 +0000 (12:45 -0500)]
Add description to file_store cargo metadata

2 years agoRemove keyword from file_store cargo metadata
Steve Myers [Mon, 20 Mar 2023 17:37:22 +0000 (12:37 -0500)]
Remove keyword from file_store cargo metadata

2 years agoAdd bdk_chain README v1.0.0-alpha.0
Steve Myers [Mon, 20 Mar 2023 17:09:21 +0000 (12:09 -0500)]
Add bdk_chain README

2 years agoBump bdk version to 1.0.0-alpha.0
Steve Myers [Mon, 20 Mar 2023 04:00:37 +0000 (23:00 -0500)]
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

2 years agoFor examples and nursery remove workspace dependency versions
Steve Myers [Mon, 20 Mar 2023 04:03:09 +0000 (23:03 -0500)]
For examples and nursery remove workspace dependency versions

2 years agoMerge pull request #890 from evanlinjin/simplify-reveal-to-target-logic
志宇 [Sat, 18 Mar 2023 02:28:57 +0000 (10:28 +0800)]
Merge pull request #890 from evanlinjin/simplify-reveal-to-target-logic

Simplify `reveal_to_target` logic

2 years agoSimplify `reveal_to_target` logic
志宇 [Wed, 15 Mar 2023 07:38:25 +0000 (15:38 +0800)]
Simplify `reveal_to_target` logic

- Remove unnecessary check
- Better comments
- Better variable names
- Add test for scanning txouts with lookahead

2 years agoMerge pull request #889 from evanlinjin/add-async-syncing-esplora
志宇 [Fri, 17 Mar 2023 09:20:08 +0000 (17:20 +0800)]
Merge pull request #889 from evanlinjin/add-async-syncing-esplora

Add docs for `EsploraAsyncExt` and make doctests runnable

2 years agoAdd docs for `EsploraAsyncExt` and make doctests runnable
志宇 [Fri, 10 Mar 2023 00:40:27 +0000 (13:40 +1300)]
Add docs for `EsploraAsyncExt` and make doctests runnable

2 years agoMerge pull request #888 from rajarshimaitra/greamarly-fixes
志宇 [Wed, 15 Mar 2023 05:07:05 +0000 (16:07 +1100)]
Merge pull request #888 from rajarshimaitra/greamarly-fixes

Nit fixes on documentation

2 years agoAdd documentation fixes
rajarshimaitra [Fri, 10 Mar 2023 17:53:29 +0000 (23:23 +0530)]
Add documentation fixes

2 years agoMerge bitcoindevkit/bdk#793: bdk v1.0.0-alpha.0
Steve Myers [Tue, 14 Mar 2023 17:42:04 +0000 (12:42 -0500)]
Merge bitcoindevkit/bdk#793: bdk v1.0.0-alpha.0

bc3e05c6c671e927d0f954dac602f89a452b3d86 Doc fixes (Daniela Brozzoni)
352f95f55830b0bd1455966a932abc60607d5745 [ci] misc fixes (Daniela Brozzoni)
2fcf9c4adb0d188dd93d5efbc79171197460f43c Make async esplora futures Send (LLFourn)
5dd4ce74cf762184c318e17d5c1d094e47179d69 More documentation improvements (志宇)
ae9b19d84c779ed23506f11352bf0d8c7b1f00b1 `bdk` README improvements (志宇)
def0c9ed397d1e0b94581fafae281f27c31f16ab Add `wallet_esplora_async` example and various fixes (志宇)
26ab2e2d6c1cd90ab1042c3f415ca26464a4c557 Implement EsploraExt for Async client (Vladimir Fomene)
ab9242d10ddaaafae3f6433966658af882d1f735 Replace current caching solution with Rust Cache (Vladimir Fomene)
0aaf420f6d4de3010d3c193d63a904c76c8391a5 examples: exit if balance < SEND_AMOUNT (Daniela Brozzoni)
47faa881fb5669702999d38300fed2e03c0021b1 Fix cargo clippy (Daniela Brozzoni)
9d26121dbc6e0209f4154594c9884600f1298cf3 Improve stdout output for wallet esplora/electrum examples (志宇)
eddd74887017b1aa2d08e079ad3669b455a5d40a Add `wallet_electrum` example (志宇)
0505cd72424a621825f8312af2e342b13a1fc65d Remove transaction-based type parameters and traits (志宇)
de9457fce67f5bdc7a128f68d2e14ec4d4f8947b Changed `inflate_update` logic to not depend on `Cow` (志宇)
69cf6d7924c4599e6a4fd4cd52c291e640324a8f Use os-specific temp dir for `wallet_esplora` example (志宇)
b3836cb30839e1f0b41cb595b4a33b2f47ce04ce Use hardcoded send amount for `wallet_esplora` example (志宇)
b0829322688229120044940160b505f434d7617f Add the wallet_esplora example (Daniela Brozzoni)
d267517dbd24b501415a8dcbb0f937504b093515 NewError implements StdError (fix typo) (Daniela Brozzoni)
0c7a0abb1941f7f03f28fd0ddfe18609d1316fb2 Disable code coverage (Daniela Brozzoni)
dfcbafd6b10746a967c63e7a835ba07ac990e828 Use action-rs/toolchain in CI (Daniela Brozzoni)
0ba41c57515566e3eae15d52fba1ff9422ec5fe8 Make bdk_esplora wasm compatible again (Daniela Brozzoni)
a38f63359d02f508dc987c8a985d34e393d831a8 Make bdk_file_store use bincode v1 (LLFourn)
38ef170ed1be43c60dd34aebd14997ab0082a3ca Make bdk and bdk_chain work under 1.57.0 (Steve Myers)
3a5d7278999d1be9a9edb5d161dfaeed80e255b9 Update workspace dependencies to be relative paths (Steve Myers)
96d932c8305bb6502529918ac6d94b0264458358 Add clippy.toml (Daniela Brozzoni)
5708bf0c8c33bd769baf8fe7d5bd34689511019b Fix docs (Daniela Brozzoni)
5acee8249621a90498e7b1b814b8c2fbbd45022b Update rust stable in CI (1.67.0) (Daniela Brozzoni)
8c9bcebc71c1d721e53c293359198c26122832aa Fix the "repository" field in Cargo.toml (Daniela Brozzoni)
c61b3604e167194516719da75c01653cef5dae6e Fix cargo clippy warnings (Daniela Brozzoni)
1805bd35c0530133e238bbf8d9a41d84e03e058d Fix clippy (Daniela Brozzoni)
3f5a78ae3b1e6c3f0a6acc98bb2445c895cfd743 Disable test-hardware-signer (Daniela Brozzoni)
303a1703c99e9cd02ded904e7e4409cedc21fe75 Rust fmt (Daniela Brozzoni)
b5559767db7e8f389415dfe135907063e21598b8 Rename the stub wallet examples (LLFourn)
2e82cd8c0406e2a0d2a7b40d77f7d0a169b9b9f8 Use tempfile for file_store tests (LLFourn)
c069b0fb4171aa11e980e8e070982d3046e07110 Move everything else over 🎉 (LLFourn)
949608ab1f0ae6ee4d3aad271a24f920068ccb3b Move bdk_electrum into the bdk repo :tada: (Daniela Brozzoni)
03deafb5538e55462443cd8ead0114bf788a7765 Move bdk_file_store into the bdk repo :tada: (Daniela Brozzoni)
37dfa77d9d732b8a48019b8457051659004ab6d9 Move bdk_chain into the bdk repo :tada: (Daniela Brozzoni)
f2188f9dcd094e65fcb5649004ef19c7d4b7ec30 Make lib.rs's docs be the README.md (LLFourn)
1c970a9295044de47da5ef92208b901fb4d9ec44 Fix code coverage CI (Daniela Brozzoni)
94a084aafde5285f0a677a98aa60d4375a62c1d7 Fix doc links (LLFourn)
9edbdf54c9de841db01a741c09017ccca70b76bc [ci] Fix feature flags (LLFourn)
20e45b7af055733af6863a6a297b03a7dc13c8d7 Add back test-hardware-signer feature (LLFourn)
6d05598407aae448ed1ca55a9a446e7cfc029bee Remove test-readme-examples (LLFourn)
b60820a7b5b506421bd6eeed14aaeada750e5f1c Remove authors.workspace because older cargo don't like (LLFourn)
22bec6d363bb3349e26f56243bef9e72277a6790 Delete unused errors (LLFourn)
8a6de3aa2dc9bac479f059630d0788ec1e62301d Convert to workspace (LLFourn)
fdfc9b9ede74ff24df51a33106caf4b5af702a69 Delete unused things (LLFourn)
e1eb0253cf34053a4cb93e7be0ec2d74281eff47 Make doctests work (LLFourn)
3baf9721ec28384fc322909570394e76f8f2c991 Use bdk_chain Balance (LLFourn)
b310a7afdd80f416e35aaeffae1e17b4e1d8a24e Add Wallet::cancel_tx (LLFourn)
5985706c1a8c6358d840eb12ed678836b56ffb02 Add wallet persistence (LLFourn)
57538e53e4f834942ba25c72531a9bbf69982284 Move tests to /tests (LLFourn)
a40da9ba6c41d714d611da35f8868a496df2a767 Make bdk no_std (LLFourn)
aab2b12f7ad57be8dc2c26ff33c44769425cdac4 bdk_core integration initial commit 🔥 (LLFourn)
544c397a38f272f0ac2ffa1a3195fe6a07f2ddbd Modified build, clippy and test steps (志宇)

Pull request description:

  We prepare the BDK repo for a major restructuring 🔥. This PR maintains the existing wallet API as much as possible and adds very little.

  ## Things Done

  - database modules removed
  - blockchain gutted but new esplora syncing code added (this will be gone soon hopefully).
  - minimal API changes.
  - Many macros removed.
  - no longer applicable examples removed.
  - Much conditional compilation removed. Can compile with `--all-features` now.
  - All wallet tests passing
  - TestClient moved into its own repo
  - Example using `esplora`

  ## APIs changed

  - wallet no longer has a `sync` method. This is replaced with `apply_wallet_scan`.
  - address "caching" is gone. You can just change the derivation index with `ensure_derived_up_to` which sets your derivation to at least the argument. Unlike `ensure_addresses_cached` used to do this will alter what getting a new address gives you.
  - `AddressIndex::Reset` is gone. This thing didn't make much sense and is hard to do with the more sane internals we've established. Changing the derivation index changes what script pubkeys the wallet will search so this is dangerous. We plan to add method like `trim_unused` which lowers the derivation index to the highest unused index. Applications must handle giving out old addresses manually now (which I think is good).

  ## Unfinished work

  - [x] esplora example doesn't work for mempool transactions yet (seems like our esplora in testclient doesn't index mempool??).
  - [x] we need to figure out a way to retrieve and store transaction timestamps (we're currently just setting them to `u64::MAX`). In `bdk_core` we never got around to doing this but it needs to be done.
  - [x] A few insights we got from doing this PR should be applied to bdk_core first.
  - [x] doctests not working.

  ### Notes to the reviewers

  Try not to review the actual changes. This PR will be forced pushed a bit so it will be likely wasted.
  I think I did a faithful job of translating the tests. A bit of review here would be helpful.

  I *do* think it would be good to merge this PR soon into the v1 branch so we have something to work off once unfinished work is done.
  Checking out the branch and poke around and give feedback would be the most helpful thing.

  Run the (sort of) working example:

  ```
  cargo run --example esplora --features="bdk_test_client/bitcoind_22_0 bdk_test_client/esplora esplora"
  ```
  ### Checklists

  #### All Submissions:

  * [x] I've signed all my commits
  * [x] I followed the [contribution guidelines](https://github.com/bitcoindevkit/bdk/blob/master/CONTRIBUTING.md)
  * [x] I ran `cargo fmt` and `cargo clippy` before committing

  #### Bugfixes:

  * [x] This pull request breaks the existing API
  * [ ] I'm linking the issue being fixed by this PR (there's too many!)

ACKs for top commit:
  danielabrozzoni:
    ACK bc3e05c6c671e927d0f954dac602f89a452b3d86

Tree-SHA512: b5fbfd2263bb2a7cbf7b486530e639683775209bea944b266efd9c0447fb632295f7f5ddbd2e8d79796338415eaca26f1876617c2b66523485167b22e75e449e

2 years agoDoc fixes
Daniela Brozzoni [Mon, 13 Mar 2023 21:23:40 +0000 (22:23 +0100)]
Doc fixes

2 years ago[ci] misc fixes
Daniela Brozzoni [Fri, 10 Mar 2023 12:10:16 +0000 (13:10 +0100)]
[ci] misc fixes

LLFourn is squashing these to get them all signed:

Remove useless clippy allow

ci: use clippy action

[ci] remove check for features=default

2 years agoMake async esplora futures Send
LLFourn [Fri, 10 Mar 2023 01:12:00 +0000 (12:12 +1100)]
Make async esplora futures Send

2 years agoMore documentation improvements
志宇 [Fri, 10 Mar 2023 00:40:27 +0000 (13:40 +1300)]
More documentation improvements

2 years ago`bdk` README improvements
志宇 [Thu, 9 Mar 2023 03:34:48 +0000 (16:34 +1300)]
`bdk` README improvements

2 years agoAdd `wallet_esplora_async` example and various fixes
志宇 [Wed, 8 Mar 2023 21:59:18 +0000 (10:59 +1300)]
Add `wallet_esplora_async` example and various fixes

Fixes include:
* Allow `bdk_esplora` to use async with tls
* Reorganize `bdk_esplora` crate to have separate files for
  async vs blocking
* Use optional dependencies for `bdk_esplora` async

2 years agoImplement EsploraExt for Async client
Vladimir Fomene [Tue, 7 Mar 2023 14:04:06 +0000 (17:04 +0300)]
Implement EsploraExt for Async client

Creates a separate async EsploraAsyncExt trait for the
async client using async-trait crate. It has thesame
methods as the EsploraExt trait for the blocking client.
This trait is implemented on the AsyncClient of the
rust-esplora-client crate.

2 years agoReplace current caching solution with Rust Cache
Vladimir Fomene [Wed, 8 Mar 2023 10:49:54 +0000 (13:49 +0300)]
Replace current caching solution with Rust Cache

2 years agoexamples: exit if balance < SEND_AMOUNT
Daniela Brozzoni [Wed, 8 Mar 2023 14:20:36 +0000 (15:20 +0100)]
examples: exit if balance < SEND_AMOUNT