Refuse to pathfind when provided our_node_id matches internal dummy pk
[rust-lightning] / 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});