Refuse to pathfind when provided our_node_id matches internal dummy pk
authorValentine Wallace <vwallace@protonmail.com>
Tue, 12 Sep 2023 18:56:54 +0000 (14:56 -0400)
committerValentine Wallace <vwallace@protonmail.com>
Wed, 27 Sep 2023 13:37:21 +0000 (09:37 -0400)
The fuzzer managed to hit this and it causes some invalid paths to be generated
internally.

lightning/src/routing/router.rs

index 184e3bcd8cdb938774d09f499b2ed54d2a073531..53bd92434d5376fef3fa32245a2deb60b786acf8 100644 (file)
@@ -1489,6 +1489,9 @@ where L::Target: Logger {
        if payee_node_id_opt.map_or(false, |payee| payee == our_node_id) {
                return Err(LightningError{err: "Cannot generate a route to ourselves".to_owned(), action: ErrorAction::IgnoreError});
        }
+       if our_node_id == maybe_dummy_payee_node_id {
+               return Err(LightningError{err: "Invalid origin node id provided, use a different one".to_owned(), action: ErrorAction::IgnoreError});
+       }
 
        if final_value_msat > MAX_VALUE_MSAT {
                return Err(LightningError{err: "Cannot generate a route of more value than all existing satoshis".to_owned(), action: ErrorAction::IgnoreError});