MCPcopy Create free account
hub / github.com/ElementsProject/lightning / invoice_secret_bolt12

Function invoice_secret_bolt12

lightningd/invoice.c:146–165  ·  view source on GitHub ↗

FIXME: This is a hack. The real secret should be a signature of some * onion key, using the payer_id */

Source from the content-addressed store, hash-verified

144/* FIXME: This is a hack. The real secret should be a signature of some
145 * onion key, using the payer_id */
146static void invoice_secret_bolt12(struct lightningd *ld,
147 const char *invstring,
148 struct secret *payment_secret)
149{
150 char *fail;
151 struct tlv_invoice *inv;
152 struct sha256 merkle;
153
154 inv = invoice_decode(tmpctx, invstring, strlen(invstring),
155 NULL, NULL, &fail);
156 if (!inv) {
157 log_broken(ld->log, "Unable to decode our invoice %s",
158 invstring);
159 return;
160 }
161
162 merkle_tlv(inv->fields, &merkle);
163 BUILD_ASSERT(sizeof(*payment_secret) == sizeof(merkle));
164 memcpy(payment_secret, &merkle, sizeof(merkle));
165}
166
167struct invoice_payment_hook_payload {
168 struct lightningd *ld;

Callers 1

invoice_check_paymentFunction · 0.85

Calls 2

invoice_decodeFunction · 0.50
merkle_tlvFunction · 0.50

Tested by

no test coverage detected