}),
);
}
#[test]
fn correct_error_is_returned_when_fee_cannot_be_paid() {
pretty_assert_eq!(
TransactionBuilder::new(
satpoint(1, 0),
BTreeMap::new(),
vec![(outpoint(1), Amount::from_sat(1_500))]
.into_iter()
.collect(),
BTreeSet::new(),
recipient(),
[change(0), change(1)],
FeeRate::try_from(6.0).unwrap(),
Target::Value(Amount::from_sat(1000))
)
.build_transaction(),
Err(Error::NotEnoughCardinalUtxos)
);
}
#[test]
fn recipient_address_must_be_unique() {
pretty_assert_eq!(
TransactionBuilder::new(
satpoint(1, 0),
BTreeMap::new(),
vec![(outpoint(1), Amount::from_sat(1000))]
.into_iter()
.collect(),
BTreeSet::new(),
recipient(),
[recipient(), change(1)],
FeeRate::try_from(0.0).unwrap(),
Target::Value(Amount::from_sat(1000))
)
.build_transaction(),
Err(Error::DuplicateAddress(recipient()))