mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-01-18 05:12:45 +01:00
Update wire from spec 9a572ff0a3a4d6bceba9c0a9b859692180ecf18f
Only changes commit_sig to commitment_signed, which we don't implement yet anyway. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
fb80a5f905
commit
e45bc0ce47
@ -200,7 +200,7 @@ static struct io_plan *peer_msgin(struct io_conn *conn,
|
|||||||
case WIRE_UPDATE_FULFILL_HTLC:
|
case WIRE_UPDATE_FULFILL_HTLC:
|
||||||
case WIRE_UPDATE_FAIL_HTLC:
|
case WIRE_UPDATE_FAIL_HTLC:
|
||||||
case WIRE_UPDATE_FAIL_MALFORMED_HTLC:
|
case WIRE_UPDATE_FAIL_MALFORMED_HTLC:
|
||||||
case WIRE_COMMIT_SIG:
|
case WIRE_COMMITMENT_SIGNED:
|
||||||
case WIRE_REVOKE_AND_ACK:
|
case WIRE_REVOKE_AND_ACK:
|
||||||
/* Not our place to handle this, so we punt */
|
/* Not our place to handle this, so we punt */
|
||||||
s = towire_gossipstatus_peer_nongossip(msg, peer->unique_id,
|
s = towire_gossipstatus_peer_nongossip(msg, peer->unique_id,
|
||||||
|
@ -77,11 +77,11 @@ update_fail_malformed_htlc,0,channel-id,32
|
|||||||
update_fail_malformed_htlc,32,id,8
|
update_fail_malformed_htlc,32,id,8
|
||||||
update_fail_malformed_htlc,40,sha256-of-onion,32
|
update_fail_malformed_htlc,40,sha256-of-onion,32
|
||||||
update_fail_malformed_htlc,72,failure-code,2
|
update_fail_malformed_htlc,72,failure-code,2
|
||||||
commit_sig,132
|
commitment_signed,132
|
||||||
commit_sig,0,channel-id,32
|
commitment_signed,0,channel-id,32
|
||||||
commit_sig,32,signature,64
|
commitment_signed,32,signature,64
|
||||||
commit_sig,96,num-htlcs,2
|
commitment_signed,96,num-htlcs,2
|
||||||
commit_sig,98,htlc-signature,num-htlcs*64
|
commitment_signed,98,htlc-signature,num-htlcs*64
|
||||||
revoke_and_ack,133
|
revoke_and_ack,133
|
||||||
revoke_and_ack,0,channel-id,32
|
revoke_and_ack,0,channel-id,32
|
||||||
revoke_and_ack,32,per-commitment-secret,32
|
revoke_and_ack,32,per-commitment-secret,32
|
||||||
|
@ -147,7 +147,7 @@ struct msg_announcement_signatures {
|
|||||||
secp256k1_ecdsa_signature announcement_node_signature;
|
secp256k1_ecdsa_signature announcement_node_signature;
|
||||||
secp256k1_ecdsa_signature announcement_bitcoin_signature;
|
secp256k1_ecdsa_signature announcement_bitcoin_signature;
|
||||||
};
|
};
|
||||||
struct msg_commit_sig {
|
struct msg_commitment_signed {
|
||||||
struct channel_id channel_id;
|
struct channel_id channel_id;
|
||||||
secp256k1_ecdsa_signature signature;
|
secp256k1_ecdsa_signature signature;
|
||||||
secp256k1_ecdsa_signature *htlc_signature;
|
secp256k1_ecdsa_signature *htlc_signature;
|
||||||
@ -475,20 +475,20 @@ static struct msg_update_fulfill_htlc *fromwire_struct_update_fulfill_htlc(const
|
|||||||
return tal_free(s);
|
return tal_free(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *towire_struct_commit_sig(const tal_t *ctx,
|
static void *towire_struct_commitment_signed(const tal_t *ctx,
|
||||||
const struct msg_commit_sig *s)
|
const struct msg_commitment_signed *s)
|
||||||
{
|
{
|
||||||
return towire_commit_sig(ctx,
|
return towire_commitment_signed(ctx,
|
||||||
&s->channel_id,
|
&s->channel_id,
|
||||||
&s->signature,
|
&s->signature,
|
||||||
s->htlc_signature);
|
s->htlc_signature);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct msg_commit_sig *fromwire_struct_commit_sig(const tal_t *ctx, const void *p, size_t *plen)
|
static struct msg_commitment_signed *fromwire_struct_commitment_signed(const tal_t *ctx, const void *p, size_t *plen)
|
||||||
{
|
{
|
||||||
struct msg_commit_sig *s = tal(ctx, struct msg_commit_sig);
|
struct msg_commitment_signed *s = tal(ctx, struct msg_commitment_signed);
|
||||||
|
|
||||||
if (!fromwire_commit_sig(s, p, plen,
|
if (!fromwire_commitment_signed(s, p, plen,
|
||||||
&s->channel_id,
|
&s->channel_id,
|
||||||
&s->signature,
|
&s->signature,
|
||||||
&s->htlc_signature))
|
&s->htlc_signature))
|
||||||
@ -712,8 +712,8 @@ static bool update_fail_htlc_eq(const struct msg_update_fail_htlc *a,
|
|||||||
&& eq_var(a, b, reason);
|
&& eq_var(a, b, reason);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool commit_sig_eq(const struct msg_commit_sig *a,
|
static bool commitment_signed_eq(const struct msg_commitment_signed *a,
|
||||||
const struct msg_commit_sig *b)
|
const struct msg_commitment_signed *b)
|
||||||
{
|
{
|
||||||
return eq_upto(a, b, htlc_signature)
|
return eq_upto(a, b, htlc_signature)
|
||||||
&& eq_var(a, b, htlc_signature);
|
&& eq_var(a, b, htlc_signature);
|
||||||
@ -832,7 +832,7 @@ int main(void)
|
|||||||
struct msg_funding_locked fl, *fl2;
|
struct msg_funding_locked fl, *fl2;
|
||||||
struct msg_announcement_signatures as, *as2;
|
struct msg_announcement_signatures as, *as2;
|
||||||
struct msg_update_fail_htlc ufh, *ufh2;
|
struct msg_update_fail_htlc ufh, *ufh2;
|
||||||
struct msg_commit_sig cs, *cs2;
|
struct msg_commitment_signed cs, *cs2;
|
||||||
struct msg_funding_signed fs, *fs2;
|
struct msg_funding_signed fs, *fs2;
|
||||||
struct msg_closing_signed cls, *cls2;
|
struct msg_closing_signed cls, *cls2;
|
||||||
struct msg_update_fulfill_htlc uflh, *uflh2;
|
struct msg_update_fulfill_htlc uflh, *uflh2;
|
||||||
@ -903,12 +903,12 @@ int main(void)
|
|||||||
cs.htlc_signature = tal_arr(ctx, secp256k1_ecdsa_signature, 2);
|
cs.htlc_signature = tal_arr(ctx, secp256k1_ecdsa_signature, 2);
|
||||||
memset(cs.htlc_signature, 2, sizeof(secp256k1_ecdsa_signature)*2);
|
memset(cs.htlc_signature, 2, sizeof(secp256k1_ecdsa_signature)*2);
|
||||||
|
|
||||||
msg = towire_struct_commit_sig(ctx, &cs);
|
msg = towire_struct_commitment_signed(ctx, &cs);
|
||||||
len = tal_count(msg);
|
len = tal_count(msg);
|
||||||
cs2 = fromwire_struct_commit_sig(ctx, msg, &len);
|
cs2 = fromwire_struct_commitment_signed(ctx, msg, &len);
|
||||||
assert(len == 0);
|
assert(len == 0);
|
||||||
assert(commit_sig_eq(&cs, cs2));
|
assert(commitment_signed_eq(&cs, cs2));
|
||||||
test_corruption(&cs, cs2, commit_sig);
|
test_corruption(&cs, cs2, commitment_signed);
|
||||||
|
|
||||||
memset(&fs, 2, sizeof(fs));
|
memset(&fs, 2, sizeof(fs));
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user