@@ -942,7 +942,7 @@ impl<D> Wallet<D> {
942
942
/// # let mut wallet: Wallet<()> = todo!();
943
943
/// # let txid:Txid = todo!();
944
944
/// 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");
946
946
/// ```
947
947
///
948
948
/// ```rust, no_run
@@ -973,16 +973,16 @@ impl<D> Wallet<D> {
973
973
/// # let mut wallet: Wallet<()> = todo!();
974
974
/// # let txid:Txid = todo!();
975
975
/// 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");
977
977
/// ```
978
978
///
979
979
/// ```rust, no_run
980
980
/// # use bitcoin::psbt::PartiallySignedTransaction;
981
981
/// # use bdk::Wallet;
982
982
/// # let mut wallet: Wallet<()> = todo!();
983
983
/// # 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");
986
986
/// ```
987
987
/// [`insert_txout`]: Self::insert_txout
988
988
pub fn calculate_fee_rate ( & self , tx : & Transaction ) -> Result < FeeRate , CalculateFeeError > {
@@ -1003,8 +1003,8 @@ impl<D> Wallet<D> {
1003
1003
/// # use bdk::Wallet;
1004
1004
/// # let mut wallet: Wallet<()> = todo!();
1005
1005
/// # 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);
1008
1008
/// ```
1009
1009
///
1010
1010
/// ```rust, no_run
@@ -1065,7 +1065,7 @@ impl<D> Wallet<D> {
1065
1065
pub fn get_tx (
1066
1066
& self ,
1067
1067
txid : Txid ,
1068
- ) -> Option < CanonicalTx < ' _ , Transaction , ConfirmationTimeHeightAnchor > > {
1068
+ ) -> Option < CanonicalTx < ' _ , Arc < Transaction > , ConfirmationTimeHeightAnchor > > {
1069
1069
let graph = self . indexed_graph . graph ( ) ;
1070
1070
1071
1071
Some ( CanonicalTx {
@@ -1167,7 +1167,8 @@ impl<D> Wallet<D> {
1167
1167
/// Iterate over the transactions in the wallet.
1168
1168
pub fn transactions (
1169
1169
& self ,
1170
- ) -> impl Iterator < Item = CanonicalTx < ' _ , Transaction , ConfirmationTimeHeightAnchor > > + ' _ {
1170
+ ) -> impl Iterator < Item = CanonicalTx < ' _ , Arc < Transaction > , ConfirmationTimeHeightAnchor > > + ' _
1171
+ {
1171
1172
self . indexed_graph
1172
1173
. graph ( )
1173
1174
. list_chain_txs ( & self . chain , self . chain . tip ( ) . block_id ( ) )
@@ -1670,6 +1671,7 @@ impl<D> Wallet<D> {
1670
1671
let mut tx = graph
1671
1672
. get_tx ( txid)
1672
1673
. ok_or ( BuildFeeBumpError :: TransactionNotFound ( txid) ) ?
1674
+ . as_ref ( )
1673
1675
. clone ( ) ;
1674
1676
1675
1677
let pos = graph
@@ -1739,7 +1741,7 @@ impl<D> Wallet<D> {
1739
1741
sequence : Some ( txin. sequence ) ,
1740
1742
psbt_input : Box :: new ( psbt:: Input {
1741
1743
witness_utxo : Some ( txout. clone ( ) ) ,
1742
- non_witness_utxo : Some ( prev_tx. clone ( ) ) ,
1744
+ non_witness_utxo : Some ( prev_tx. as_ref ( ) . clone ( ) ) ,
1743
1745
..Default :: default ( )
1744
1746
} ) ,
1745
1747
} ,
@@ -2295,7 +2297,7 @@ impl<D> Wallet<D> {
2295
2297
psbt_input. witness_utxo = Some ( prev_tx. output [ prev_output. vout as usize ] . clone ( ) ) ;
2296
2298
}
2297
2299
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 ( ) ) ;
2299
2301
}
2300
2302
}
2301
2303
Ok ( psbt_input)
0 commit comments