mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-23 00:54:20 +01:00
routing: Refuse self-route
Fixes #50. Was causing a segfault because it was creating an empty route and was trying to extract the first hop as next hop. Routes through self can still be created manually, but `sendpay` would still refuse to act on them due to the missing self-link.
This commit is contained in:
@@ -289,10 +289,15 @@ struct peer *find_route(struct lightningd_state *dstate,
|
|||||||
* at the end, and need to derive how much we need to send. */
|
* at the end, and need to derive how much we need to send. */
|
||||||
dst = get_node(dstate, &dstate->id);
|
dst = get_node(dstate, &dstate->id);
|
||||||
src = get_node(dstate, to);
|
src = get_node(dstate, to);
|
||||||
|
|
||||||
if (!src) {
|
if (!src) {
|
||||||
log_info_struct(dstate->base_log, "find_route: cannot find %s",
|
log_info_struct(dstate->base_log, "find_route: cannot find %s",
|
||||||
struct pubkey, to);
|
struct pubkey, to);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
} else if (dst == src) {
|
||||||
|
log_info_struct(dstate->base_log, "find_route: this is %s, refusing to create empty route",
|
||||||
|
struct pubkey, to);
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Reset all the information. */
|
/* Reset all the information. */
|
||||||
|
|||||||
Reference in New Issue
Block a user