diff --git a/common/onion.c b/common/onion.c index acb8b8ad7..535f5fa57 100644 --- a/common/onion.c +++ b/common/onion.c @@ -267,6 +267,7 @@ struct onion_payload *onion_decode(const tal_t *ctx, const struct route_step *rs, const struct pubkey *blinding, const struct secret *blinding_ss, + u64 *accepted_extra_tlvs, u64 *failtlvtype, size_t *failtlvpos) { @@ -312,7 +313,7 @@ struct onion_payload *onion_decode(const tal_t *ctx, if (!fromwire_tlv_payload(&cursor, &max, tlv)) goto fail; - if (!tlv_payload_is_valid(tlv, failtlvpos)) { + if (!tlv_fields_valid(tlv->fields, accepted_extra_tlvs, failtlvpos)) { *failtlvtype = tlv->fields[*failtlvpos].numtype; goto fail; } diff --git a/common/onion.h b/common/onion.h index 5dbbc6212..157f4b0fa 100644 --- a/common/onion.h +++ b/common/onion.h @@ -68,6 +68,7 @@ size_t onion_payload_length(const u8 *raw_payload, size_t len, * onion_payload_length(). * @blinding: the optional incoming blinding point. * @blinding_ss: the shared secret derived from @blinding (iff that's non-NULL) + * @accepted_extra_tlvs: Allow these types to be in the TLV without failing * @failtlvtype: (out) the tlv type which failed to parse. * @failtlvpos: (out) the offset in the tlv which failed to parse. * @@ -77,6 +78,7 @@ struct onion_payload *onion_decode(const tal_t *ctx, const struct route_step *rs, const struct pubkey *blinding, const struct secret *blinding_ss, + u64 *accepted_extra_tlvs, u64 *failtlvtype, size_t *failtlvpos); diff --git a/lightningd/peer_htlcs.c b/lightningd/peer_htlcs.c index d0887d650..f56565e1b 100644 --- a/lightningd/peer_htlcs.c +++ b/lightningd/peer_htlcs.c @@ -927,6 +927,7 @@ static bool htlc_accepted_hook_deserialize(struct htlc_accepted_hook_payload *re rs->raw_payload = prepend_length(rs, take(payload)); request->payload = onion_decode(request, rs, hin->blinding, &hin->blinding_ss, + ld->accept_extra_tlv_types, &request->failtlvtype, &request->failtlvpos); @@ -1243,6 +1244,7 @@ static bool peer_accepted_htlc(const tal_t *ctx, hook_payload->route_step = tal_steal(hook_payload, rs); hook_payload->payload = onion_decode(hook_payload, rs, hin->blinding, &hin->blinding_ss, + ld->accept_extra_tlv_types, &hook_payload->failtlvtype, &hook_payload->failtlvpos); hook_payload->ld = ld; diff --git a/wallet/db_postgres_sqlgen.c b/wallet/db_postgres_sqlgen.c index 5ca4e2066..6d69b9e80 100644 --- a/wallet/db_postgres_sqlgen.c +++ b/wallet/db_postgres_sqlgen.c @@ -1924,4 +1924,4 @@ struct db_query db_postgres_queries[] = { #endif /* LIGHTNINGD_WALLET_GEN_DB_POSTGRES */ -// SHA256STAMP:0cb27df4073d1a617d3d1712579e28c190208818458ea8b35c3c88276b428dc0 +// SHA256STAMP:3c0924d3409c1d356d9f90291ae54895d85f34c6a3a42388ad4fb6bfbf13820d diff --git a/wallet/db_sqlite3_sqlgen.c b/wallet/db_sqlite3_sqlgen.c index 70365e629..945e44085 100644 --- a/wallet/db_sqlite3_sqlgen.c +++ b/wallet/db_sqlite3_sqlgen.c @@ -1924,4 +1924,4 @@ struct db_query db_sqlite3_queries[] = { #endif /* LIGHTNINGD_WALLET_GEN_DB_SQLITE3 */ -// SHA256STAMP:0cb27df4073d1a617d3d1712579e28c190208818458ea8b35c3c88276b428dc0 +// SHA256STAMP:3c0924d3409c1d356d9f90291ae54895d85f34c6a3a42388ad4fb6bfbf13820d diff --git a/wallet/statements_gettextgen.po b/wallet/statements_gettextgen.po index 635a8f473..f750b00a6 100644 --- a/wallet/statements_gettextgen.po +++ b/wallet/statements_gettextgen.po @@ -1262,11 +1262,11 @@ msgstr "" msgid "not a valid SQL statement" msgstr "" -#: wallet/test/run-wallet.c:1450 +#: wallet/test/run-wallet.c:1451 msgid "SELECT COUNT(1) FROM channel_funding_inflights WHERE channel_id = ?;" msgstr "" -#: wallet/test/run-wallet.c:1648 +#: wallet/test/run-wallet.c:1649 msgid "INSERT INTO channels (id) VALUES (1);" msgstr "" -# SHA256STAMP:af00e095200a0cdcd525759a786e1897d11a0effffd7d4b9d618bfa780acd229 +# SHA256STAMP:913e7b10afc4160e8b437a2c54839d996a94667fc0c00a22f3ca97856491ac72 diff --git a/wallet/test/run-wallet.c b/wallet/test/run-wallet.c index 191df6698..1ad0c83ac 100644 --- a/wallet/test/run-wallet.c +++ b/wallet/test/run-wallet.c @@ -525,6 +525,7 @@ struct onion_payload *onion_decode(const tal_t *ctx UNNEEDED, const struct route_step *rs UNNEEDED, const struct pubkey *blinding UNNEEDED, const struct secret *blinding_ss UNNEEDED, + u64 *accepted_extra_tlvs UNNEEDED, u64 *failtlvtype UNNEEDED, size_t *failtlvpos UNNEEDED) { fprintf(stderr, "onion_decode called!\n"); abort(); }