mpp: Add CLI option to opt-out of multi-part payments

Several tests are not well-suited for mpp, so I added a CLI option to opt-out
of the MPP support at startup time.
This commit is contained in:
Christian Decker
2020-07-10 14:48:00 +02:00
parent a287bbe55d
commit de75d3ac0c
8 changed files with 100 additions and 8 deletions

View File

@@ -862,6 +862,27 @@ char *u32_option(const char *arg, u32 *i)
return NULL;
}
char *bool_option(const char *arg, bool *i)
{
if (!streq(arg, "true") && !streq(arg, "false"))
return tal_fmt(NULL, "'%s' is not a bool, must be \"true\" or \"false\"", arg);
*i = streq(arg, "true");
return NULL;
}
char *flag_option(const char *arg, bool *i)
{
/* We only get called if the flag was provided, so *i should be false
* by default */
assert(*i == false);
if (!streq(arg, "true"))
return tal_fmt(NULL, "Invalid argument '%s' passed to a flag", arg);
*i = true;
return NULL;
}
char *charp_option(const char *arg, char **p)
{
*p = tal_strdup(NULL, arg);