Skip to content

Commit 5f34470

Browse files
committed
added check as per bolt to that scriptpuibkey must be of certain types
1 parent ac821e4 commit 5f34470

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/ln/channel.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2012,7 +2012,11 @@ impl Channel {
20122012
if self.channel_outbound && msg.scriptpubkey.len() > 34 {
20132013
return Err(HandleError{err: "Got shutdown_scriptpubkey of absurd length from remote peer", action: None});
20142014
}
2015-
//TODO: Check shutdown_scriptpubkey form as BOLT says we must? WHYYY
2015+
2016+
//Check shutdown_scriptpubkey form as BOLT says we must
2017+
if !(msg.scriptpubkey.is_p2pkh())&&!(msg.scriptpubkey.is_p2sh())&&!(msg.scriptpubkey.is_v0_p2wpkh())&&!(msg.scriptpubkey.is_v0_p2wsh()){
2018+
return Err(HandleError{err: "Got an invalid scriptpubkey from remote peer", action: Some(msgs::ErrorAction::DisconnectPeer{ msg: None })});
2019+
}
20162020

20172021
if self.their_shutdown_scriptpubkey.is_some() {
20182022
if Some(&msg.scriptpubkey) != self.their_shutdown_scriptpubkey.as_ref() {

0 commit comments

Comments
 (0)