getroute: add a risk factor.

We need some way to reflect the tradeoff between the possible delay if
a payment gets stuck, and the fees charged by nodes.  This adds a risk
factor which reflects the probability that a node goes down, and the
cost associated with losing access to our funds for a given time.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2016-09-06 16:47:48 +09:30
parent e2bc70bfce
commit ca80fc0286
6 changed files with 60 additions and 12 deletions

View File

@@ -64,6 +64,16 @@ bool json_tok_u64(const char *buffer, const jsmntok_t *tok,
return true;
}
bool json_tok_double(const char *buffer, const jsmntok_t *tok, double *num)
{
char *end;
*num = strtod(buffer + tok->start, &end);
if (end != buffer + tok->end)
return false;
return true;
}
bool json_tok_number(const char *buffer, const jsmntok_t *tok,
unsigned int *num)
{