|
|
@ -147,7 +147,7 @@ struct msg_announcement_signatures { |
|
|
|
secp256k1_ecdsa_signature announcement_node_signature; |
|
|
|
secp256k1_ecdsa_signature announcement_bitcoin_signature; |
|
|
|
}; |
|
|
|
struct msg_commit_sig { |
|
|
|
struct msg_commitment_signed { |
|
|
|
struct channel_id channel_id; |
|
|
|
secp256k1_ecdsa_signature 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); |
|
|
|
} |
|
|
|
|
|
|
|
static void *towire_struct_commit_sig(const tal_t *ctx, |
|
|
|
const struct msg_commit_sig *s) |
|
|
|
static void *towire_struct_commitment_signed(const tal_t *ctx, |
|
|
|
const struct msg_commitment_signed *s) |
|
|
|
{ |
|
|
|
return towire_commit_sig(ctx, |
|
|
|
&s->channel_id, |
|
|
|
&s->signature, |
|
|
|
s->htlc_signature); |
|
|
|
return towire_commitment_signed(ctx, |
|
|
|
&s->channel_id, |
|
|
|
&s->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->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); |
|
|
|
} |
|
|
|
|
|
|
|
static bool commit_sig_eq(const struct msg_commit_sig *a, |
|
|
|
const struct msg_commit_sig *b) |
|
|
|
static bool commitment_signed_eq(const struct msg_commitment_signed *a, |
|
|
|
const struct msg_commitment_signed *b) |
|
|
|
{ |
|
|
|
return eq_upto(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_announcement_signatures as, *as2; |
|
|
|
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_closing_signed cls, *cls2; |
|
|
|
struct msg_update_fulfill_htlc uflh, *uflh2; |
|
|
@ -903,12 +903,12 @@ int main(void) |
|
|
|
cs.htlc_signature = tal_arr(ctx, 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); |
|
|
|
cs2 = fromwire_struct_commit_sig(ctx, msg, &len); |
|
|
|
cs2 = fromwire_struct_commitment_signed(ctx, msg, &len); |
|
|
|
assert(len == 0); |
|
|
|
assert(commit_sig_eq(&cs, cs2)); |
|
|
|
test_corruption(&cs, cs2, commit_sig); |
|
|
|
assert(commitment_signed_eq(&cs, cs2)); |
|
|
|
test_corruption(&cs, cs2, commitment_signed); |
|
|
|
|
|
|
|
memset(&fs, 2, sizeof(fs)); |
|
|
|
|
|
|
|