mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-20 07:34:24 +01:00
daemon: add dev-routefail command.
We're about to change the code so that if it can't route, it will fail the HTLC. The current low-level tests will hate this, so have a dev switch to turn that off. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
@@ -299,3 +299,35 @@ const struct json_command add_route_command = {
|
||||
"Returns an empty result on success"
|
||||
};
|
||||
|
||||
static void json_routefail(struct command *cmd,
|
||||
const char *buffer, const jsmntok_t *params)
|
||||
{
|
||||
jsmntok_t *enabletok;
|
||||
bool enable;
|
||||
|
||||
if (!json_get_params(buffer, params,
|
||||
"enable", &enabletok,
|
||||
NULL)) {
|
||||
command_fail(cmd, "Need enable");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!json_tok_bool(buffer, enabletok, &enable)) {
|
||||
command_fail(cmd, "enable must be true or false");
|
||||
return;
|
||||
}
|
||||
|
||||
log_debug(cmd->dstate->base_log, "dev-routefail: routefail %s",
|
||||
enable ? "enabled" : "disabled");
|
||||
cmd->dstate->dev_never_routefail = !enable;
|
||||
|
||||
command_success(cmd, null_response(cmd));
|
||||
}
|
||||
const struct json_command routefail_command = {
|
||||
"dev-routefail",
|
||||
json_routefail,
|
||||
"FAIL htlcs that we can't route if {enable}",
|
||||
"Returns an empty result on success"
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user