You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
9c57708 Make stop_gap a parameter to EsploraBlockchainConfig::new (LLFourn)
0f0a01a s/vin/vout/ (LLFourn)
1a64fd9 Delete src/blockchain/utils.rs (LLFourn)
d3779fa Fix comments (LLFourn)
d394011 Less intermediary data states in sync (LLFourn)
dfb63d3 s/observed_txs/finished_txs/g (LLFourn)
188d9a4 Make variable names consistent (LLFourn)
5eadf5c Add some logging to script_sync (LLFourn)
aaad560 Always get up to chunk_size heights to request headers for (LLFourn)
e7c1357 Don't request conftime during tx request (LLFourn)
808d7d8 Update changelog (LLFourn)
732166f Fix feerate calculation for esplora (LLFourn)
3f5cb69 Invert dependencies in electrum sync (LLFourn)
Pull request description:
## Description
This PR does dependency inversion on the previous sync logic for electrum and esplora captured in the trait `ElectrumLikeSync`. This means that the sync logic does not reference the blockchain at all. Instead the blockchain asks the sync logic (in `script_sync.rs`) what it needs to continue the sync and tries to retrieve it.
The initial purpose of doing this is to remove invocations of `maybe_await` in the abstract sync logic in preparation for completely removing `maybe_await` in the future. The other major benefit is it gives a lot more freedom for the esplora logic to use the rich data from the responses to complete the sync with less HTTP requests than it did previously.
## List of changes
- sync logic moved to `script_sync.rs` and `ElectrumLikeSync` is gone.
- esplora makes one http request per sync address. This means it makes half the number of http requests for a fully synced wallet and N*M less requests for a wallet which has N new transactions with M unique input transactions.
- electrum and esplora save less raw transactions in the database. Electrum still requests input transactions for each of its transactions to calculate the fee but it does not save them to the database anymore.
- The ureq and reqwest blockchain configuration is now unified into the same struct. This is the only API change. `read_timeout` and `write_timeout` have been removed in favor of a single `timeout` option which is set in both ureq and reqwest.
- ureq now does concurrent (parallel) requests using threads.
- An previously unnoticed bug has been fixed where by sending a lot of double spending transactions to the same address you could trick a bdk Esplora wallet into thinking it had a lot of unconfirmed coins. This is because esplora doesn't delete double spent transactions from its indexes immediately (not sure if this is a bug or a feature). A blockchain test is added for this.
- BONUS: The second commit in this PR fixes the feerate calculation for esplora and adds a test (the previous algorithm didn't work at all). I could have made a separate PR but since I was touching this file a lot I decided to fix it here.
## Notes to the reviewers
- The most important thing to review is the the logic in `script_sync.rs` is sound.
- Look at the two commits separately.
- I think CI is failing because of MSRV problems again!
- It would be cool to measure how much sync time is improved for your existing wallets/projects. For `gun` the speed improvements for modest but it is at least hammering the esplora server much less.
- I noticed the performance of reqwest in blocking is much worse in this patch than previously. This is because somehow reqwest is not re-using the connection for each request in this new code. I have no idea why. The plan is to get rid of the blocking reqwest implementation in a follow up PR.
### Checklists
#### All Submissions:
* [x] I've signed all my commits
ACKs for top commit:
rajarshimaitra:
Retested ACK a630685
Tree-SHA512: de74981e9d1f80758a9f20a3314ed7381c6b7c635f7ede80b177651fe2f9e9468064fae26bf80d4254098accfacfe50326ae0968e915186e13313f05bf77990b
Copy file name to clipboardExpand all lines: CHANGELOG.md
+4-1Lines changed: 4 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,6 +8,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
8
8
9
9
- BIP39 implementation dependency, in `keys::bip39` changed from tiny-bip39 to rust-bip39.
10
10
- Add new method on the `TxBuilder` to embed data in the transaction via `OP_RETURN`. To allow that a fix to check the dust only on spendable output has been introduced.
11
+
- Overhauled sync logic for electrum and esplora.
12
+
- Unify ureq and reqwest esplora backends to have the same configuration parameters. This means reqwest now has a timeout parameter and ureq has a concurrency parameter.
13
+
- Fixed esplora fee estimation.
11
14
- Update the `Database` trait to store the last sync timestamp and block height
12
15
- Rename `ConfirmationTime` to `BlockTime`
13
16
@@ -393,4 +396,4 @@ final transaction is created by calling `finish` on the builder.
0 commit comments