X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=lightning%2Fsrc%2Fln%2Fchannel.rs;h=5771f772eac1751475e234f57c89557cd8568424;hb=d1c6f235f9e432785150bd72c6ba6731e8f75c85;hp=8b5d9120babb2e98eccdcccb3e472443e5b070d8;hpb=83c9eb4b9e0a461fee980fc6cc01d1b72597b2fa;p=rust-lightning diff --git a/lightning/src/ln/channel.rs b/lightning/src/ln/channel.rs index 8b5d9120..5771f772 100644 --- a/lightning/src/ln/channel.rs +++ b/lightning/src/ln/channel.rs @@ -1656,6 +1656,9 @@ impl Channel { if msg.amount_msat > self.channel_value_satoshis * 1000 { return Err(ChannelError::Close("Remote side tried to send more than the total value of the channel")); } + if msg.amount_msat == 0 { + return Err(ChannelError::Close("Remote side tried to send a 0-msat HTLC")); + } if msg.amount_msat < self.our_htlc_minimum_msat { return Err(ChannelError::Close("Remote side tried to send less than our minimum HTLC value")); } @@ -3493,6 +3496,11 @@ impl Channel { if amount_msat > self.channel_value_satoshis * 1000 { return Err(ChannelError::Ignore("Cannot send more than the total value of the channel")); } + + if amount_msat == 0 { + return Err(ChannelError::Ignore("Cannot send 0-msat HTLC")); + } + if amount_msat < self.their_htlc_minimum_msat { return Err(ChannelError::Ignore("Cannot send less than their minimum HTLC value")); }