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
2557
2557
channel. node_one . as_slice ( )
2558
2558
} ;
2559
2559
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.
2560
2564
node_pubkey = Some ( PublicKey :: from_slice ( node_id) . map_err ( |_| LightningError {
2561
2565
err : "Couldn't parse source node pubkey" . to_owned ( ) ,
2562
2566
action : ErrorAction :: IgnoreAndLog ( Level :: Debug ) ,
@@ -2569,8 +2573,8 @@ where
2569
2573
if let Some ( sig) = sig {
2570
2574
let msg_hash = hash_to_message ! ( & message_sha256d_hash( & msg) [ ..] ) ;
2571
2575
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 ( ) ;
2574
2578
return Err ( LightningError {
2575
2579
err, action : ErrorAction :: IgnoreAndLog ( Level :: Error ) ,
2576
2580
} ) ;
You can’t perform that action at this time.
0 commit comments