protocol: move ack out of header into specific packets.

This reflects the BOLT #1/#2 protocol change, as suggeted by Pierre.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2016-04-11 16:31:43 +09:30
parent 0e07cc7a36
commit 0f35441a29
7 changed files with 141 additions and 56 deletions

View File

@@ -1258,7 +1258,8 @@ const ProtobufCMessageDescriptor funding__descriptor =
(ProtobufCMessageInit) funding__init,
NULL,NULL,NULL /* reserved[123] */
};
static const ProtobufCFieldDescriptor authenticate__field_descriptors[2] =
static const uint64_t authenticate__ack__default_value = 0ull;
static const ProtobufCFieldDescriptor authenticate__field_descriptors[3] =
{
{
"node_id",
@@ -1284,15 +1285,28 @@ static const ProtobufCFieldDescriptor authenticate__field_descriptors[2] =
0, /* flags */
0,NULL,NULL /* reserved1,reserved2, etc */
},
{
"ack",
3,
PROTOBUF_C_LABEL_OPTIONAL,
PROTOBUF_C_TYPE_UINT64,
offsetof(Authenticate, has_ack),
offsetof(Authenticate, ack),
NULL,
&authenticate__ack__default_value,
0, /* flags */
0,NULL,NULL /* reserved1,reserved2, etc */
},
};
static const unsigned authenticate__field_indices_by_name[] = {
2, /* field[2] = ack */
0, /* field[0] = node_id */
1, /* field[1] = session_sig */
};
static const ProtobufCIntRange authenticate__number_ranges[1 + 1] =
{
{ 1, 0 },
{ 0, 2 }
{ 0, 3 }
};
const ProtobufCMessageDescriptor authenticate__descriptor =
{
@@ -1302,7 +1316,7 @@ const ProtobufCMessageDescriptor authenticate__descriptor =
"Authenticate",
"",
sizeof(Authenticate),
2,
3,
authenticate__field_descriptors,
authenticate__field_indices_by_name,
1, authenticate__number_ranges,
@@ -1888,7 +1902,7 @@ const ProtobufCMessageDescriptor update_fail_htlc__descriptor =
(ProtobufCMessageInit) update_fail_htlc__init,
NULL,NULL,NULL /* reserved[123] */
};
static const ProtobufCFieldDescriptor update_commit__field_descriptors[1] =
static const ProtobufCFieldDescriptor update_commit__field_descriptors[2] =
{
{
"sig",
@@ -1902,14 +1916,27 @@ static const ProtobufCFieldDescriptor update_commit__field_descriptors[1] =
0, /* flags */
0,NULL,NULL /* reserved1,reserved2, etc */
},
{
"ack",
2,
PROTOBUF_C_LABEL_REQUIRED,
PROTOBUF_C_TYPE_UINT64,
0, /* quantifier_offset */
offsetof(UpdateCommit, ack),
NULL,
NULL,
0, /* flags */
0,NULL,NULL /* reserved1,reserved2, etc */
},
};
static const unsigned update_commit__field_indices_by_name[] = {
1, /* field[1] = ack */
0, /* field[0] = sig */
};
static const ProtobufCIntRange update_commit__number_ranges[1 + 1] =
{
{ 1, 0 },
{ 0, 1 }
{ 0, 2 }
};
const ProtobufCMessageDescriptor update_commit__descriptor =
{
@@ -1919,14 +1946,14 @@ const ProtobufCMessageDescriptor update_commit__descriptor =
"UpdateCommit",
"",
sizeof(UpdateCommit),
1,
2,
update_commit__field_descriptors,
update_commit__field_indices_by_name,
1, update_commit__number_ranges,
(ProtobufCMessageInit) update_commit__init,
NULL,NULL,NULL /* reserved[123] */
};
static const ProtobufCFieldDescriptor update_revocation__field_descriptors[2] =
static const ProtobufCFieldDescriptor update_revocation__field_descriptors[3] =
{
{
"revocation_preimage",
@@ -1952,15 +1979,28 @@ static const ProtobufCFieldDescriptor update_revocation__field_descriptors[2] =
0, /* flags */
0,NULL,NULL /* reserved1,reserved2, etc */
},
{
"ack",
3,
PROTOBUF_C_LABEL_REQUIRED,
PROTOBUF_C_TYPE_UINT64,
0, /* quantifier_offset */
offsetof(UpdateRevocation, ack),
NULL,
NULL,
0, /* flags */
0,NULL,NULL /* reserved1,reserved2, etc */
},
};
static const unsigned update_revocation__field_indices_by_name[] = {
2, /* field[2] = ack */
1, /* field[1] = next_revocation_hash */
0, /* field[0] = revocation_preimage */
};
static const ProtobufCIntRange update_revocation__number_ranges[1 + 1] =
{
{ 1, 0 },
{ 0, 2 }
{ 0, 3 }
};
const ProtobufCMessageDescriptor update_revocation__descriptor =
{
@@ -1970,7 +2010,7 @@ const ProtobufCMessageDescriptor update_revocation__descriptor =
"UpdateRevocation",
"",
sizeof(UpdateRevocation),
2,
3,
update_revocation__field_descriptors,
update_revocation__field_indices_by_name,
1, update_revocation__number_ranges,