diff --git a/gossipd/gossip_wire.csv b/gossipd/gossip_wire.csv index 658f54681..e86f1260e 100644 --- a/gossipd/gossip_wire.csv +++ b/gossipd/gossip_wire.csv @@ -29,7 +29,8 @@ gossip_getroute_request,3006 gossip_getroute_request,,source,struct pubkey gossip_getroute_request,,destination,struct pubkey gossip_getroute_request,,msatoshi,u64 -gossip_getroute_request,,riskfactor,u16 +# We don't pass doubles, so pass riskfactor * 1000000. +gossip_getroute_request,,riskfactor_by_million,u64 gossip_getroute_request,,final_cltv,u32 gossip_getroute_request,,fuzz,double gossip_getroute_request,,num_excluded,u16 diff --git a/gossipd/gossipd.c b/gossipd/gossipd.c index 735020228..556e12aed 100644 --- a/gossipd/gossipd.c +++ b/gossipd/gossipd.c @@ -1894,7 +1894,7 @@ static struct io_plan *getroute_req(struct io_conn *conn, struct daemon *daemon, struct pubkey source, destination; u64 msatoshi; u32 final_cltv; - u16 riskfactor; + u64 riskfactor_by_million; u32 max_hops; u8 *out; struct route_hop *hops; @@ -1909,7 +1909,7 @@ static struct io_plan *getroute_req(struct io_conn *conn, struct daemon *daemon, * avoid being too predictable. */ if (!fromwire_gossip_getroute_request(msg, msg, &source, &destination, - &msatoshi, &riskfactor, + &msatoshi, &riskfactor_by_million, &final_cltv, &fuzz, &excluded, &max_hops)) @@ -1921,7 +1921,7 @@ static struct io_plan *getroute_req(struct io_conn *conn, struct daemon *daemon, /* routing.c does all the hard work; can return NULL. */ hops = get_route(tmpctx, daemon->rstate, &source, &destination, - msatoshi, riskfactor, final_cltv, + msatoshi, riskfactor_by_million / 1000000.0, final_cltv, fuzz, pseudorand_u64(), excluded, max_hops); out = towire_gossip_getroute_reply(NULL, hops); diff --git a/lightningd/gossip_control.c b/lightningd/gossip_control.c index 3fc0a18ff..1b2a9b30f 100644 --- a/lightningd/gossip_control.c +++ b/lightningd/gossip_control.c @@ -352,7 +352,8 @@ static struct command_result *json_getroute(struct command *cmd, } u8 *req = towire_gossip_getroute_request(cmd, source, destination, - *msatoshi, *riskfactor * 1000, + *msatoshi, + *riskfactor * 1000000.0, *cltv, fuzz, excluded, *max_hops);