1768 Commits

Author SHA1 Message Date
志宇
06a956ad20
feat!: change load_from_persistence to return an option
`PersistBackend::is_empty` is removed. Instead, `load_from_persistence`
returns an option of the changeset. `None` means persistence is empty.
This is a better API than a separate method. We can now differentiate
between a persisted single changeset and nothing persisted.

`Store::aggregate_changeset` is refactored to return a `Result` instead
of a tuple. A new error type (`AggregateChangesetsError`) is introduced
to include the partially-aggregated changeset in the error. This is a
more idiomatic API.
2023-11-16 07:07:49 +08:00
志宇
c3265e2514
test(bdk): add tests for wallet constructor methods 2023-11-16 07:07:49 +08:00
志宇
96f1d94e2c
test(file_store): add construction method tests 2023-11-16 07:07:48 +08:00
志宇
1886dc4fe7
chore(examples): use Wallet::new_or_load method where appropriate 2023-11-16 07:07:48 +08:00
志宇
24994a3ed4
feat(file_store)!: have separate methods for creating and opening Store 2023-11-16 07:07:48 +08:00
志宇
d294e2e318
feat(wallet)!: add new_or_load methods
These methods try to load wallet from persistence and initializes the
wallet instead if non-existant.

An internal helper method `create_signers` is added to reuse code.
Documentation is also improved.
2023-11-16 07:07:48 +08:00
志宇
7c6cbc4d9f
chore(file_store): rm empty test file 2023-11-16 07:04:08 +08:00
志宇
6cf3963c6c
feat(bdk)!: have separate methods for creating and loading Wallet
`Wallet::new` now creates a new wallet. `Wallet::load` loads an existing
wallet. The network type is now recoverable from persistence. Error
types have been simplified.
2023-11-16 07:04:08 +08:00
志宇
7d5f31f6cc
feat(chain, file_store): add is_empty method to PersistBackend trait 2023-11-16 07:01:56 +08:00
志宇
5998a22819
feat!: LocalChain with hardwired genesis checkpoint
This ensures that `LocalChain` will always have a tip. The `ChainOracle`
trait's `get_chain_tip` method no longer needs to return an option.
2023-11-16 06:41:18 +08:00
Steve Myers
d6a0cf0795
Merge commit 'refs/pull/1121/head' of github.com:bitcoindevkit/bdk 2023-11-14 11:51:48 -06:00
Einherjar
6e27e66738
feat: add dependabot
Fixes #1118.
Adds `dependabot.yml` to `.github/` to check for `"github-action"`
updates on a `"weekly"` basis.
This does not touch Rust code or Cargo workflows.

It will  create PRs and we would need to approve them
(they would be subject to the same merge policy)
to instantiate the proposed dependabots into `master`.
2023-11-14 11:26:52 -06:00
Daniela Brozzoni
f382fa9230
Merge bitcoindevkit/bdk#1202: fix(chain): filter coinbase tx not in best chain
991cb77b6fbeedbf52d1bd9aa6b3d680f8269969 fix(chain): filter coinbase tx not in best chain (Wei Chen)

Pull request description:

  ### Description

  Fixes #1144.
  Coinbase transactions cannot exist in the mempool and be unconfirmed. `TxGraph::try_get_chain_position` should always return `None` for coinbase transactions not anchored in best chain.

  ### 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:

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

ACKs for top commit:
  notmandatory:
    ACK 991cb77b6fbeedbf52d1bd9aa6b3d680f8269969
  danielabrozzoni:
    ACK 991cb77b6fbeedbf52d1bd9aa6b3d680f8269969

Tree-SHA512: 9e06d8404708eee050c96807a876a470303f4983666c82c56c17d97c2d4b72784e75271279fd393c53a6a967a352aea1ef2762da71ac4bb58f7a0c2f05354948
2023-11-14 14:58:46 +01:00
Daniela Brozzoni
e71770f93e
Merge bitcoindevkit/bdk#1206: chore: rename ConfirmationTimeAnchor to ConfirmationTimeHeightAnchor
0112c67b6031b55a6c73f797db52d64a1b4ee38a chore: rename `ConfirmationTimeAnchor` to `ConfirmationTimeHeightAnchor` (Wei Chen)

Pull request description:

  ### Description

  Closes #1187.
  An `Anchor` implementation that records both height and time should have both attributes included in the name.

  ### 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 0112c67b6031b55a6c73f797db52d64a1b4ee38a

Tree-SHA512: 024cbc83c8aca36baeaf2ce36979d62f235ffea7702e7ac8d4e7669cbc1730f7e1469ba78bf3da6c5a14abedbf1a9e832bdd66fdaa154ad2bef29cb187e1c504
2023-11-14 14:52:30 +01:00
Daniela Brozzoni
298f6cb1e8
ci: Pin jobserver after cc
Since now only cc depends on jobserver, it should be pinned after we pin cc
2023-11-13 19:06:54 +01:00
Daniela Brozzoni
3fdab87ee7
Merge bitcoindevkit/bdk#1200: fix(bdk): Check if we're using the correct internal key before signing
e553231eae45dc6d263a1fce2a3a9c46f6af2510 fix(bdk): Check if we're using the correct... ...internal key before signing (Daniela Brozzoni)

Pull request description:

  ### Description

  Fixes #1142

  We would previously sign with whatever x_only_pubkey we had in hand, without first checking if it was the right key or not. This effectively meant that adding multiple taproot PrivateKey signers would produce unbroadcastable transactions.

  ### Changelog notice

  - Fix a bug related to taproot signing with internal keys. We would previously sign with the first private key we had, without checking if it was the correct internal key or not.

  ### 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:

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

ACKs for top commit:
  evanlinjin:
    ACK e553231eae45dc6d263a1fce2a3a9c46f6af2510

Tree-SHA512: c4abbcd27935b8ce80a70b6e0843507866e3d075939f0b01504c090929ed96b4b9c6fee599f701e69960a6c86175682cc6d7f8cc4c3fb1d08a74b7563f8ca145
2023-11-13 10:09:02 +01:00
Daniela Brozzoni
855c61a6ab
Merge bitcoindevkit/bdk#1145: fix(electrum): fixed chain sync issue
1010efd8d68e886cc46f0ac2f016630b670ea73c fix(electrum): fixed chain sync issue (Wei Chen)

Pull request description:

  ### Description

  This may or may not fix #1125.
  Fixed what appeared to be a logic error in `construct_update_tip` in `electrum_ext.rs` that caused the local chain tip to always be a block behind the newest confirmed block.

  ### 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:

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

ACKs for top commit:
  danielabrozzoni:
    ACK 1010efd8d68e886cc46f0ac2f016630b670ea73c - although I've been able to reproduce the issue in #1125, I'm convinced that this PR fixes at least a bug, as demonstrated in #1171 (yet to be reviewed and merged).

Tree-SHA512: 92790e9072d17be74d2cd24bec3503e1ad5d97f728ee81490eeb09ac3f8d4a3a7e8d9628e943bc801246d5bfd345152c11d5dbe25246f5a57b3118727d3ae315
2023-11-13 09:36:10 +01:00
Wei Chen
0112c67b60
chore: rename ConfirmationTimeAnchor to ConfirmationTimeHeightAnchor
An `Anchor` implementation that records both height and time should have
both attributes included in the name.
2023-11-12 21:31:47 +08:00
Wei Chen
1010efd8d6
fix(electrum): fixed chain sync issue
Fixed a logic error in `construct_update_tip` in `electrum_ext.rs` that caused
the local chain tip to always be a block behind the newest confirmed block.
2023-11-11 20:52:37 +08:00
Wei Chen
991cb77b6f
fix(chain): filter coinbase tx not in best chain
Coinbase transactions cannot exist in the mempool and be unconfirmed.
`TxGraph::try_get_chain_position` should always return `None` for coinbase
transactions not anchored in best chain.
2023-11-11 02:55:58 +08:00
Daniela Brozzoni
e553231eae
fix(bdk): Check if we're using the correct...
...internal key before signing

Fixes #1142

We would previously sign with whatever x_only_pubkey we had in hand,
without first checking if it was the right key or not. This effectively
meant that adding multiple taproot PrivateKey signers would produce
unbroadcastable transactions.
2023-11-10 18:25:46 +01:00
Daniela Brozzoni
0a7b60f0f7
Merge bitcoindevkit/bdk#1109: Further improve unconfirmed tx conflict resolution
afbf83c8b0d5c97495e6ceaa39963415edef6911 chain(fix): conflict resolution for txs with same last_seen (Wei Chen)

Pull request description:

  ### Description

  Fixes #1102. If a conflicting tx has the same `last_seen`, then we check lexicographical sorting of txids.

  ### Notes to the reviewers

  The tests for this fix exist in the `TxTemplate` structure in #1064 which may need to be merged first.

  ### 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:
  danielabrozzoni:
    ACK afbf83c8b0d5c97495e6ceaa39963415edef6911

Tree-SHA512: 91b8fbff305b715247501b861ab7ea9e9d9ef99248b05d14e01aacf7e64ad7826f35773e8998cf421dbd04f663714026084c6e817ac5365bce4844c8ea3b7e3f
2023-11-09 10:07:18 +01:00
Daniela Brozzoni
0ecc0280c0
doc(bdk): Clarify the absolute_fee, fee_rate docs
Fixes #1066
2023-11-09 09:00:49 +01:00
Wei Chen
afbf83c8b0
chain(fix): conflict resolution for txs with same last_seen
The tx conflict `Scenario` test for unconfirmed txs with the same
last_seen has been amended for its corresponding conflict
resolution bug fix.
2023-11-09 05:46:09 +08:00
志宇
2f2f138595
Merge bitcoindevkit/bdk#1182: chore: fix MSRV for flate2
95250fc44ed1372e77995d04ac2b380e0cb126a0 ci(chain): downgrade hashbrown dependency to 0.9.1 to fix ahash related MSRV issue (Steve Myers)
f17df1e1338c63cb79b5f9b2223dba347244c432 ci: more fixed dependencies for MSRV 1.57.0 (Vladimir Fomene)

Pull request description:

ACKs for top commit:
  notmandatory:
    ACK 95250fc44ed1372e77995d04ac2b380e0cb126a0
  realeinherjar:
    ACK 95250fc44ed1372e77995d04ac2b380e0cb126a0
  evanlinjin:
    ACK 95250fc44ed1372e77995d04ac2b380e0cb126a0

Tree-SHA512: ad090713d97cf778598bb4acee200d7acbc987fe74964f171cc9939149251bddce9474b750371df26d3f6548780f4db2c17b3fe2cf5f6d627c808d682c929918
2023-11-06 11:15:16 +08:00
Steve Myers
95250fc44e
ci(chain): downgrade hashbrown dependency to 0.9.1 to fix ahash related MSRV issue 2023-11-03 21:51:04 -05:00
Vladimir Fomene
f17df1e133
ci: more fixed dependencies for MSRV 1.57.0 2023-11-03 21:50:11 -05:00
Steve Myers
3569acca0b
chore: add meta data to bitcoind_rpc crate 2023-10-12 09:33:34 -05:00
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
v1.0.0-alpha.2
2023-10-11 17:30:36 -05:00
Daniela Brozzoni
6ebdd195e2
Merge bitcoindevkit/bdk#1164: ref(chain): Rename direct_conflicts_of_tx to direct_conflitcs
d5c87c49a82c5cd3a4558e61fe9984f0ae8c6cb7 ref(chain): Rename direct_conflicts_of_tx to... ...direct_conflitcs (Daniela Brozzoni)
009408d24361235c1d85b7d147983cff7b0fc191 ci: Pin jobserver to 0.1.26 to keep MSRV (Daniela Brozzoni)

Pull request description:

  Fixes #1138

  ### Changelog notice

  - rename `TxGraph::direct_conflicts_of_tx` to `TxGraph::direct_conflicts`

  ### 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:
  evanlinjin:
    ACK d5c87c49a82c5cd3a4558e61fe9984f0ae8c6cb7

Tree-SHA512: 10072c65025d5fcc5d90c61ecba1dad53bcd10929326ab18ddadb21322841203aa5861adc9c5f200bbc57b0fe59dd4859dc3672870a0ad343fd8a660fd8aa40e
2023-10-10 17:16:54 +02:00
Daniela Brozzoni
d5c87c49a8
ref(chain): Rename direct_conflicts_of_tx to...
...direct_conflitcs

Fixes #1138
2023-10-10 16:44:51 +02:00
Daniela Brozzoni
009408d243
ci: Pin jobserver to 0.1.26 to keep MSRV 2023-10-10 16:44:50 +02:00
Steve Myers
38d69c947c
Merge bitcoindevkit/bdk#1041: Add bitcoind_rpc chain source module.
85c62532a55cfc94eade4d20ca3075dc4cd4882e docs(bitcoind_rpc): better `Emitter::mempool` explanation (志宇)
b69c13ddf6aa7cfb9be8c841b255e7f5f13ad328 example_bitcoind_rpc: tweaks (志宇)
5f34df8489fedae2aa3fd001036cc9ef6abe9a7a bitcoind_rpc!: bring back `CheckPoint`s to `Emitter` (志宇)
57590e0a1f2dad09a63fadb11f01e9f704cdcffb bitcoind_rpc: rm `BlockHash` from `Emitter::last_mempool_tip` (志宇)
6d4b33ef91a6c3e3443f6321cf3e3d186f77c595 chain: split `IndexedTxGraph::insert_tx` into 3 methods (志宇)
4f5695d43add3eab37ab12e897ac7c49f0d0787e chain: improvements to `IndexedTxGraph` and `TxGraph` APIs (志宇)
150d6f8ab6cd1eb1c9448d61e7bd71db0dd32a01 feat(example_bitcoind_rpc_polling): add example for RPC polling (志宇)
4f10463d9eaad9365b87dd99d49f0ddb8be673ee test(bitcoind_rpc): add no_agreement_point test (志宇)
a73dac2d91b29c4ba05f606f81e511fbf1f9ec7f test(bitcoind_rpc): initial tests for `Emitter` (志宇)
bb7424d11d3a4bd837ddde0f42f9abd93d56aee1 feat(bitcoind_rpc): introduce `bitcoind_rpc` crate (志宇)
240657b1674ad901c77090ee1fa96dc0d71e91d7 chain: add batch-insert methods for `IndexedTxGraph` (志宇)
43bc813c6498b5b021d70a6127ff7e57d7337813 chain: add helper methods on `CheckPoint` (志宇)
b3db5ca9df4302fddcd5474569849371f2be7e2d feat(chain): add `AnchorFromBlockPosition` trait (志宇)
f795a43cc72fdb4ef26ca349c4cb4f4bfd3b90b5 feat(example_cli): allow chain specific args in examples (志宇)

Pull request description:

  ### Description

  This PR builds on top of #1034 and adds the `bitcoind_rpc` chain-src module and example.

  ### Notes to the reviewers

  Don't merge this until #1034 is in!

  ### Changelog notice

  * Add `bitcoind_rpc` chain-source module.
  * Add `example_bitcoind_rpc` example module.
  * Add `AnchorFromBlockPosition` trait which are for anchors that can be constructed from a given block, height and position in block.
  * Add helper methods to `IndexedTxGraph` and `TxGraph` for batch operations and applying blocks directly.
  * Add helper methods to `CheckPoint` for easier construction from a block `Header`.

  ### Checklists

  * [x] Add test: we should detect when an initially-confirmed transaction is "unconfirmed" during a reorg.
  * [x] Improve `example_bitcoind_rpc`: add `live` command.
  * [x] Improve docs.
  * [x] Reintroduce `CheckPoint`.

  #### 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:
  notmandatory:
    Re ACK 85c62532a55cfc94eade4d20ca3075dc4cd4882e

Tree-SHA512: 88dbafbebaf227b18c69f2ea884e3e586bf9c11e5e450eb4872ade1d1ccd5cf1e33ce9930a6f5aa918baa3e92add7503858b039b8c9d553a281ad6d833f08a49
2023-10-09 15:49:57 -05:00
志宇
67eec36db4
Merge bitcoindevkit/bdk#1152: fix(wallet_esplora): missing_heights uses the graph update
b1461f05d05a0b9cf056a9604032468064ca1a05 fix(wallet_esplora): missing_heights uses the... ...graph update (Daniela Brozzoni)

Pull request description:

  Fixes #1151.

  When wallet_esplora_* was used to sync a wallet containing a transaction confirmed some time ago (more than 10-15 blocks ago), the transaction would be stuck in an "unconfirmed" state forever.

  At the first scan time, `update_local_chain` would just fetch the last 10 to 15 blocks (depending on the server used), and `tx_graph.missing_heights` wouldn't return the tx's confirmation block as it was called on the original, non-updated tx_graph.
  So, after the first scan, we would have a transaction in memory with an anchor that doesn't exist in our local_chain, and try_get_chain_position would return unconfirmed.

  When scanning again, missing_heights would find the missing anchor, but `update_local_chain` wouldn't include it as it's older than ASSUME_FINAL_DEPTH.

  The missing block would be downloaded every time, but never included in the local_chain, and the transaction would remain unconfirmed forever.

  Here we call missing_heights on the updated graph, so that it can correctly return the anchor height, and `update_local_chain` can fetch it and include it in the chain.

  ### Notes to the reviewers

  I'm not sure if this is the right approach, so I'm opening this PR to gather feedback. I still need to add tests, I'll do so once we decide if this is the right way to go or not.

  ### 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've added tests to reproduce the issue which are now passing
  * [x] I'm linking the issue being fixed by this PR

ACKs for top commit:
  evanlinjin:
    ACK b1461f05d05a0b9cf056a9604032468064ca1a05

Tree-SHA512: ba0cf85929644ee737dbc77e6afec662845532de0f120917aa6000ca8f5db79d0cb3971bd92285b5c5b5d26042b60b6c8536f50c9bd49615e31f5da28e80a509
2023-10-10 01:15:30 +08:00
志宇
85c62532a5
docs(bitcoind_rpc): better Emitter::mempool explanation
Also better docs for `Emitter` fields.
2023-10-10 01:04:30 +08:00
志宇
b69c13ddf6
example_bitcoind_rpc: tweaks
* avoid holding mutex lock over io
* document `CHANNEL_BOUND` const
* use the `relevant` variant of `batch_insert_unconfirmed`
* print elapsed time in stdout for various updates
2023-10-10 01:04:30 +08:00
志宇
5f34df8489
bitcoind_rpc!: bring back CheckPoints to Emitter
* `bdk_chain` dependency is added. In the future, we will introduce a
  separate `bdk_core` crate to contain shared types.
* replace `Emitter::new` with `from_height` and `from_checkpoint`
  * `from_height` emits from the given start height
  * `from_checkpoint` uses the provided cp to find agreement point
* introduce logic that ensures emitted blocks can connect with
  receiver's `LocalChain`
* in our rpc example, we can now `expect()` chain updates to always
  since we are using checkpoints and receiving blocks in order
2023-10-09 22:14:04 +08:00
志宇
57590e0a1f
bitcoind_rpc: rm BlockHash from Emitter::last_mempool_tip
Instead of comparing the blockhash against the emitted_blocks map
to see whether the block is part of the emitter's best chain, we
reduce the `last_mempool_tip` height to the last agreement height
during the polling logic.

The benefits of this is we have tighter bounds for avoiding re-
emission. Also, it will be easier to replace `emitted_blocks` to
a `CheckPoint` (since we no longer rely on map lookup).
2023-10-09 22:14:04 +08:00
志宇
6d4b33ef91
chain: split IndexedTxGraph::insert_tx into 3 methods
Instead of inserting anchors and seen_at timestamp in the same method,
we have three separate methods. This makes the API easier to understand
and makes `IndexedTxGraph` more consistent with the `TxGraph` API.
2023-10-09 22:14:04 +08:00
志宇
4f5695d43a
chain: improvements to IndexedTxGraph and TxGraph APIs
For `IndexedTxGraph`:
- Remove `InsertTxItem` type (this is too complex).
    - `batch_insert_relevant` now uses a simple tuple `(&tx, anchors)`.
    - `batch_insert` is now also removed, as the same functionality can be
      done elsewhere.
- Add internal helper method `index_tx_graph_changeset` so we don't need
  to create a seprate `TxGraph` update in each method.
- `batch_insert_<relevant>_unconfirmed` no longer takes in an option of
  last_seen.
- `batch_insert_unconfirmed` no longer takes a reference of a
  transaction (since we apply all transactions anyway, so there is no
  need to clone).

For `TxGraph`:
- Add `batch_insert_unconfirmed` method.
2023-10-09 22:14:04 +08:00
志宇
150d6f8ab6
feat(example_bitcoind_rpc_polling): add example for RPC polling 2023-10-09 22:14:03 +08:00
志宇
4f10463d9e
test(bitcoind_rpc): add no_agreement_point test
Co-authored-by: Steve Myers <steve@notmandatory.org>
2023-10-09 22:14:03 +08:00
志宇
a73dac2d91
test(bitcoind_rpc): initial tests for Emitter 2023-10-09 22:14:03 +08:00
志宇
bb7424d11d
feat(bitcoind_rpc): introduce bitcoind_rpc crate 2023-10-09 22:14:03 +08:00
志宇
240657b167
chain: add batch-insert methods for IndexedTxGraph 2023-10-09 22:14:03 +08:00
志宇
43bc813c64
chain: add helper methods on CheckPoint
* `CheckPoint::from_header` allows us to construct a checkpoint from
  block header.
* `CheckPoint::into_update` transforms the cp into a
  `local_chain::Update`.
2023-10-09 22:14:03 +08:00
志宇
b3db5ca9df
feat(chain): add AnchorFromBlockPosition trait
This is useful for block-by-block chain sources. We can determine the
tx's anchor based on the block, block height and tx position in the
block.
2023-10-09 22:14:03 +08:00
志宇
f795a43cc7
feat(example_cli): allow chain specific args in examples
So you can pass in the esplora/electrum/bitcoind_rpc server details in
the example.

Co-authored-by: LLFourn <lloyd.fourn@gmail.com>
2023-10-09 22:14:02 +08:00
Daniela Brozzoni
b1461f05d0
fix(wallet_esplora): missing_heights uses the...
...graph update

Fixes #1151.
When wallet_esplora_* was used to sync a wallet containing a transaction
confirmed some time ago (more than 10-15 blocks ago), the transaction would
be stuck in an "unconfirmed" state forever.

At the first scan time, `update_local_chain` would just fetch the last 10 to
15 blocks (depending on the server used), and `tx_graph.missing_heights`
wouldn't return the tx's confirmation block as it was called on the
original, non-updated tx_graph.
So, after the first scan, we would have a transaction in memory with an
anchor that doesn't exist in our local_chain, and try_get_chain_position
would return unconfirmed.

When scanning again, missing_heights would find the missing anchor, but
`update_local_chain` wouldn't include it as it's older than
ASSUME_FINAL_DEPTH.

The missing block would be downloaded every time, but never included in
the local_chain, and the transaction would remain unconfirmed forever.

Here we call missing_heights on the updated graph, so that it can
correctly return the anchor height, and `update_local_chain` can
fetch it and include it in the chain.
2023-10-09 15:09:14 +02:00
Daniela Brozzoni
77cde96229
Merge bitcoindevkit/bdk#1157: chore: pin byteorder and webpki to fix MSRV
1db3f87a4850c11b010ceafeba8a64ee0e54e022 chore: pin `byteorder` and `webpki` to fix MSRV (志宇)

Pull request description:

  * pin `byteorder` to 1.4.3
  * pin `webpki` to 0.22.2
  * it's tokio:1.33.0 that needs to be pinned to 1.29.1
  * fix README MSRV comments

ACKs for top commit:
  danielabrozzoni:
    utACK 1db3f87a4850c11b010ceafeba8a64ee0e54e022

Tree-SHA512: 4c2dc009ea117dd7ca18c7a836eb2b169c68d6ccaf84f85bcc2d4a3bcb7b008ad99f1dadf933b20c9d6ca6cc761e89dbafa99f99e31776e291f480cd6a112b1d
2023-10-09 15:03:49 +02:00