Skip to content

Commit 39fc8fb

Browse files
committed
f - fix tests running with --no-default-features
1 parent 7d12f5b commit 39fc8fb

File tree

1 file changed

+49
-40
lines changed

1 file changed

+49
-40
lines changed

lightning/src/ln/channel.rs

Lines changed: 49 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -17432,7 +17432,7 @@ mod tests {
1743217432
// splice initiator
1743317433
assert_eq!(
1743417434
estimate_v2_funding_transaction_fee(&one_input, &[], true, true, 2000),
17435-
1738,
17435+
if cfg!(feature = "grind_signatures") { 1738 } else { 1740 },
1743617436
);
1743717437

1743817438
// splice acceptor
@@ -17462,40 +17462,46 @@ mod tests {
1746217462
use crate::ln::channel::check_v2_funding_inputs_sufficient;
1746317463

1746417464
// positive case, inputs well over intended contribution
17465-
assert_eq!(
17466-
check_v2_funding_inputs_sufficient(
17467-
220_000,
17468-
&[
17469-
funding_input_sats(200_000),
17470-
funding_input_sats(100_000),
17471-
],
17472-
true,
17473-
true,
17474-
2000,
17475-
).unwrap(),
17476-
2282,
17477-
);
17465+
{
17466+
let expected_fee = if cfg!(feature = "grind_signatures") { 2282 } else { 2284 };
17467+
assert_eq!(
17468+
check_v2_funding_inputs_sufficient(
17469+
220_000,
17470+
&[
17471+
funding_input_sats(200_000),
17472+
funding_input_sats(100_000),
17473+
],
17474+
true,
17475+
true,
17476+
2000,
17477+
).unwrap(),
17478+
expected_fee,
17479+
);
17480+
}
1747817481

1747917482
// negative case, inputs clearly insufficient
1748017483
{
17481-
let res = check_v2_funding_inputs_sufficient(
17482-
220_000,
17483-
&[
17484-
funding_input_sats(100_000),
17485-
],
17486-
true,
17487-
true,
17488-
2000,
17489-
);
17484+
let expected_fee = if cfg!(feature = "grind_signatures") { 1738 } else { 1740 };
1749017485
assert_eq!(
17491-
res.err().unwrap(),
17492-
"Total input amount 100000 is lower than needed for contribution 220000, considering fees of 1738. Need more inputs.",
17486+
check_v2_funding_inputs_sufficient(
17487+
220_000,
17488+
&[
17489+
funding_input_sats(100_000),
17490+
],
17491+
true,
17492+
true,
17493+
2000,
17494+
),
17495+
Err(format!(
17496+
"Total input amount 100000 is lower than needed for contribution 220000, considering fees of {}. Need more inputs.",
17497+
expected_fee,
17498+
)),
1749317499
);
1749417500
}
1749517501

1749617502
// barely covers
1749717503
{
17498-
let expected_fee: u64 = 2282;
17504+
let expected_fee = if cfg!(feature = "grind_signatures") { 2282 } else { 2284 };
1749917505
assert_eq!(
1750017506
check_v2_funding_inputs_sufficient(
1750117507
(300_000 - expected_fee - 20) as i64,
@@ -17513,25 +17519,28 @@ mod tests {
1751317519

1751417520
// higher fee rate, does not cover
1751517521
{
17516-
let res = check_v2_funding_inputs_sufficient(
17517-
298032,
17518-
&[
17519-
funding_input_sats(200_000),
17520-
funding_input_sats(100_000),
17521-
],
17522-
true,
17523-
true,
17524-
2200,
17525-
);
17522+
let expected_fee = if cfg!(feature = "grind_signatures") { 2511 } else { 2513 };
1752617523
assert_eq!(
17527-
res.err().unwrap(),
17528-
"Total input amount 300000 is lower than needed for contribution 298032, considering fees of 2511. Need more inputs.",
17524+
check_v2_funding_inputs_sufficient(
17525+
298032,
17526+
&[
17527+
funding_input_sats(200_000),
17528+
funding_input_sats(100_000),
17529+
],
17530+
true,
17531+
true,
17532+
2200,
17533+
),
17534+
Err(format!(
17535+
"Total input amount 300000 is lower than needed for contribution 298032, considering fees of {}. Need more inputs.",
17536+
expected_fee
17537+
)),
1752917538
);
1753017539
}
1753117540

17532-
// barely covers, less fees (no extra weight, no init)
17541+
// barely covers, less fees (no extra weight, not initiator)
1753317542
{
17534-
let expected_fee: u64 = 1088;
17543+
let expected_fee = 1088;
1753517544
assert_eq!(
1753617545
check_v2_funding_inputs_sufficient(
1753717546
(300_000 - expected_fee - 20) as i64,

0 commit comments

Comments
 (0)