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 {
2012
2012
if self . channel_outbound && msg. scriptpubkey . len ( ) > 34 {
2013
2013
return Err ( HandleError { err : "Got shutdown_scriptpubkey of absurd length from remote peer" , action : None } ) ;
2014
2014
}
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
+ }
2016
2021
2017
2022
if self . their_shutdown_scriptpubkey . is_some ( ) {
2018
2023
if Some ( & msg. scriptpubkey ) != self . their_shutdown_scriptpubkey . as_ref ( ) {
@@ -2098,7 +2103,7 @@ impl Channel {
2098
2103
if !self . pending_inbound_htlcs . is_empty ( ) || !self . pending_outbound_htlcs . is_empty ( ) {
2099
2104
return Err ( HandleError { err : "Remote end sent us a closing_signed while there were still pending HTLCs" , action : None } ) ;
2100
2105
}
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
2102
2107
return Err ( HandleError { err : "Remote tried to send us a closing tx with > 21 million BTC fee" , action : None } ) ;
2103
2108
}
2104
2109
You can’t perform that action at this time.
0 commit comments