@@ -942,7 +942,7 @@ impl<D> Wallet<D> {
942942 /// # let mut wallet: Wallet<()> = todo!();
943943 /// # let txid:Txid = todo!();
944944 /// let tx = wallet.get_tx(txid).expect("transaction").tx_node.tx;
945- /// let fee = wallet.calculate_fee(tx).expect("fee");
945+ /// let fee = wallet.calculate_fee(& tx).expect("fee");
946946 /// ```
947947 ///
948948 /// ```rust, no_run
@@ -973,16 +973,16 @@ impl<D> Wallet<D> {
973973 /// # let mut wallet: Wallet<()> = todo!();
974974 /// # let txid:Txid = todo!();
975975 /// let tx = wallet.get_tx(txid).expect("transaction").tx_node.tx;
976- /// let fee_rate = wallet.calculate_fee_rate(tx).expect("fee rate");
976+ /// let fee_rate = wallet.calculate_fee_rate(& tx).expect("fee rate");
977977 /// ```
978978 ///
979979 /// ```rust, no_run
980980 /// # use bitcoin::psbt::PartiallySignedTransaction;
981981 /// # use bdk::Wallet;
982982 /// # let mut wallet: Wallet<()> = todo!();
983983 /// # let mut psbt: PartiallySignedTransaction = todo!();
984- /// let tx = & psbt.clone().extract_tx();
985- /// let fee_rate = wallet.calculate_fee_rate(tx).expect("fee rate");
984+ /// let tx = psbt.clone().extract_tx();
985+ /// let fee_rate = wallet.calculate_fee_rate(& tx).expect("fee rate");
986986 /// ```
987987 /// [`insert_txout`]: Self::insert_txout
988988 pub fn calculate_fee_rate ( & self , tx : & Transaction ) -> Result < FeeRate , CalculateFeeError > {
@@ -1003,8 +1003,8 @@ impl<D> Wallet<D> {
10031003 /// # use bdk::Wallet;
10041004 /// # let mut wallet: Wallet<()> = todo!();
10051005 /// # let txid:Txid = todo!();
1006- /// let tx = wallet.get_tx(txid).expect("transaction ").tx_node.tx;
1007- /// let (sent, received) = wallet.sent_and_received(tx);
1006+ /// let tx = wallet.get_tx(txid).expect("tx exists ").tx_node.tx;
1007+ /// let (sent, received) = wallet.sent_and_received(& tx);
10081008 /// ```
10091009 ///
10101010 /// ```rust, no_run
@@ -1065,7 +1065,7 @@ impl<D> Wallet<D> {
10651065 pub fn get_tx (
10661066 & self ,
10671067 txid : Txid ,
1068- ) -> Option < CanonicalTx < ' _ , Transaction , ConfirmationTimeHeightAnchor > > {
1068+ ) -> Option < CanonicalTx < ' _ , Arc < Transaction > , ConfirmationTimeHeightAnchor > > {
10691069 let graph = self . indexed_graph . graph ( ) ;
10701070
10711071 Some ( CanonicalTx {
@@ -1167,7 +1167,8 @@ impl<D> Wallet<D> {
11671167 /// Iterate over the transactions in the wallet.
11681168 pub fn transactions (
11691169 & self ,
1170- ) -> impl Iterator < Item = CanonicalTx < ' _ , Transaction , ConfirmationTimeHeightAnchor > > + ' _ {
1170+ ) -> impl Iterator < Item = CanonicalTx < ' _ , Arc < Transaction > , ConfirmationTimeHeightAnchor > > + ' _
1171+ {
11711172 self . indexed_graph
11721173 . graph ( )
11731174 . list_chain_txs ( & self . chain , self . chain . tip ( ) . block_id ( ) )
@@ -1670,6 +1671,7 @@ impl<D> Wallet<D> {
16701671 let mut tx = graph
16711672 . get_tx ( txid)
16721673 . ok_or ( BuildFeeBumpError :: TransactionNotFound ( txid) ) ?
1674+ . as_ref ( )
16731675 . clone ( ) ;
16741676
16751677 let pos = graph
@@ -1739,7 +1741,7 @@ impl<D> Wallet<D> {
17391741 sequence : Some ( txin. sequence ) ,
17401742 psbt_input : Box :: new ( psbt:: Input {
17411743 witness_utxo : Some ( txout. clone ( ) ) ,
1742- non_witness_utxo : Some ( prev_tx. clone ( ) ) ,
1744+ non_witness_utxo : Some ( prev_tx. as_ref ( ) . clone ( ) ) ,
17431745 ..Default :: default ( )
17441746 } ) ,
17451747 } ,
@@ -2295,7 +2297,7 @@ impl<D> Wallet<D> {
22952297 psbt_input. witness_utxo = Some ( prev_tx. output [ prev_output. vout as usize ] . clone ( ) ) ;
22962298 }
22972299 if !desc. is_taproot ( ) && ( !desc. is_witness ( ) || !only_witness_utxo) {
2298- psbt_input. non_witness_utxo = Some ( prev_tx. clone ( ) ) ;
2300+ psbt_input. non_witness_utxo = Some ( prev_tx. as_ref ( ) . clone ( ) ) ;
22992301 }
23002302 }
23012303 Ok ( psbt_input)
0 commit comments