File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -2012,7 +2012,11 @@ 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 ( ) ) &&!( 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
+ }
2016
2020
2017
2021
if self . their_shutdown_scriptpubkey . is_some ( ) {
2018
2022
if Some ( & msg. scriptpubkey ) != self . their_shutdown_scriptpubkey . as_ref ( ) {
@@ -2098,7 +2102,7 @@ impl Channel {
2098
2102
if !self . pending_inbound_htlcs . is_empty ( ) || !self . pending_outbound_htlcs . is_empty ( ) {
2099
2103
return Err ( HandleError { err : "Remote end sent us a closing_signed while there were still pending HTLCs" , action : None } ) ;
2100
2104
}
2101
- if msg. fee_satoshis > 21000000 * 10000000 {
2105
+ if msg. fee_satoshis > 21000000 * 10000000 { //this is required to stop potential overflow in build_closing_transaction
2102
2106
return Err ( HandleError { err : "Remote tried to send us a closing tx with > 21 million BTC fee" , action : None } ) ;
2103
2107
}
2104
2108
You can’t perform that action at this time.
0 commit comments