mirror of
https://github.com/lightningdevkit/rust-lightning.git
synced 2025-02-25 07:17:40 +01:00
Correct error when a peer opens a channel with a huge push_msat
The calculation uses the reserve, so we should mention it in the error we send to our peers.
This commit is contained in:
parent
2826af75a5
commit
92c87bae19
2 changed files with 2 additions and 2 deletions
|
@ -1084,7 +1084,7 @@ impl<Signer: Sign> Channel<Signer> {
|
|||
}
|
||||
let full_channel_value_msat = (msg.funding_satoshis - msg.channel_reserve_satoshis) * 1000;
|
||||
if msg.push_msat > full_channel_value_msat {
|
||||
return Err(ChannelError::Close(format!("push_msat {} was larger than funding value {}", msg.push_msat, full_channel_value_msat)));
|
||||
return Err(ChannelError::Close(format!("push_msat {} was larger than channel amount minus reserve ({})", msg.push_msat, full_channel_value_msat)));
|
||||
}
|
||||
if msg.dust_limit_satoshis > msg.funding_satoshis {
|
||||
return Err(ChannelError::Close(format!("dust_limit_satoshis {} was larger than funding_satoshis {}. Peer never wants payout outputs?", msg.dust_limit_satoshis, msg.funding_satoshis)));
|
||||
|
|
|
@ -100,7 +100,7 @@ fn test_insane_channel_opens() {
|
|||
|
||||
insane_open_helper("Bogus channel_reserve_satoshis", |mut msg| { msg.channel_reserve_satoshis = msg.funding_satoshis + 1; msg });
|
||||
|
||||
insane_open_helper(r"push_msat \d+ was larger than funding value \d+", |mut msg| { msg.push_msat = (msg.funding_satoshis - msg.channel_reserve_satoshis) * 1000 + 1; msg });
|
||||
insane_open_helper(r"push_msat \d+ was larger than channel amount minus reserve \(\d+\)", |mut msg| { msg.push_msat = (msg.funding_satoshis - msg.channel_reserve_satoshis) * 1000 + 1; msg });
|
||||
|
||||
insane_open_helper("Peer never wants payout outputs?", |mut msg| { msg.dust_limit_satoshis = msg.funding_satoshis + 1 ; msg });
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue