openingd: update to BOLT with htlckey.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2017-11-15 19:55:19 +10:30 committed by Christian Decker
parent fc05779f78
commit 46f2e17905
4 changed files with 19 additions and 10 deletions

View File

@ -442,7 +442,8 @@ static bool extract_channel_id(const u8 *in_pkt, struct channel_id *channel_id)
&ignored_u16, &ignored_u16,
&ignored_pubkey, &ignored_pubkey,
&ignored_pubkey, &ignored_pubkey,
&ignored_pubkey, &ignored_u8))
&ignored_pubkey, &ignored_pubkey,
&ignored_u8))
return true;
return false;
}

View File

@ -253,6 +253,7 @@ static u8 *funder_channel(struct state *state,
&ours->revocation,
&ours->payment,
&ours->delayed_payment,
&ours->htlc,
&state->next_per_commit[LOCAL],
channel_flags);
if (!sync_crypto_write(&state->cs, PEER_FD, msg))
@ -287,13 +288,11 @@ static u8 *funder_channel(struct state *state,
&theirs.revocation,
&theirs.payment,
&theirs.delayed_payment,
&theirs.htlc,
&state->next_per_commit[REMOTE]))
peer_failed(PEER_FD, &state->cs, &state->channel_id,
"Parsing accept_channel %s", tal_hex(msg, msg));
/* FIXME */
theirs.htlc = theirs.payment;
/* BOLT #2:
*
* The `temporary_channel_id` MUST be the same as the
@ -493,15 +492,13 @@ static u8 *fundee_channel(struct state *state,
&theirs.revocation,
&theirs.payment,
&theirs.delayed_payment,
&theirs.htlc,
&state->next_per_commit[REMOTE],
&channel_flags))
peer_failed(PEER_FD, &state->cs, NULL,
"Bad open_channel %s",
tal_hex(peer_msg, peer_msg));
/* FIXME */
theirs.htlc = theirs.payment;
/* BOLT #2:
*
* The receiving node MUST reject the channel if the `chain_hash` value
@ -567,6 +564,7 @@ static u8 *fundee_channel(struct state *state,
&ours->revocation,
&ours->payment,
&ours->delayed_payment,
&ours->htlc,
&state->next_per_commit[LOCAL]);
if (!sync_crypto_write(&state->cs, PEER_FD, take(msg)))

View File

@ -30,8 +30,9 @@ open_channel,120,funding_pubkey,33
open_channel,153,revocation_basepoint,33
open_channel,186,payment_basepoint,33
open_channel,219,delayed_payment_basepoint,33
open_channel,252,first_per_commitment_point,33
open_channel,285,channel_flags,1
open_channel,252,htlc_basepoint,33
open_channel,285,first_per_commitment_point,33
open_channel,318,channel_flags,1
accept_channel,33
accept_channel,0,temporary_channel_id,32
accept_channel,32,dust_limit_satoshis,8
@ -45,7 +46,8 @@ accept_channel,72,funding_pubkey,33
accept_channel,105,revocation_basepoint,33
accept_channel,138,payment_basepoint,33
accept_channel,171,delayed_payment_basepoint,33
accept_channel,204,first_per_commitment_point,33
accept_channel,204,htlc_basepoint,33
accept_channel,237,first_per_commitment_point,33
funding_created,34
funding_created,0,temporary_channel_id,32
funding_created,32,funding_txid,32

View File

@ -109,6 +109,7 @@ struct msg_accept_channel {
struct pubkey revocation_basepoint;
struct pubkey payment_basepoint;
struct pubkey delayed_payment_basepoint;
struct pubkey htlc_basepoint;
struct pubkey first_per_commitment_point;
};
struct msg_update_fulfill_htlc {
@ -180,6 +181,7 @@ struct msg_open_channel {
struct pubkey revocation_basepoint;
struct pubkey payment_basepoint;
struct pubkey delayed_payment_basepoint;
struct pubkey htlc_basepoint;
struct pubkey first_per_commitment_point;
u8 channel_flags;
};
@ -273,6 +275,7 @@ static void *towire_struct_open_channel(const tal_t *ctx,
&s->revocation_basepoint,
&s->payment_basepoint,
&s->delayed_payment_basepoint,
&s->htlc_basepoint,
&s->first_per_commitment_point,
s->channel_flags);
}
@ -297,6 +300,7 @@ static struct msg_open_channel *fromwire_struct_open_channel(const tal_t *ctx, c
&s->revocation_basepoint,
&s->payment_basepoint,
&s->delayed_payment_basepoint,
&s->htlc_basepoint,
&s->first_per_commitment_point,
&s->channel_flags))
return s;
@ -318,6 +322,7 @@ static void *towire_struct_accept_channel(const tal_t *ctx,
&s->funding_pubkey,
&s->revocation_basepoint,
&s->payment_basepoint,
&s->htlc_basepoint,
&s->delayed_payment_basepoint,
&s->first_per_commitment_point);
}
@ -338,6 +343,7 @@ static struct msg_accept_channel *fromwire_struct_accept_channel(const tal_t *ct
&s->funding_pubkey,
&s->revocation_basepoint,
&s->payment_basepoint,
&s->htlc_basepoint,
&s->delayed_payment_basepoint,
&s->first_per_commitment_point))
return s;
@ -1025,6 +1031,7 @@ int main(void)
set_pubkey(&oc.revocation_basepoint);
set_pubkey(&oc.payment_basepoint);
set_pubkey(&oc.delayed_payment_basepoint);
set_pubkey(&oc.htlc_basepoint);
set_pubkey(&oc.first_per_commitment_point);
msg = towire_struct_open_channel(ctx, &oc);
@ -1048,6 +1055,7 @@ int main(void)
set_pubkey(&ac.revocation_basepoint);
set_pubkey(&ac.payment_basepoint);
set_pubkey(&ac.delayed_payment_basepoint);
set_pubkey(&ac.htlc_basepoint);
set_pubkey(&ac.first_per_commitment_point);
msg = towire_struct_accept_channel(ctx, &ac);