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

Function invoice_secret

lightningd/invoice.c:138–150  ·  view source on GitHub ↗

We derive invoice secret using 1-way function from payment_preimage * (just a different one from the payment_hash!) */

Source from the content-addressed store, hash-verified

136/* We derive invoice secret using 1-way function from payment_preimage
137 * (just a different one from the payment_hash!) */
138static void invoice_secret(const struct preimage *payment_preimage,
139 struct secret *payment_secret)
140{
141 struct preimage modified;
142 struct sha256 secret;
143
144 modified = *payment_preimage;
145 modified.r[0] ^= 1;
146
147 sha256(&secret, modified.r,
148 ARRAY_SIZE(modified.r) * sizeof(*modified.r));
149 CROSS_TYPE_ASSIGNMENT(&payment_secret->data, &secret.u.u8);
150}
151
152struct invoice_payment_hook_payload {
153 struct lightningd *ld;

Callers 3

invoice_check_paymentFunction · 0.85
invoice_completeFunction · 0.85
json_invoiceFunction · 0.85

Calls 1

sha256Class · 0.70

Tested by

no test coverage detected