mirror of
https://github.com/lightningdevkit/rust-lightning.git
synced 2025-02-25 07:17:40 +01:00
Force-close channels if closing transactions may be non-standard
If a counterparty (or an old channel of ours) uses a non-segwit script for their cooperative close payout, they may include an output which is unbroadcastable due to not meeting the network dust limit. Here we check for this condition, force-closing the channel instead if we find an output in the closing transaction which does not meet the limit.
This commit is contained in:
parent
1b70d9ee8f
commit
9279890089
1 changed files with 6 additions and 0 deletions
|
@ -3629,6 +3629,12 @@ impl<Signer: Sign> Channel<Signer> {
|
|||
},
|
||||
};
|
||||
|
||||
for outp in closing_tx.trust().built_transaction().output.iter() {
|
||||
if !outp.script_pubkey.is_witness_program() && outp.value < MAX_STD_OUTPUT_DUST_LIMIT_SATOSHIS {
|
||||
return Err(ChannelError::Close("Remote sent us a closing_signed with a dust output. Always use segwit closing scripts!".to_owned()));
|
||||
}
|
||||
}
|
||||
|
||||
assert!(self.shutdown_scriptpubkey.is_some());
|
||||
if let Some((last_fee, sig)) = self.last_sent_closing_fee {
|
||||
if last_fee == msg.fee_satoshis {
|
||||
|
|
Loading…
Add table
Reference in a new issue