pay: Keysend tries to send even if featurebit 55 isn't set

As pointed out by @cfromknecht [1] there was no formal standardization of
the featurebit, and lnd would try a keysend whenever TLV was supported
by the recipient. This mimics that behavior by checking only that TLV
is enabled.

Changelog-Fixes: keysend: We now attempt to send with keysend even if the node hasn't explicitly opted in by setting a featurebit.

[1] https://github.com/ElementsProject/lightning/issues/4299#issuecomment-781606865
This commit is contained in:
Christian Decker 2021-02-23 18:19:55 +01:00 committed by Rusty Russell
parent 1e6626ff43
commit 8252ac5a6e

View file

@ -56,23 +56,15 @@ static struct keysend_data *keysend_init(struct payment *p)
static void keysend_cb(struct keysend_data *d, struct payment *p) {
struct createonion_hop *last_payload;
size_t hopcount;
struct gossmap_node *node;
bool enabled;
const struct gossmap *gossmap = get_gossmap(p->plugin);
/* On the root payment we perform the featurebit check. */
if (p->parent == NULL && p->step == PAYMENT_STEP_INITIALIZED) {
node = gossmap_find_node(gossmap, p->destination);
enabled = gossmap_node_get_feature(gossmap, node,
KEYSEND_FEATUREBIT) != -1;
if (!enabled)
if (!payment_root(p)->destination_has_tlv)
return payment_fail(
p,
"Recipient %s does not support keysend payments "
"(feature bit %d missing in node announcement)",
node_id_to_hexstr(tmpctx, p->destination),
KEYSEND_FEATUREBIT);
"(no TLV support)",
node_id_to_hexstr(tmpctx, p->destination));
}
if (p->step != PAYMENT_STEP_ONION_PAYLOAD)