From: 志宇 Date: Sun, 31 Mar 2024 09:50:00 +0000 (+0800) Subject: Merge bitcoindevkit/bdk#1373: Wrap transactions as `Arc` in `TxGraph` X-Git-Tag: v1.0.0-alpha.9~6 X-Git-Url: http://internal-gitweb-vhost/script/%22https:/database/scripts/blockchain/static/gitweb.css?a=commitdiff_plain;h=19304c13ec1959634380d208220d79d2b8207918;p=bdk Merge bitcoindevkit/bdk#1373: Wrap transactions as `Arc` in `TxGraph` 8ab58af093ff295b86c3f8189aa96dea313092c4 feat(chain)!: wrap `TxGraph` txs with `Arc` (志宇) Pull request description: ### Description This PR makes `TxGraph` store transactions as `Arc`. `Arc` can be shared between the chain-source and receiving structures. This allows the chain-source to keep the already-fetched transactions (save bandwith) and have a shared pointer to the transaction (save memory). Our current logic to avoid re-fetching transactions is to refer back to the receiving structures. However, this means an additional round of locking our receiving structures. ### Notes to the reviewers This will make more sense once I update the esplora/electrum chain sources to make use of both #1369 and this PR. The result would be chain sources which would only require locking the receiving structures twice (once for initiating the update, and once for applying the update). ### Changelog notice * Changed `TxGraph` to store transactions as `Arc`. This allows chain-sources to cheaply keep a copy of already-fetched transactions. ### 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 * [x] I've added docs for the new feature ACKs for top commit: LLFourn: ACK 8ab58af093ff295b86c3f8189aa96dea313092c4 notmandatory: ACK 8ab58af093ff295b86c3f8189aa96dea313092c4 Tree-SHA512: 81d7ad35fed7f253a3b902f09a41aaef2877f6201d4f6e78318741bf00e4b898a8000d878ffcbfe75701094ce3e9021bd718b190a655331a9e11f0ad66bdb02f --- 19304c13ec1959634380d208220d79d2b8207918