]> Untitled Git - bdk/commitdiff
test(wallet): Clarify docs for get_funded_wallet
authorvalued mammal <valuedmammal@protonmail.com>
Wed, 27 Mar 2024 17:34:18 +0000 (13:34 -0400)
committervalued mammal <valuedmammal@protonmail.com>
Wed, 5 Jun 2024 10:29:58 +0000 (06:29 -0400)
crates/wallet/tests/common.rs

index 34ffda41d6e42063e801d7a8209952ae4233530d..d77147f4d8388eb0fbd0dd9d85c1704bbb021d53 100644 (file)
@@ -10,11 +10,11 @@ use bitcoin::{
 };
 use std::str::FromStr;
 
-// Return a fake wallet that appears to be funded for testing.
-//
-// The funded wallet containing a tx with a 76_000 sats input and two outputs, one spending 25_000
-// to a foreign address and one returning 50_000 back to the wallet as change. The remaining 1000
-// sats are the transaction fee.
+/// Return a fake wallet that appears to be funded for testing.
+///
+/// The funded wallet contains a tx with a 76_000 sats input and two outputs, one spending 25_000
+/// to a foreign address and one returning 50_000 back to the wallet. The remaining 1000
+/// sats are the transaction fee.
 pub fn get_funded_wallet_with_change(descriptor: &str, change: &str) -> (Wallet, bitcoin::Txid) {
     let mut wallet = Wallet::new_no_persist(descriptor, change, Network::Regtest).unwrap();
     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,
     (wallet, tx1.txid())
 }
 
-// Return a fake wallet that appears to be funded for testing.
-//
-// The funded wallet containing a tx with a 76_000 sats input and two outputs, one spending 25_000
-// to a foreign address and one returning 50_000 back to the wallet as change. The remaining 1000
-// sats are the transaction fee.
+/// Return a fake wallet that appears to be funded for testing.
+///
+/// The funded wallet contains a tx with a 76_000 sats input and two outputs, one spending 25_000
+/// to a foreign address and one returning 50_000 back to the wallet. The remaining 1000
+/// sats are the transaction fee.
+///
+/// Note: the change descriptor will have script type `p2wpkh`. If passing some other script type
+/// as argument, make sure you're ok with getting a wallet where the keychains have potentially
+/// different script types. Otherwise, use `get_funded_wallet_with_change`.
 pub fn get_funded_wallet(descriptor: &str) -> (Wallet, bitcoin::Txid) {
     let change = get_test_wpkh_change();
     get_funded_wallet_with_change(descriptor, change)