diff --git a/src/branch_and_bound.rs b/src/branch_and_bound.rs index 6f7f2c1..1ec7be4 100644 --- a/src/branch_and_bound.rs +++ b/src/branch_and_bound.rs @@ -522,4 +522,23 @@ mod tests { select_coins_bnb(target, Amount::ZERO, FeeRate::ZERO, &mut weighted_utxos).unwrap(); assert_eq!(list, Vec::new()); } + + #[test] + fn utxo_pool_sum_overflow() { + let target = Amount::from_str("1 cBTC").unwrap(); + let mut weighted_utxos = vec![ + WeightedUtxo { + satisfaction_weight: Weight::ZERO, + utxo: TxOut { value: Amount::MAX, script_pubkey: ScriptBuf::new() }, + }, + WeightedUtxo { + satisfaction_weight: Weight::ZERO, + utxo: TxOut { value: Amount::MAX, script_pubkey: ScriptBuf::new() }, + }, + ]; + + let list = select_coins_bnb(target, Amount::ZERO, FeeRate::ZERO, &mut weighted_utxos); + + assert!(list.is_none()); + } }