Clean up add_foreign_utxo tests a bit
Noticed some suboptimal things while reviewing myself.
This commit is contained in:
parent
d9a102afa9
commit
ac7c1bd97b
@ -2360,25 +2360,30 @@ mod test {
|
|||||||
.max_satisfaction_weight()
|
.max_satisfaction_weight()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
let psbt_input1 = psbt::Input {
|
|
||||||
non_witness_utxo: Some(tx1),
|
|
||||||
..Default::default()
|
|
||||||
};
|
|
||||||
let psbt_input2 = psbt::Input {
|
|
||||||
non_witness_utxo: Some(tx2),
|
|
||||||
..Default::default()
|
|
||||||
};
|
|
||||||
|
|
||||||
let mut builder = wallet1.build_tx();
|
let mut builder = wallet1.build_tx();
|
||||||
assert!(
|
assert!(
|
||||||
builder
|
builder
|
||||||
.add_foreign_utxo(utxo2.outpoint, psbt_input1, satisfaction_weight)
|
.add_foreign_utxo(
|
||||||
|
utxo2.outpoint,
|
||||||
|
psbt::Input {
|
||||||
|
non_witness_utxo: Some(tx1),
|
||||||
|
..Default::default()
|
||||||
|
},
|
||||||
|
satisfaction_weight
|
||||||
|
)
|
||||||
.is_err(),
|
.is_err(),
|
||||||
"should fail when outpoint doesn't match psbt_input"
|
"should fail when outpoint doesn't match psbt_input"
|
||||||
);
|
);
|
||||||
assert!(
|
assert!(
|
||||||
builder
|
builder
|
||||||
.add_foreign_utxo(utxo2.outpoint, psbt_input2, satisfaction_weight)
|
.add_foreign_utxo(
|
||||||
|
utxo2.outpoint,
|
||||||
|
psbt::Input {
|
||||||
|
non_witness_utxo: Some(tx2),
|
||||||
|
..Default::default()
|
||||||
|
},
|
||||||
|
satisfaction_weight
|
||||||
|
)
|
||||||
.is_ok(),
|
.is_ok(),
|
||||||
"shoulld be ok when outpoint does match psbt_input"
|
"shoulld be ok when outpoint does match psbt_input"
|
||||||
);
|
);
|
||||||
@ -2413,7 +2418,7 @@ mod test {
|
|||||||
.unwrap();
|
.unwrap();
|
||||||
assert!(
|
assert!(
|
||||||
builder.finish().is_err(),
|
builder.finish().is_err(),
|
||||||
"psbt_input with witness_utxo should succeed with witness_utxo"
|
"psbt_input with witness_utxo should fail with only witness_utxo"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user