Skip to content

Commit ad090db

Browse files
committed
Clean up add_foreign_utxo tests a bit
Noticed some suboptimal things while reviewing myself.
1 parent b8539fb commit ad090db

File tree

1 file changed

+17
-12
lines changed

1 file changed

+17
-12
lines changed

src/wallet/mod.rs

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2360,25 +2360,30 @@ mod test {
23602360
.max_satisfaction_weight()
23612361
.unwrap();
23622362

2363-
let psbt_input1 = psbt::Input {
2364-
non_witness_utxo: Some(tx1),
2365-
..Default::default()
2366-
};
2367-
let psbt_input2 = psbt::Input {
2368-
non_witness_utxo: Some(tx2),
2369-
..Default::default()
2370-
};
2371-
23722363
let mut builder = wallet1.build_tx();
23732364
assert!(
23742365
builder
2375-
.add_foreign_utxo(utxo2.outpoint, psbt_input1, satisfaction_weight)
2366+
.add_foreign_utxo(
2367+
utxo2.outpoint,
2368+
psbt::Input {
2369+
non_witness_utxo: Some(tx1),
2370+
..Default::default()
2371+
},
2372+
satisfaction_weight
2373+
)
23762374
.is_err(),
23772375
"should fail when outpoint doesn't match psbt_input"
23782376
);
23792377
assert!(
23802378
builder
2381-
.add_foreign_utxo(utxo2.outpoint, psbt_input2, satisfaction_weight)
2379+
.add_foreign_utxo(
2380+
utxo2.outpoint,
2381+
psbt::Input {
2382+
non_witness_utxo: Some(tx2),
2383+
..Default::default()
2384+
},
2385+
satisfaction_weight
2386+
)
23822387
.is_ok(),
23832388
"shoulld be ok when outpoint does match psbt_input"
23842389
);
@@ -2413,7 +2418,7 @@ mod test {
24132418
.unwrap();
24142419
assert!(
24152420
builder.finish().is_err(),
2416-
"psbt_input with witness_utxo should succeed with witness_utxo"
2421+
"psbt_input with witness_utxo should fail with only witness_utxo"
24172422
);
24182423
}
24192424

0 commit comments

Comments
 (0)