From: Valentine Wallace Date: Tue, 12 Sep 2023 18:56:54 +0000 (-0400) Subject: Refuse to pathfind when provided our_node_id matches internal dummy pk X-Git-Tag: v0.0.117-rc1~19^2~7 X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=commitdiff_plain;h=7632cfe5174ecaaea1c8d3b711b44cbcd87ec506;p=rust-lightning Refuse to pathfind when provided our_node_id matches internal dummy pk The fuzzer managed to hit this and it causes some invalid paths to be generated internally. --- diff --git a/lightning/src/routing/router.rs b/lightning/src/routing/router.rs index 184e3bcd..53bd9243 100644 --- a/lightning/src/routing/router.rs +++ b/lightning/src/routing/router.rs @@ -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});