@@ -2561,25 +2561,27 @@ where
2561
2561
// that the provided point is on the curve. Thus, if we don't have a
2562
2562
// signature to verify, we want to skip the parsing step entirely.
2563
2563
// This represents a substantial speedup in applying RGS snapshots.
2564
- node_pubkey = Some ( PublicKey :: from_slice ( node_id) . map_err ( |_| LightningError {
2565
- err : "Couldn't parse source node pubkey" . to_owned ( ) ,
2566
- action : ErrorAction :: IgnoreAndLog ( Level :: Debug ) ,
2567
- } ) ?) ;
2564
+ node_pubkey =
2565
+ Some ( PublicKey :: from_slice ( node_id) . map_err ( |_| LightningError {
2566
+ err : "Couldn't parse source node pubkey" . to_owned ( ) ,
2567
+ action : ErrorAction :: IgnoreAndLog ( Level :: Debug ) ,
2568
+ } ) ?) ;
2568
2569
}
2569
2570
} ,
2570
2571
}
2571
2572
}
2572
2573
2573
2574
if let Some ( sig) = sig {
2574
2575
let msg_hash = hash_to_message ! ( & message_sha256d_hash( & msg) [ ..] ) ;
2575
- if node_pubkey. is_none ( ) {
2576
+ let node_pubkey = if let Some ( pubkey) = node_pubkey {
2577
+ pubkey
2578
+ } else {
2576
2579
debug_assert ! ( false , "node_pubkey should have been decoded above" ) ;
2577
2580
let err = "node_pubkey wasn't decoded but we need it to check a sig" . to_owned ( ) ;
2578
- return Err ( LightningError {
2579
- err, action : ErrorAction :: IgnoreAndLog ( Level :: Error ) ,
2580
- } ) ;
2581
- }
2582
- secp_verify_sig ! ( self . secp_ctx, & msg_hash, & sig, & node_pubkey. unwrap( ) , "channel_update" ) ;
2581
+ let action = ErrorAction :: IgnoreAndLog ( Level :: Error ) ;
2582
+ return Err ( LightningError { err, action } ) ;
2583
+ } ;
2584
+ secp_verify_sig ! ( self . secp_ctx, & msg_hash, & sig, & node_pubkey, "channel_update" ) ;
2583
2585
}
2584
2586
2585
2587
if only_verify {
0 commit comments