[wallet] Add test that shwpkh populates witness_utxo

This commit is contained in:
LLFourn 2020-11-17 12:30:58 +11:00
parent 004f81b0a8
commit fcc408f346
No known key found for this signature in database
GPG Key ID: A27093B54DA11F65

View File

@ -2121,6 +2121,23 @@ mod test {
assert!(psbt.inputs[0].witness_utxo.is_some());
}
#[test]
fn test_create_tx_shwpkh_has_witness_utxo() {
let (wallet, _, _) =
get_funded_wallet("sh(wpkh(cVpPVruEDdmutPzisEsYvtST1usBR3ntr8pXSyt6D2YYqXRyPcFW))");
let addr = wallet.get_new_address().unwrap();
let (psbt, _) = wallet
.create_tx(
TxBuilder::new()
.set_single_recipient(addr.script_pubkey())
.drain_wallet(),
)
.unwrap();
assert!(psbt.inputs[0].non_witness_utxo.is_none());
assert!(psbt.inputs[0].witness_utxo.is_some());
}
#[test]
fn test_create_tx_both_non_witness_utxo_and_witness_utxo() {
let (wallet, _, _) =