sphinx: Passing shared secret of the HTLC up to the master

This is needed so we can create error messages and wrap them on the
way back.
This commit is contained in:
Christian Decker
2017-05-02 19:50:49 +02:00
committed by Rusty Russell
parent 79582ea415
commit 79f848145c
4 changed files with 6 additions and 2 deletions

View File

@@ -651,7 +651,8 @@ static void their_htlc_locked(const struct htlc *htlc, struct peer *peer)
rs->nextcase == ONION_FORWARD,
rs->hop_data.amt_forward,
rs->hop_data.outgoing_cltv,
&rs->hop_data.channel_id);
&rs->hop_data.channel_id,
&ss);
daemon_conn_send(&peer->master, take(msg));
tal_free(tmpctx);
return;

View File

@@ -88,6 +88,7 @@ channel_accepted_htlc,0,forward,bool
channel_accepted_htlc,0,amt_to_forward,u64
channel_accepted_htlc,0,outgoing_cltv_value,u32
channel_accepted_htlc,0,next_channel,struct short_channel_id
channel_accepted_htlc,0,shared_secret,32
# FIXME: Add code to commit current channel state!
1 # Shouldn't happen
88 channel_failed_htlc,0,len,2 channel_failed_htlc,0,id,8
89 channel_failed_htlc,0,reason,len*u8 channel_failed_htlc,0,len,2
90 # This HTLC was returned malformed channel_failed_htlc,0,reason,len*u8
91 # This HTLC was returned malformed
92 channel_malformed_htlc,10
93 channel_malformed_htlc,0,id,8
94 channel_malformed_htlc,0,sha256_of_onion,32

View File

@@ -28,6 +28,7 @@ struct htlc_end {
u32 outgoing_cltv_value;
u32 cltv_expiry;
struct sha256 payment_hash;
struct sha256 shared_secret;
};
static inline const struct htlc_end *keyof_htlc_end(const struct htlc_end *e)

View File

@@ -1088,7 +1088,8 @@ static int peer_accepted_htlc(struct peer *peer, const u8 *msg)
hend->next_onion, &forward,
&hend->amt_to_forward,
&hend->outgoing_cltv_value,
&hend->next_channel)) {
&hend->next_channel,
&hend->shared_secret)) {
log_broken(peer->log, "bad fromwire_channel_accepted_htlc %s",
tal_hex(peer, msg));
return -1;