keysend: Do not strip even TLV types that were allowlisted

Changelog-Fixed: keysend: Keysend would strip even allowed extra TLV types before resolving, this is no longer the case.
This commit is contained in:
Christian Decker
2023-02-22 14:03:28 +01:00
committed by Alex Myers
parent 5dc85d185a
commit f1c29aa3bd
2 changed files with 27 additions and 1 deletions

View File

@@ -331,6 +331,15 @@ static int tlvfield_cmp(const struct tlv_field *a,
return 0;
}
/* Check to see if a given TLV type is in the allowlist. */
static bool keysend_accept_extra_tlv_type(u64 type)
{
for (size_t i=0; i<tal_count(accepted_extra_tlvs); i++)
if (type == accepted_extra_tlvs[i])
return true;
return false;
}
static struct command_result *
htlc_accepted_invoice_created(struct command *cmd, const char *buf,
const jsmntok_t *result,
@@ -348,6 +357,9 @@ htlc_accepted_invoice_created(struct command *cmd, const char *buf,
/* Same with known fields */
if (ki->payload->fields[i].meta)
continue;
/* If the type was explicitly allowed pass it through. */
if (keysend_accept_extra_tlv_type(ki->payload->fields[i].numtype))
continue;
/* Complain about it, at least. */
if (ki->preimage_field != &ki->payload->fields[i]) {
plugin_log(cmd->plugin, LOG_INFORM,