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 @@ -2557,6 +2557,10 @@ where
25572557 channel. node_one . as_slice ( )
25582558 } ;
25592559 if sig. is_some ( ) {
2560+ // PublicKey parsing isn't entirely trivial as it requires that we check
2561+ // that the provided point is on the curve. Thus, if we don't have a
2562+ // signature to verify, we want to skip the parsing step entirely.
2563+ // This represents a substantial speedup in applying RGS snapshots.
25602564 node_pubkey = Some ( PublicKey :: from_slice ( node_id) . map_err ( |_| LightningError {
25612565 err : "Couldn't parse source node pubkey" . to_owned ( ) ,
25622566 action : ErrorAction :: IgnoreAndLog ( Level :: Debug ) ,
@@ -2569,8 +2573,8 @@ where
25692573 if let Some ( sig) = sig {
25702574 let msg_hash = hash_to_message ! ( & message_sha256d_hash( & msg) [ ..] ) ;
25712575 if node_pubkey. is_none ( ) {
2572- debug_assert ! ( false ) ;
2573- let err = "Reached unreachable code " . to_owned ( ) ;
2576+ debug_assert ! ( false , "node_pubkey should have been decoded above" ) ;
2577+ let err = "node_pubkey wasn't decoded but we need it to check a sig " . to_owned ( ) ;
25742578 return Err ( LightningError {
25752579 err, action : ErrorAction :: IgnoreAndLog ( Level :: Error ) ,
25762580 } ) ;
You can’t perform that action at this time.
0 commit comments