paymod: Activate paymod and move legacy pay to legacypay command

As suggested during the paymod-03 review it is better to activate the new code
right away, and give users an escape hatch to use the legacy code instead. The
way I implemented it allows using either `legacypay` or `pay` and then set
`legacy` to switch to the other implementation.

Changelog-Added: JSON-RPC: The `pay` command now uses the new payment flow, the new `legacypay` command can be used to issue payment with the legacy code if required.

Suggested-by: Rusty Russell <@rustyrussell>
Suggested-by: ZmnSCPxj <@zmnscpxj>
This commit is contained in:
Christian Decker
2020-07-02 14:52:16 +02:00
committed by Rusty Russell
parent 514c4044c8
commit 5776a33116
3 changed files with 45 additions and 191 deletions

View File

@@ -1084,7 +1084,7 @@ static void payment_finished(struct payment *p)
return;
} else if (result.failure == NULL || result.failure->failcode < NODE) {
/* This is failing because we have no more routes to try */
ret = jsonrpc_stream_fail(cmd, PAY_ROUTE_NOT_FOUND,
ret = jsonrpc_stream_fail(cmd, PAY_STOPPED_RETRYING,
NULL);
json_add_string(
ret, "message",