Skip to content

Commit cddefbb

Browse files
committed
test(wallet): Clarify docs for get_funded_wallet
1 parent ff951ba commit cddefbb

1 file changed

Lines changed: 14 additions & 10 deletions

File tree

crates/bdk/tests/common.rs

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ use bitcoin::{
1010
};
1111
use std::str::FromStr;
1212

13-
// Return a fake wallet that appears to be funded for testing.
14-
//
15-
// The funded wallet containing a tx with a 76_000 sats input and two outputs, one spending 25_000
16-
// to a foreign address and one returning 50_000 back to the wallet as change. The remaining 1000
17-
// sats are the transaction fee.
13+
/// Return a fake wallet that appears to be funded for testing.
14+
///
15+
/// The funded wallet contains a tx with a 76_000 sats input and two outputs, one spending 25_000
16+
/// to a foreign address and one returning 50_000 back to the wallet. The remaining 1000
17+
/// sats are the transaction fee.
1818
pub fn get_funded_wallet_with_change(descriptor: &str, change: &str) -> (Wallet, bitcoin::Txid) {
1919
let mut wallet = Wallet::new_no_persist(descriptor, change, Network::Regtest).unwrap();
2020
let receive_address = wallet.peek_address(KeychainKind::External, 0).address;
@@ -99,11 +99,15 @@ pub fn get_funded_wallet_with_change(descriptor: &str, change: &str) -> (Wallet,
9999
(wallet, tx1.txid())
100100
}
101101

102-
// Return a fake wallet that appears to be funded for testing.
103-
//
104-
// The funded wallet containing a tx with a 76_000 sats input and two outputs, one spending 25_000
105-
// to a foreign address and one returning 50_000 back to the wallet as change. The remaining 1000
106-
// sats are the transaction fee.
102+
/// Return a fake wallet that appears to be funded for testing.
103+
///
104+
/// The funded wallet contains a tx with a 76_000 sats input and two outputs, one spending 25_000
105+
/// to a foreign address and one returning 50_000 back to the wallet. The remaining 1000
106+
/// sats are the transaction fee.
107+
///
108+
/// Note: the change descriptor will have script type `p2wpkh`. If passing some other script type
109+
/// as argument, make sure you're ok with getting a wallet where the keychains have potentially
110+
/// different script types. Otherwise, use `get_funded_wallet_with_change`.
107111
pub fn get_funded_wallet(descriptor: &str) -> (Wallet, bitcoin::Txid) {
108112
let change = get_test_wpkh_change();
109113
get_funded_wallet_with_change(descriptor, change)

0 commit comments

Comments
 (0)