From: 志宇 Date: Tue, 3 Sep 2024 05:18:20 +0000 (+0800) Subject: feat(wallet): make `Wallet::insert_tx` generic X-Git-Tag: v1.0.0-beta.3~7^2~1 X-Git-Url: http://internal-gitweb-vhost/script/%22https:/database/scripts/enum.ElectrumCommands.html?a=commitdiff_plain;h=c39284d8299c5a8b34b73ce947e93425d5cdc121;p=bdk feat(wallet): make `Wallet::insert_tx` generic Instead of having `Transaction` as input, have `T: Into>`. --- diff --git a/crates/wallet/src/wallet/mod.rs b/crates/wallet/src/wallet/mod.rs index 5cad6bb8..8513251a 100644 --- a/crates/wallet/src/wallet/mod.rs +++ b/crates/wallet/src/wallet/mod.rs @@ -1093,7 +1093,7 @@ impl Wallet { /// By default the inserted `tx` won't be considered "canonical" because it's not known /// whether the transaction exists in the best chain. To know whether it exists, the tx /// must be broadcast to the network and the wallet synced via a chain source. - pub fn insert_tx(&mut self, tx: Transaction) -> bool { + pub fn insert_tx>>(&mut self, tx: T) -> bool { let mut changeset = ChangeSet::default(); changeset.merge(self.indexed_graph.insert_tx(tx).into()); let ret = !changeset.is_empty();