File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed
Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -2012,7 +2012,12 @@ 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 ( ) )
2018+ && !( msg. scriptpubkey . is_v0_p2wpkh ( ) ) && !( msg. scriptpubkey . is_v0_p2wsh ( ) ) {
2019+ return Err ( HandleError { err : "Got an invalid scriptpubkey from remote peer" , action : Some ( msgs:: ErrorAction :: DisconnectPeer { msg : None } ) } ) ;
2020+ }
20162021
20172022 if self . their_shutdown_scriptpubkey . is_some ( ) {
20182023 if Some ( & msg. scriptpubkey ) != self . their_shutdown_scriptpubkey . as_ref ( ) {
@@ -2098,7 +2103,7 @@ impl Channel {
20982103 if !self . pending_inbound_htlcs . is_empty ( ) || !self . pending_outbound_htlcs . is_empty ( ) {
20992104 return Err ( HandleError { err : "Remote end sent us a closing_signed while there were still pending HTLCs" , action : None } ) ;
21002105 }
2101- if msg. fee_satoshis > 21000000 * 10000000 {
2106+ if msg. fee_satoshis > 21000000 * 10000000 { //this is required to stop potential overflow in build_closing_transaction
21022107 return Err ( HandleError { err : "Remote tried to send us a closing tx with > 21 million BTC fee" , action : None } ) ;
21032108 }
21042109
You can’t perform that action at this time.
0 commit comments