Previously, we would reject inbound channels if the funder wasn't
able to afford both the initial commitment transaction fee and the
initial commitment didn't meet both our and our counterparty's
reserve value.
We never bothered to check if it was impossible for them to meet
both reserve values, and meeting their own reserve is perfectly
acceptable anyway (as long as they eventually meet it).
The easy fix is to just check that they at least have enough funds
back to themselves on the initial commitment to meet our reserve,
though we could be more careful in the future.
return Err(ChannelError::Close("Insufficient funding amount for initial commitment"));
}
return Err(ChannelError::Close("Insufficient funding amount for initial commitment"));
}
- let to_local_msat = msg.push_msat;
let to_remote_msat = funders_amount_msat - background_feerate * COMMITMENT_TX_BASE_WEIGHT;
let to_remote_msat = funders_amount_msat - background_feerate * COMMITMENT_TX_BASE_WEIGHT;
- if to_local_msat <= msg.channel_reserve_satoshis * 1000 && to_remote_msat <= remote_channel_reserve_satoshis * 1000 {
+ // While its reasonable for us to not meet the channel reserve initially (if they don't
+ // want to push much to us), our counterparty should always have more than the reserve.
+ if to_remote_msat <= remote_channel_reserve_satoshis * 1000 {
return Err(ChannelError::Close("Insufficient funding amount for initial commitment"));
}
return Err(ChannelError::Close("Insufficient funding amount for initial commitment"));
}
let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[None, None]);
let nodes = create_network(2, &node_cfgs, &node_chanmgrs);
let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[None, None]);
let nodes = create_network(2, &node_cfgs, &node_chanmgrs);
- let chan = create_announced_chan_between_nodes_with_value(&nodes, 0, 1, 100000, 99000000, InitFeatures::known(), InitFeatures::known());
+ let chan = create_announced_chan_between_nodes_with_value(&nodes, 0, 1, 100_000, 98_000_000, InitFeatures::known(), InitFeatures::known());
nodes[1].node.force_close_channel(&chan.2);
check_closed_broadcast!(nodes[1], false);
check_added_monitors!(nodes[1], 1);
nodes[1].node.force_close_channel(&chan.2);
check_closed_broadcast!(nodes[1], false);
check_added_monitors!(nodes[1], 1);
let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[None, None]);
let nodes = create_network(2, &node_cfgs, &node_chanmgrs);
let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[None, None]);
let nodes = create_network(2, &node_cfgs, &node_chanmgrs);
- let chan = create_announced_chan_between_nodes_with_value(&nodes, 0, 1, 100000, 99000000, InitFeatures::known(), InitFeatures::known());
+ let chan = create_announced_chan_between_nodes_with_value(&nodes, 0, 1, 100_000, 98_000_000, InitFeatures::known(), InitFeatures::known());
nodes[0].node.force_close_channel(&chan.2);
check_closed_broadcast!(nodes[0], false);
check_added_monitors!(nodes[0], 1);
nodes[0].node.force_close_channel(&chan.2);
check_closed_broadcast!(nodes[0], false);
check_added_monitors!(nodes[0], 1);