mirror of
https://github.com/aljazceru/lightning.git
synced 2026-01-06 23:54:22 +01:00
channeld: support HTLCs with blinding (EXPERIMENTAL_FEATURES)
Note that it's channeld which calculates the shared secret, too. This minimizes the work that lightningd has to do, at cost of passing this through. We also don't yet save the blinding field(s) to the database. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
@@ -48,6 +48,11 @@ struct htlc_in {
|
||||
/* Remember the timestamp we received this HTLC so we can later record
|
||||
* it, and the resolution time, in the forwards table. */
|
||||
struct timeabs received_time;
|
||||
|
||||
/* If it was blinded. */
|
||||
struct pubkey *blinding;
|
||||
/* Only set if blinding != NULL */
|
||||
struct secret blinding_ss;
|
||||
};
|
||||
|
||||
struct htlc_out {
|
||||
@@ -83,6 +88,9 @@ struct htlc_out {
|
||||
|
||||
/* Where it's from, if not going to us. */
|
||||
struct htlc_in *in;
|
||||
|
||||
/* Blinding to send alongside, if any. */
|
||||
struct pubkey *blinding;
|
||||
};
|
||||
|
||||
static inline const struct htlc_key *keyof_htlc_in(const struct htlc_in *in)
|
||||
@@ -133,6 +141,8 @@ struct htlc_in *new_htlc_in(const tal_t *ctx,
|
||||
struct amount_msat msat, u32 cltv_expiry,
|
||||
const struct sha256 *payment_hash,
|
||||
const struct secret *shared_secret TAKES,
|
||||
const struct pubkey *blinding TAKES,
|
||||
const struct secret *blinding_ss,
|
||||
const u8 *onion_routing_packet);
|
||||
|
||||
/* You need to set the ID, then connect_htlc_out this! */
|
||||
@@ -142,6 +152,7 @@ struct htlc_out *new_htlc_out(const tal_t *ctx,
|
||||
u32 cltv_expiry,
|
||||
const struct sha256 *payment_hash,
|
||||
const u8 *onion_routing_packet,
|
||||
const struct pubkey *blinding,
|
||||
bool am_origin,
|
||||
u64 partid,
|
||||
struct htlc_in *in);
|
||||
|
||||
Reference in New Issue
Block a user