Skip to content

Commit 9bbb9ab

Browse files
committed
renepay: use askrene-age to relax knowledge
Changelog-None. Signed-off-by: Lagrang3 <[email protected]>
1 parent df6bf25 commit 9bbb9ab

File tree

1 file changed

+19
-7
lines changed

1 file changed

+19
-7
lines changed

plugins/renepay/mods.c

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1120,17 +1120,29 @@ REGISTER_PAYMENT_MODIFIER(pendingsendpays, pendingsendpays_cb);
11201120
* Reduce the knowledge of the network as time goes by.
11211121
*/
11221122

1123+
static struct command_result *age_done(struct command *cmd,
1124+
const char *method UNUSED,
1125+
const char *buf UNUSED,
1126+
const jsmntok_t *result UNUSED,
1127+
struct payment *payment)
1128+
{
1129+
return payment_continue(payment);
1130+
}
1131+
11231132
static struct command_result *knowledgerelax_cb(struct payment *payment)
11241133
{
11251134
const u64 now_sec = time_now().ts.tv_sec;
1126-
enum renepay_errorcode err = uncertainty_relax(
1127-
pay_plugin->uncertainty, now_sec - pay_plugin->last_time);
1128-
if (err)
1129-
plugin_err(pay_plugin->plugin,
1130-
"uncertainty_relax failed with error %s",
1131-
renepay_errorcode_name(err));
1135+
// const u64 time_delta = now_sec - pay_plugin->last_time;
11321136
pay_plugin->last_time = now_sec;
1133-
return payment_continue(payment);
1137+
/* FIXME: implement a Markovian state relaxation, the time delta is all
1138+
* we need to provide. */
1139+
struct command *cmd = payment_command(payment);
1140+
assert(cmd);
1141+
struct out_req *req = jsonrpc_request_start(
1142+
cmd, "askrene-age", age_done, payment_rpc_failure, payment);
1143+
json_add_string(req->js, "layer", RENEPAY_LAYER);
1144+
json_add_u64(req->js, "cutoff", now_sec - TIMER_FORGET_SEC);
1145+
return send_outreq(req);
11341146
}
11351147

11361148
REGISTER_PAYMENT_MODIFIER(knowledgerelax, knowledgerelax_cb);

0 commit comments

Comments
 (0)