From 8252ac5a6e1a382b6fd68b0fc429dd517c811889 Mon Sep 17 00:00:00 2001 From: Christian Decker Date: Tue, 23 Feb 2021 18:19:55 +0100 Subject: [PATCH] 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 --- plugins/keysend.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/plugins/keysend.c b/plugins/keysend.c index 51fe7fcf0..f4b682a52 100644 --- a/plugins/keysend.c +++ b/plugins/keysend.c @@ -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)