mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-19 15:14:23 +01:00
keysend: Add routehints argument to the keysend command
So far we could not reach non-publicly reachable nodes with the keysend command since we couldn't compute a route to them. With this change we can add some routehints that we may have gotten from an address book or a previous invoice, and make it more likely that we can reach the destination. Changelog-Added: keysend: `keysend` can now reach non-public nodes by providing the `routehints` argument if they are known.
This commit is contained in:
committed by
neil saitug
parent
415c2bfe3c
commit
94d11d1f9f
@@ -130,11 +130,12 @@ static const char *init(struct plugin *p, const char *buf UNUSED,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct payment_modifier *pay_mods[8] = {
|
struct payment_modifier *pay_mods[] = {
|
||||||
&keysend_pay_mod,
|
&keysend_pay_mod,
|
||||||
&local_channel_hints_pay_mod,
|
&local_channel_hints_pay_mod,
|
||||||
&directpay_pay_mod,
|
&directpay_pay_mod,
|
||||||
&shadowroute_pay_mod,
|
&shadowroute_pay_mod,
|
||||||
|
&routehints_pay_mod,
|
||||||
&exemptfee_pay_mod,
|
&exemptfee_pay_mod,
|
||||||
&waitblockheight_pay_mod,
|
&waitblockheight_pay_mod,
|
||||||
&retry_pay_mod,
|
&retry_pay_mod,
|
||||||
@@ -151,6 +152,7 @@ static struct command_result *json_keysend(struct command *cmd, const char *buf,
|
|||||||
u64 *maxfee_pct_millionths;
|
u64 *maxfee_pct_millionths;
|
||||||
u32 *maxdelay;
|
u32 *maxdelay;
|
||||||
unsigned int *retryfor;
|
unsigned int *retryfor;
|
||||||
|
struct route_info **hints;
|
||||||
#if EXPERIMENTAL_FEATURES
|
#if EXPERIMENTAL_FEATURES
|
||||||
struct tlv_field *extra_fields;
|
struct tlv_field *extra_fields;
|
||||||
#endif
|
#endif
|
||||||
@@ -171,6 +173,7 @@ static struct command_result *json_keysend(struct command *cmd, const char *buf,
|
|||||||
#if DEVELOPER
|
#if DEVELOPER
|
||||||
p_opt_def("use_shadow", param_bool, &use_shadow, true),
|
p_opt_def("use_shadow", param_bool, &use_shadow, true),
|
||||||
#endif
|
#endif
|
||||||
|
p_opt("routehints", param_routehint_array, &hints),
|
||||||
#if EXPERIMENTAL_FEATURES
|
#if EXPERIMENTAL_FEATURES
|
||||||
p_opt("extratlvs", param_extra_tlvs, &extra_fields),
|
p_opt("extratlvs", param_extra_tlvs, &extra_fields),
|
||||||
#endif
|
#endif
|
||||||
@@ -185,7 +188,7 @@ static struct command_result *json_keysend(struct command *cmd, const char *buf,
|
|||||||
p->destination_has_tlv = true;
|
p->destination_has_tlv = true;
|
||||||
p->payment_secret = NULL;
|
p->payment_secret = NULL;
|
||||||
p->amount = *msat;
|
p->amount = *msat;
|
||||||
p->routes = NULL;
|
p->routes = tal_steal(p, hints);
|
||||||
// 22 is the Rust-Lightning default and the highest minimum we know of.
|
// 22 is the Rust-Lightning default and the highest minimum we know of.
|
||||||
p->min_final_cltv_expiry = 22;
|
p->min_final_cltv_expiry = 22;
|
||||||
p->features = NULL;
|
p->features = NULL;
|
||||||
|
|||||||
Reference in New Issue
Block a user