mirror of
https://github.com/ElementsProject/lightning.git
synced 2024-11-19 18:11:28 +01:00
plugins/renepay: add localmods later.
We will get localmods from gossmods_from_listpeerchannels in the next commit, so we need to save routehints to add to that later. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
7c26f140d8
commit
c8eb46fe30
@ -493,6 +493,10 @@ static struct command_result *listpeerchannels_done(
|
||||
// any gossmap local chan. The same way there aren't fees to pay for my
|
||||
// local channels.
|
||||
|
||||
// TODO(eduardo): are there route hints for B12?
|
||||
// Add any extra hidden channel revealed by the routehints to the uncertainty network.
|
||||
uncertainty_network_add_routehints(pay_plugin->chan_extra_map, payment->routes, payment);
|
||||
|
||||
/* From now on, we keep a record of the payment, so persist it beyond this cmd. */
|
||||
tal_steal(pay_plugin->plugin, payment);
|
||||
/* When we terminate cmd for any reason, clear it from payment so we don't do it again. */
|
||||
@ -941,25 +945,26 @@ static struct command_result *json_pay(struct command *cmd,
|
||||
* actually started, it persists beyond the command, so we
|
||||
* tal_steal. */
|
||||
struct payment *payment = payment_new(cmd,
|
||||
cmd,
|
||||
take(invstr),
|
||||
take(label),
|
||||
take(description),
|
||||
take(local_offer_id),
|
||||
take(payment_secret),
|
||||
take(payment_metadata),
|
||||
&destination,
|
||||
&payment_hash,
|
||||
*msat,
|
||||
*maxfee,
|
||||
*maxdelay,
|
||||
*retryfor,
|
||||
final_cltv,
|
||||
*base_fee_penalty,
|
||||
*prob_cost_factor,
|
||||
*riskfactor_millionths,
|
||||
*min_prob_success_millionths,
|
||||
use_shadow);
|
||||
cmd,
|
||||
take(invstr),
|
||||
take(label),
|
||||
take(description),
|
||||
take(local_offer_id),
|
||||
take(payment_secret),
|
||||
take(payment_metadata),
|
||||
take(routes),
|
||||
&destination,
|
||||
&payment_hash,
|
||||
*msat,
|
||||
*maxfee,
|
||||
*maxdelay,
|
||||
*retryfor,
|
||||
final_cltv,
|
||||
*base_fee_penalty,
|
||||
*prob_cost_factor,
|
||||
*riskfactor_millionths,
|
||||
*min_prob_success_millionths,
|
||||
use_shadow);
|
||||
|
||||
/* We immediately add this payment to the payment list. */
|
||||
list_add_tail(&pay_plugin->payments, &payment->list);
|
||||
@ -1006,10 +1011,6 @@ static struct command_result *json_pay(struct command *cmd,
|
||||
fraction);
|
||||
pay_plugin->last_time = now_sec;
|
||||
|
||||
// TODO(eduardo): are there route hints for B12?
|
||||
// Add any extra hidden channel revealed by the routehints to the uncertainty network.
|
||||
uncertainty_network_add_routehints(pay_plugin->chan_extra_map, routes, payment);
|
||||
|
||||
if(!uncertainty_network_check_invariants(pay_plugin->chan_extra_map))
|
||||
plugin_log(pay_plugin->plugin,
|
||||
LOG_BROKEN,
|
||||
|
@ -10,25 +10,26 @@
|
||||
|
||||
struct payment *payment_new(const tal_t *ctx,
|
||||
struct command *cmd,
|
||||
const char *invstr TAKES,
|
||||
const char *label TAKES,
|
||||
const char *description TAKES,
|
||||
const struct sha256 *local_offer_id TAKES,
|
||||
const struct secret *payment_secret TAKES,
|
||||
const u8 *payment_metadata TAKES,
|
||||
const struct node_id *destination,
|
||||
const struct sha256 *payment_hash,
|
||||
struct amount_msat amount,
|
||||
struct amount_msat maxfee,
|
||||
unsigned int maxdelay,
|
||||
u64 retryfor,
|
||||
u16 final_cltv,
|
||||
/* Tweakable in --developer mode */
|
||||
u64 base_fee_penalty,
|
||||
u64 prob_cost_factor,
|
||||
u64 riskfactor_millionths,
|
||||
u64 min_prob_success_millionths,
|
||||
bool use_shadow)
|
||||
const char *invstr TAKES,
|
||||
const char *label TAKES,
|
||||
const char *description TAKES,
|
||||
const struct sha256 *local_offer_id TAKES,
|
||||
const struct secret *payment_secret TAKES,
|
||||
const u8 *payment_metadata TAKES,
|
||||
const struct route_info **routes TAKES,
|
||||
const struct node_id *destination,
|
||||
const struct sha256 *payment_hash,
|
||||
struct amount_msat amount,
|
||||
struct amount_msat maxfee,
|
||||
unsigned int maxdelay,
|
||||
u64 retryfor,
|
||||
u16 final_cltv,
|
||||
/* Tweakable in --developer mode */
|
||||
u64 base_fee_penalty,
|
||||
u64 prob_cost_factor,
|
||||
u64 riskfactor_millionths,
|
||||
u64 min_prob_success_millionths,
|
||||
bool use_shadow)
|
||||
{
|
||||
struct payment *p = tal(ctx,struct payment);
|
||||
p->cmd = cmd;
|
||||
@ -45,6 +46,14 @@ struct payment *payment_new(const tal_t *ctx,
|
||||
if (!amount_msat_add(&p->maxspend, amount, maxfee))
|
||||
p->maxspend = AMOUNT_MSAT(UINT64_MAX);
|
||||
|
||||
if (taken(routes))
|
||||
p->routes = tal_steal(p, routes);
|
||||
else {
|
||||
/* Deep copy */
|
||||
p->routes = tal_dup_talarr(p, const struct route_info *, routes);
|
||||
for (size_t i = 0; i < tal_count(p->routes); i++)
|
||||
p->routes[i] = tal_steal(p->routes, p->routes[i]);
|
||||
}
|
||||
p->maxdelay = maxdelay;
|
||||
p->start_time = time_now();
|
||||
p->stop_time = timeabs_add(p->start_time, time_from_sec(retryfor));
|
||||
|
@ -47,6 +47,9 @@ struct payment {
|
||||
/* invstring (bolt11 or bolt12) */
|
||||
const char *invstr;
|
||||
|
||||
/* Extracted routehints */
|
||||
const struct route_info **routes;
|
||||
|
||||
/* How much, what, where */
|
||||
struct amount_msat amount;
|
||||
struct node_id destination;
|
||||
@ -123,6 +126,7 @@ struct payment *payment_new(const tal_t *ctx,
|
||||
const struct sha256 *local_offer_id TAKES,
|
||||
const struct secret *payment_secret TAKES,
|
||||
const u8 *payment_metadata TAKES,
|
||||
const struct route_info **routes TAKES,
|
||||
const struct node_id *destination,
|
||||
const struct sha256 *payment_hash,
|
||||
struct amount_msat amount,
|
||||
|
Loading…
Reference in New Issue
Block a user