Browse Source

protocol: add revocation hash to update_accept for other commit tx.

And clarify that we're going to be closing the anchor tx directly.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
ppa-0.6.1
Rusty Russell 10 years ago
parent
commit
a6b08dc393
  1. 23
      lightning.pb-c.c
  2. 16
      lightning.pb-c.h
  3. 14
      lightning.proto

23
lightning.pb-c.c

@ -1820,7 +1820,7 @@ const ProtobufCMessageDescriptor update__descriptor =
(ProtobufCMessageInit) update__init, (ProtobufCMessageInit) update__init,
NULL,NULL,NULL /* reserved[123] */ NULL,NULL,NULL /* reserved[123] */
}; };
static const ProtobufCFieldDescriptor update_accept__field_descriptors[3] = static const ProtobufCFieldDescriptor update_accept__field_descriptors[4] =
{ {
{ {
"sig", "sig",
@ -1847,11 +1847,23 @@ static const ProtobufCFieldDescriptor update_accept__field_descriptors[3] =
0,NULL,NULL /* reserved1,reserved2, etc */ 0,NULL,NULL /* reserved1,reserved2, etc */
}, },
{ {
"revocation_preimage", "revocation_hash",
3, 3,
PROTOBUF_C_LABEL_REQUIRED, PROTOBUF_C_LABEL_REQUIRED,
PROTOBUF_C_TYPE_MESSAGE, PROTOBUF_C_TYPE_MESSAGE,
0, /* quantifier_offset */ 0, /* quantifier_offset */
offsetof(UpdateAccept, revocation_hash),
&sha256_hash__descriptor,
NULL,
0, /* flags */
0,NULL,NULL /* reserved1,reserved2, etc */
},
{
"revocation_preimage",
4,
PROTOBUF_C_LABEL_REQUIRED,
PROTOBUF_C_TYPE_MESSAGE,
0, /* quantifier_offset */
offsetof(UpdateAccept, revocation_preimage), offsetof(UpdateAccept, revocation_preimage),
&sha256_hash__descriptor, &sha256_hash__descriptor,
NULL, NULL,
@ -1861,13 +1873,14 @@ static const ProtobufCFieldDescriptor update_accept__field_descriptors[3] =
}; };
static const unsigned update_accept__field_indices_by_name[] = { static const unsigned update_accept__field_indices_by_name[] = {
1, /* field[1] = old_anchor_sig */ 1, /* field[1] = old_anchor_sig */
2, /* field[2] = revocation_preimage */ 2, /* field[2] = revocation_hash */
3, /* field[3] = revocation_preimage */
0, /* field[0] = sig */ 0, /* field[0] = sig */
}; };
static const ProtobufCIntRange update_accept__number_ranges[1 + 1] = static const ProtobufCIntRange update_accept__number_ranges[1 + 1] =
{ {
{ 1, 0 }, { 1, 0 },
{ 0, 3 } { 0, 4 }
}; };
const ProtobufCMessageDescriptor update_accept__descriptor = const ProtobufCMessageDescriptor update_accept__descriptor =
{ {
@ -1877,7 +1890,7 @@ const ProtobufCMessageDescriptor update_accept__descriptor =
"UpdateAccept", "UpdateAccept",
"", "",
sizeof(UpdateAccept), sizeof(UpdateAccept),
3, 4,
update_accept__field_descriptors, update_accept__field_descriptors,
update_accept__field_indices_by_name, update_accept__field_indices_by_name,
1, update_accept__number_ranges, 1, update_accept__number_ranges,

16
lightning.pb-c.h

@ -323,6 +323,10 @@ struct _UpdateAccept
* Signature for old anchor (if any) * Signature for old anchor (if any)
*/ */
Signature *old_anchor_sig; Signature *old_anchor_sig;
/*
* Hash for which I will supply preimage to revoke this new commit tx.
*/
Sha256Hash *revocation_hash;
/* /*
* Hash preimage which revokes old commitment tx. * Hash preimage which revokes old commitment tx.
*/ */
@ -330,7 +334,7 @@ struct _UpdateAccept
}; };
#define UPDATE_ACCEPT__INIT \ #define UPDATE_ACCEPT__INIT \
{ PROTOBUF_C_MESSAGE_INIT (&update_accept__descriptor) \ { PROTOBUF_C_MESSAGE_INIT (&update_accept__descriptor) \
, NULL, NULL, NULL } , NULL, NULL, NULL, NULL }
/* /*
@ -426,8 +430,9 @@ struct _CloseChannel
{ {
ProtobufCMessage base; ProtobufCMessage base;
/* /*
* This is our signature a new transaction which spends my current * This is our signature a new transaction which spends the anchor
* commitment tx output 0 (which is 2/2) to script_to_me. * output to my open->script_to_me and your open->script_to_me,
* as per the last commit tx.
*/ */
Signature *sig; Signature *sig;
}; };
@ -437,14 +442,13 @@ struct _CloseChannel
/* /*
* OK, here's my sig so you can broadcast it too. * OK, here's my sig so you can broadcast it too. We're done.
*/ */
struct _CloseChannelComplete struct _CloseChannelComplete
{ {
ProtobufCMessage base; ProtobufCMessage base;
/* /*
* This is our signature a new transaction which spends your current * This is my signature for that same tx.
* commitment tx output 0 (which is 2/2) to your script_to_me.
*/ */
Signature *sig; Signature *sig;
}; };

14
lightning.proto

@ -134,8 +134,10 @@ message update_accept {
required signature sig = 1; required signature sig = 1;
// Signature for old anchor (if any) // Signature for old anchor (if any)
optional signature old_anchor_sig = 2; optional signature old_anchor_sig = 2;
// Hash for which I will supply preimage to revoke this new commit tx.
required sha256_hash revocation_hash = 3;
// Hash preimage which revokes old commitment tx. // Hash preimage which revokes old commitment tx.
required sha256_hash revocation_preimage = 3; required sha256_hash revocation_preimage = 4;
} }
// Complete the update. // Complete the update.
@ -173,15 +175,15 @@ message new_anchor_complete {
// Begin cooperative close of channel. // Begin cooperative close of channel.
message close_channel { message close_channel {
// This is our signature a new transaction which spends my current // This is our signature a new transaction which spends the anchor
// commitment tx output 0 (which is 2/2) to script_to_me. // output to my open->script_to_me and your open->script_to_me,
// as per the last commit tx.
required signature sig = 1; required signature sig = 1;
} }
// OK, here's my sig so you can broadcast it too. // OK, here's my sig so you can broadcast it too. We're done.
message close_channel_complete { message close_channel_complete {
// This is our signature a new transaction which spends your current // This is my signature for that same tx.
// commitment tx output 0 (which is 2/2) to your script_to_me.
required signature sig = 1; required signature sig = 1;
} }

Loading…
Cancel
Save