Ran
|
Files
48
|
Run time
1s
|
Badge
Embed ▾
README BADGES
|
push
github
Merge bitcoindevkit/bdk#1586: Change methods of `IndexedTxGraph`/`TxGraph`/`Wallet` that insert txs to be more generic 87e61212f feat(chain,wallet)!: change methods to take in generic instead of `&Transaction` (志宇) c39284d82 feat(wallet): make `Wallet::insert_tx` generic (志宇) 67d5fa695 feat(chain): make various insert tx methods more generic (志宇) Pull request description: ### Description We want to reuse the `Arc` pointer whenever possible. However, some methods on `TxGraph` and `IndexedTxGraph` that insert transactions take in `&Transaction` or `Transaction` (thus forcing us to create a new `Arc<Transaction>` internally by cloning, even if the input tx is under a `Arc`). This PR changes these methods to take in a generic parameter, `T: Into<Arc<Transaction>>`, allowing us to reuse the `Arc` pointer whenever possible. ### Notes to the reviewers Methods that previously took in `Transaction` can be changed to take in `T: Into<Arc<Transaction>>` and be non-breaking (since `Arc<T>` impls `From<T>` automatically). These changes are contained in the first two commits. Methods that previously took in `&Transaction` will break. However, I think these api changes are small and the improvements are substantial enough to be worth it. These changes are contained in the last commit. ### Changelog notice * Changed `IndexedTxGraph` methods `insert_tx`, `batch_insert_relevant`, `batch_insert_relevant_unconfirmed`, `batch_insert_unconfirmed` to take in `T: Into<Arc<Transaction>>` instead of `Transaction` or `&Transaction`. * Changed `TxGraph` method `batch_insert_unconfirmed` to take in `T: Into<Arc<Transaction>>` instead of `Transaction`. * Changed `Wallet` methods `insert_tx`, `apply_unconfirmed_txs` to take in `T: Into<Arc<Transaction>>` instead of `Transaction` or `&Transaction`. ### Checklists #### All Submissions: * [x] I've signed ... (continued)
11100 of 13581 relevant lines covered (81.73%)
13590.48 hits per line
Coverage | ∆ | File | Lines | Relevant | Covered | Missed | Hits/Line |
---|