Skip to content

Commit 9b7b75d

Browse files
committed
f avoid magic
1 parent 8b31202 commit 9b7b75d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lightning/src/ln/functional_tests.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1506,15 +1506,15 @@ fn test_chan_init_feerate_unaffordability() {
15061506
// Test that we will reject channel opens which do not leave enough to pay for any HTLCs due to
15071507
// channel reserve and feerate requirements.
15081508
let mut chanmon_cfgs = create_chanmon_cfgs(2);
1509+
let feerate_per_kw = *chanmon_cfgs[0].fee_estimator.sat_per_kw.lock().unwrap();
15091510
let node_cfgs = create_node_cfgs(2, &chanmon_cfgs);
15101511
let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[None, None]);
15111512
let mut nodes = create_network(2, &node_cfgs, &node_chanmgrs);
15121513

15131514
// Set the push_msat amount such that nodes[0] will not be able to afford to add even a single
15141515
// HTLC.
1515-
let feerate_per_kw = 253;
15161516
let mut push_amt = 100_000_000;
1517-
push_amt -= commit_tx_fee_msat(feerate_per_kw, 4);
1517+
push_amt -= commit_tx_fee_msat(feerate_per_kw, MIN_AFFORDABLE_HTLC_COUNT as u64);
15181518
assert_eq!(nodes[0].node.create_channel(nodes[1].node.get_our_node_id(), 100_000, push_amt + 1, 42, None).unwrap_err(),
15191519
APIError::APIMisuseError { err: "Funding amount (356) can't even pay fee for initial commitment transaction fee of 357.".to_string() });
15201520

0 commit comments

Comments
 (0)