mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-19 15:14:23 +01:00
gossip: Fix up some comments on PR #955
Just some minor things that were suggested during review. Signed-off-by: Christian Decker <decker.christian@gmail.com>
This commit is contained in:
@@ -295,14 +295,12 @@ static void json_getroute_reply(struct subd *gossip, const u8 *reply, const int
|
|||||||
|
|
||||||
static void json_getroute(struct command *cmd, const char *buffer, const jsmntok_t *params)
|
static void json_getroute(struct command *cmd, const char *buffer, const jsmntok_t *params)
|
||||||
{
|
{
|
||||||
struct pubkey id;
|
struct lightningd *ld = cmd->ld;
|
||||||
struct pubkey from_id;
|
struct pubkey source = ld->id, destination;
|
||||||
struct pubkey *from_id_to_use;
|
|
||||||
jsmntok_t *idtok, *msatoshitok, *riskfactortok, *cltvtok, *fromidtok;
|
jsmntok_t *idtok, *msatoshitok, *riskfactortok, *cltvtok, *fromidtok;
|
||||||
u64 msatoshi;
|
u64 msatoshi;
|
||||||
unsigned cltv = 9;
|
unsigned cltv = 9;
|
||||||
double riskfactor;
|
double riskfactor;
|
||||||
struct lightningd *ld = cmd->ld;
|
|
||||||
|
|
||||||
if (!json_get_params(cmd, buffer, params,
|
if (!json_get_params(cmd, buffer, params,
|
||||||
"id", &idtok,
|
"id", &idtok,
|
||||||
@@ -314,7 +312,7 @@ static void json_getroute(struct command *cmd, const char *buffer, const jsmntok
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!json_tok_pubkey(buffer, idtok, &id)) {
|
if (!json_tok_pubkey(buffer, idtok, &destination)) {
|
||||||
command_fail(cmd, "Invalid id");
|
command_fail(cmd, "Invalid id");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -338,17 +336,12 @@ static void json_getroute(struct command *cmd, const char *buffer, const jsmntok
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fromidtok) {
|
if (fromidtok && !json_tok_pubkey(buffer, fromidtok, &source)) {
|
||||||
if (!json_tok_pubkey(buffer, fromidtok, &from_id)) {
|
command_fail(cmd, "Invalid from id");
|
||||||
command_fail(cmd, "Invalid from id");
|
return;
|
||||||
return;
|
|
||||||
}
|
|
||||||
from_id_to_use = &from_id;
|
|
||||||
} else {
|
|
||||||
from_id_to_use = &ld->id;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
u8 *req = towire_gossip_getroute_request(cmd, from_id_to_use, &id, msatoshi, riskfactor*1000, cltv);
|
u8 *req = towire_gossip_getroute_request(cmd, &source, &destination, msatoshi, riskfactor*1000, cltv);
|
||||||
subd_req(ld->gossip, ld->gossip, req, -1, 0, json_getroute_reply, cmd);
|
subd_req(ld->gossip, ld->gossip, req, -1, 0, json_getroute_reply, cmd);
|
||||||
command_still_pending(cmd);
|
command_still_pending(cmd);
|
||||||
}
|
}
|
||||||
@@ -356,7 +349,7 @@ static void json_getroute(struct command *cmd, const char *buffer, const jsmntok
|
|||||||
static const struct json_command getroute_command = {
|
static const struct json_command getroute_command = {
|
||||||
"getroute",
|
"getroute",
|
||||||
json_getroute,
|
json_getroute,
|
||||||
"Show route to {id} for {msatoshi}, using {riskfactor} and optional {cltv} (default 9)"
|
"Show route to {id} for {msatoshi}, using {riskfactor} and optional {cltv} (default 9), if specified search from {source} otherwise use this node as source."
|
||||||
};
|
};
|
||||||
AUTODATA(json_command, &getroute_command);
|
AUTODATA(json_command, &getroute_command);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user