Correct initial commitment check in inbound channel-open handling.
[rust-lightning] / lightning / src / ln / channel.rs
index 306d4c5954b9cb4a3d89aa7bb373f044e85020d6..f2f1ad766a9a195ff2306379c18cf9c878f6704f 100644 (file)
@@ -652,9 +652,10 @@ impl<ChanSigner: ChannelKeys> Channel<ChanSigner> {
                        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;
-               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"));
                }