daemon: batching of changes as per BOLT #2.

We now keep a list of commitment transaction states for "us" and
"them", as well as a "struct channel_state" for staged changes.

We manipulate these structures as we send out packets, receive
packets, or receive acknowledgement of packets.  In particular, we
update the other nodes' staging_cstate as we send out our requests,
and update our own staging_cstate are we receive acks.  When we
receive a request, we update both (as we immediately send out our
ack).

The RPC output is changed; rather than expose the complexity, we
expose our last committed state: what would happen if we have to drop
to the blockchain now.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2016-03-31 17:13:20 +10:30
parent 017d199305
commit 5e7b3d02a1
12 changed files with 1318 additions and 1415 deletions

View File

@@ -437,6 +437,49 @@ void open_complete__free_unpacked
assert(message->base.descriptor == &open_complete__descriptor);
protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator);
}
void routing__init
(Routing *message)
{
static Routing init_value = ROUTING__INIT;
*message = init_value;
}
size_t routing__get_packed_size
(const Routing *message)
{
assert(message->base.descriptor == &routing__descriptor);
return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message));
}
size_t routing__pack
(const Routing *message,
uint8_t *out)
{
assert(message->base.descriptor == &routing__descriptor);
return protobuf_c_message_pack ((const ProtobufCMessage*)message, out);
}
size_t routing__pack_to_buffer
(const Routing *message,
ProtobufCBuffer *buffer)
{
assert(message->base.descriptor == &routing__descriptor);
return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer);
}
Routing *
routing__unpack
(ProtobufCAllocator *allocator,
size_t len,
const uint8_t *data)
{
return (Routing *)
protobuf_c_message_unpack (&routing__descriptor,
allocator, len, data);
}
void routing__free_unpacked
(Routing *message,
ProtobufCAllocator *allocator)
{
assert(message->base.descriptor == &routing__descriptor);
protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator);
}
void update_add_htlc__init
(UpdateAddHtlc *message)
{
@@ -480,49 +523,6 @@ void update_add_htlc__free_unpacked
assert(message->base.descriptor == &update_add_htlc__descriptor);
protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator);
}
void update_decline_htlc__init
(UpdateDeclineHtlc *message)
{
static UpdateDeclineHtlc init_value = UPDATE_DECLINE_HTLC__INIT;
*message = init_value;
}
size_t update_decline_htlc__get_packed_size
(const UpdateDeclineHtlc *message)
{
assert(message->base.descriptor == &update_decline_htlc__descriptor);
return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message));
}
size_t update_decline_htlc__pack
(const UpdateDeclineHtlc *message,
uint8_t *out)
{
assert(message->base.descriptor == &update_decline_htlc__descriptor);
return protobuf_c_message_pack ((const ProtobufCMessage*)message, out);
}
size_t update_decline_htlc__pack_to_buffer
(const UpdateDeclineHtlc *message,
ProtobufCBuffer *buffer)
{
assert(message->base.descriptor == &update_decline_htlc__descriptor);
return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer);
}
UpdateDeclineHtlc *
update_decline_htlc__unpack
(ProtobufCAllocator *allocator,
size_t len,
const uint8_t *data)
{
return (UpdateDeclineHtlc *)
protobuf_c_message_unpack (&update_decline_htlc__descriptor,
allocator, len, data);
}
void update_decline_htlc__free_unpacked
(UpdateDeclineHtlc *message,
ProtobufCAllocator *allocator)
{
assert(message->base.descriptor == &update_decline_htlc__descriptor);
protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator);
}
void update_fulfill_htlc__init
(UpdateFulfillHtlc *message)
{
@@ -566,6 +566,49 @@ void update_fulfill_htlc__free_unpacked
assert(message->base.descriptor == &update_fulfill_htlc__descriptor);
protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator);
}
void fail_reason__init
(FailReason *message)
{
static FailReason init_value = FAIL_REASON__INIT;
*message = init_value;
}
size_t fail_reason__get_packed_size
(const FailReason *message)
{
assert(message->base.descriptor == &fail_reason__descriptor);
return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message));
}
size_t fail_reason__pack
(const FailReason *message,
uint8_t *out)
{
assert(message->base.descriptor == &fail_reason__descriptor);
return protobuf_c_message_pack ((const ProtobufCMessage*)message, out);
}
size_t fail_reason__pack_to_buffer
(const FailReason *message,
ProtobufCBuffer *buffer)
{
assert(message->base.descriptor == &fail_reason__descriptor);
return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer);
}
FailReason *
fail_reason__unpack
(ProtobufCAllocator *allocator,
size_t len,
const uint8_t *data)
{
return (FailReason *)
protobuf_c_message_unpack (&fail_reason__descriptor,
allocator, len, data);
}
void fail_reason__free_unpacked
(FailReason *message,
ProtobufCAllocator *allocator)
{
assert(message->base.descriptor == &fail_reason__descriptor);
protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator);
}
void update_fail_htlc__init
(UpdateFailHtlc *message)
{
@@ -609,133 +652,90 @@ void update_fail_htlc__free_unpacked
assert(message->base.descriptor == &update_fail_htlc__descriptor);
protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator);
}
void update_accept__init
(UpdateAccept *message)
void update_commit__init
(UpdateCommit *message)
{
static UpdateAccept init_value = UPDATE_ACCEPT__INIT;
static UpdateCommit init_value = UPDATE_COMMIT__INIT;
*message = init_value;
}
size_t update_accept__get_packed_size
(const UpdateAccept *message)
size_t update_commit__get_packed_size
(const UpdateCommit *message)
{
assert(message->base.descriptor == &update_accept__descriptor);
assert(message->base.descriptor == &update_commit__descriptor);
return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message));
}
size_t update_accept__pack
(const UpdateAccept *message,
size_t update_commit__pack
(const UpdateCommit *message,
uint8_t *out)
{
assert(message->base.descriptor == &update_accept__descriptor);
assert(message->base.descriptor == &update_commit__descriptor);
return protobuf_c_message_pack ((const ProtobufCMessage*)message, out);
}
size_t update_accept__pack_to_buffer
(const UpdateAccept *message,
size_t update_commit__pack_to_buffer
(const UpdateCommit *message,
ProtobufCBuffer *buffer)
{
assert(message->base.descriptor == &update_accept__descriptor);
assert(message->base.descriptor == &update_commit__descriptor);
return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer);
}
UpdateAccept *
update_accept__unpack
UpdateCommit *
update_commit__unpack
(ProtobufCAllocator *allocator,
size_t len,
const uint8_t *data)
{
return (UpdateAccept *)
protobuf_c_message_unpack (&update_accept__descriptor,
return (UpdateCommit *)
protobuf_c_message_unpack (&update_commit__descriptor,
allocator, len, data);
}
void update_accept__free_unpacked
(UpdateAccept *message,
void update_commit__free_unpacked
(UpdateCommit *message,
ProtobufCAllocator *allocator)
{
assert(message->base.descriptor == &update_accept__descriptor);
assert(message->base.descriptor == &update_commit__descriptor);
protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator);
}
void update_signature__init
(UpdateSignature *message)
void update_revocation__init
(UpdateRevocation *message)
{
static UpdateSignature init_value = UPDATE_SIGNATURE__INIT;
static UpdateRevocation init_value = UPDATE_REVOCATION__INIT;
*message = init_value;
}
size_t update_signature__get_packed_size
(const UpdateSignature *message)
size_t update_revocation__get_packed_size
(const UpdateRevocation *message)
{
assert(message->base.descriptor == &update_signature__descriptor);
assert(message->base.descriptor == &update_revocation__descriptor);
return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message));
}
size_t update_signature__pack
(const UpdateSignature *message,
size_t update_revocation__pack
(const UpdateRevocation *message,
uint8_t *out)
{
assert(message->base.descriptor == &update_signature__descriptor);
assert(message->base.descriptor == &update_revocation__descriptor);
return protobuf_c_message_pack ((const ProtobufCMessage*)message, out);
}
size_t update_signature__pack_to_buffer
(const UpdateSignature *message,
size_t update_revocation__pack_to_buffer
(const UpdateRevocation *message,
ProtobufCBuffer *buffer)
{
assert(message->base.descriptor == &update_signature__descriptor);
assert(message->base.descriptor == &update_revocation__descriptor);
return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer);
}
UpdateSignature *
update_signature__unpack
UpdateRevocation *
update_revocation__unpack
(ProtobufCAllocator *allocator,
size_t len,
const uint8_t *data)
{
return (UpdateSignature *)
protobuf_c_message_unpack (&update_signature__descriptor,
return (UpdateRevocation *)
protobuf_c_message_unpack (&update_revocation__descriptor,
allocator, len, data);
}
void update_signature__free_unpacked
(UpdateSignature *message,
void update_revocation__free_unpacked
(UpdateRevocation *message,
ProtobufCAllocator *allocator)
{
assert(message->base.descriptor == &update_signature__descriptor);
protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator);
}
void update_complete__init
(UpdateComplete *message)
{
static UpdateComplete init_value = UPDATE_COMPLETE__INIT;
*message = init_value;
}
size_t update_complete__get_packed_size
(const UpdateComplete *message)
{
assert(message->base.descriptor == &update_complete__descriptor);
return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message));
}
size_t update_complete__pack
(const UpdateComplete *message,
uint8_t *out)
{
assert(message->base.descriptor == &update_complete__descriptor);
return protobuf_c_message_pack ((const ProtobufCMessage*)message, out);
}
size_t update_complete__pack_to_buffer
(const UpdateComplete *message,
ProtobufCBuffer *buffer)
{
assert(message->base.descriptor == &update_complete__descriptor);
return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer);
}
UpdateComplete *
update_complete__unpack
(ProtobufCAllocator *allocator,
size_t len,
const uint8_t *data)
{
return (UpdateComplete *)
protobuf_c_message_unpack (&update_complete__descriptor,
allocator, len, data);
}
void update_complete__free_unpacked
(UpdateComplete *message,
ProtobufCAllocator *allocator)
{
assert(message->base.descriptor == &update_complete__descriptor);
assert(message->base.descriptor == &update_revocation__descriptor);
protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator);
}
void close_clearing__init
@@ -1620,16 +1620,54 @@ const ProtobufCMessageDescriptor open_complete__descriptor =
(ProtobufCMessageInit) open_complete__init,
NULL,NULL,NULL /* reserved[123] */
};
static const ProtobufCFieldDescriptor update_add_htlc__field_descriptors[4] =
static const ProtobufCFieldDescriptor routing__field_descriptors[1] =
{
{
"revocation_hash",
"info",
1,
PROTOBUF_C_LABEL_REQUIRED,
PROTOBUF_C_TYPE_MESSAGE,
PROTOBUF_C_TYPE_BYTES,
0, /* quantifier_offset */
offsetof(UpdateAddHtlc, revocation_hash),
&sha256_hash__descriptor,
offsetof(Routing, info),
NULL,
NULL,
0, /* flags */
0,NULL,NULL /* reserved1,reserved2, etc */
},
};
static const unsigned routing__field_indices_by_name[] = {
0, /* field[0] = info */
};
static const ProtobufCIntRange routing__number_ranges[1 + 1] =
{
{ 1, 0 },
{ 0, 1 }
};
const ProtobufCMessageDescriptor routing__descriptor =
{
PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC,
"routing",
"Routing",
"Routing",
"",
sizeof(Routing),
1,
routing__field_descriptors,
routing__field_indices_by_name,
1, routing__number_ranges,
(ProtobufCMessageInit) routing__init,
NULL,NULL,NULL /* reserved[123] */
};
static const ProtobufCFieldDescriptor update_add_htlc__field_descriptors[5] =
{
{
"id",
1,
PROTOBUF_C_LABEL_REQUIRED,
PROTOBUF_C_TYPE_UINT64,
0, /* quantifier_offset */
offsetof(UpdateAddHtlc, id),
NULL,
NULL,
0, /* flags */
0,NULL,NULL /* reserved1,reserved2, etc */
@@ -1670,17 +1708,30 @@ static const ProtobufCFieldDescriptor update_add_htlc__field_descriptors[4] =
0, /* flags */
0,NULL,NULL /* reserved1,reserved2, etc */
},
{
"route",
5,
PROTOBUF_C_LABEL_REQUIRED,
PROTOBUF_C_TYPE_MESSAGE,
0, /* quantifier_offset */
offsetof(UpdateAddHtlc, route),
&routing__descriptor,
NULL,
0, /* flags */
0,NULL,NULL /* reserved1,reserved2, etc */
},
};
static const unsigned update_add_htlc__field_indices_by_name[] = {
1, /* field[1] = amount_msat */
3, /* field[3] = expiry */
0, /* field[0] = id */
2, /* field[2] = r_hash */
0, /* field[0] = revocation_hash */
4, /* field[4] = route */
};
static const ProtobufCIntRange update_add_htlc__number_ranges[1 + 1] =
{
{ 1, 0 },
{ 0, 4 }
{ 0, 5 }
};
const ProtobufCMessageDescriptor update_add_htlc__descriptor =
{
@@ -1690,74 +1741,23 @@ const ProtobufCMessageDescriptor update_add_htlc__descriptor =
"UpdateAddHtlc",
"",
sizeof(UpdateAddHtlc),
4,
5,
update_add_htlc__field_descriptors,
update_add_htlc__field_indices_by_name,
1, update_add_htlc__number_ranges,
(ProtobufCMessageInit) update_add_htlc__init,
NULL,NULL,NULL /* reserved[123] */
};
static const ProtobufCFieldDescriptor update_decline_htlc__field_descriptors[2] =
{
{
"insufficient_funds",
1,
PROTOBUF_C_LABEL_OPTIONAL,
PROTOBUF_C_TYPE_MESSAGE,
offsetof(UpdateDeclineHtlc, reason_case),
offsetof(UpdateDeclineHtlc, insufficient_funds),
&funding__descriptor,
NULL,
0 | PROTOBUF_C_FIELD_FLAG_ONEOF, /* flags */
0,NULL,NULL /* reserved1,reserved2, etc */
},
{
"cannot_route",
2,
PROTOBUF_C_LABEL_OPTIONAL,
PROTOBUF_C_TYPE_BOOL,
offsetof(UpdateDeclineHtlc, reason_case),
offsetof(UpdateDeclineHtlc, cannot_route),
NULL,
NULL,
0 | PROTOBUF_C_FIELD_FLAG_ONEOF, /* flags */
0,NULL,NULL /* reserved1,reserved2, etc */
},
};
static const unsigned update_decline_htlc__field_indices_by_name[] = {
1, /* field[1] = cannot_route */
0, /* field[0] = insufficient_funds */
};
static const ProtobufCIntRange update_decline_htlc__number_ranges[1 + 1] =
{
{ 1, 0 },
{ 0, 2 }
};
const ProtobufCMessageDescriptor update_decline_htlc__descriptor =
{
PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC,
"update_decline_htlc",
"UpdateDeclineHtlc",
"UpdateDeclineHtlc",
"",
sizeof(UpdateDeclineHtlc),
2,
update_decline_htlc__field_descriptors,
update_decline_htlc__field_indices_by_name,
1, update_decline_htlc__number_ranges,
(ProtobufCMessageInit) update_decline_htlc__init,
NULL,NULL,NULL /* reserved[123] */
};
static const ProtobufCFieldDescriptor update_fulfill_htlc__field_descriptors[2] =
{
{
"revocation_hash",
"id",
1,
PROTOBUF_C_LABEL_REQUIRED,
PROTOBUF_C_TYPE_MESSAGE,
PROTOBUF_C_TYPE_UINT64,
0, /* quantifier_offset */
offsetof(UpdateFulfillHtlc, revocation_hash),
&sha256_hash__descriptor,
offsetof(UpdateFulfillHtlc, id),
NULL,
NULL,
0, /* flags */
0,NULL,NULL /* reserved1,reserved2, etc */
@@ -1776,8 +1776,8 @@ static const ProtobufCFieldDescriptor update_fulfill_htlc__field_descriptors[2]
},
};
static const unsigned update_fulfill_htlc__field_indices_by_name[] = {
0, /* field[0] = id */
1, /* field[1] = r */
0, /* field[0] = revocation_hash */
};
static const ProtobufCIntRange update_fulfill_htlc__number_ranges[1 + 1] =
{
@@ -1799,36 +1799,74 @@ const ProtobufCMessageDescriptor update_fulfill_htlc__descriptor =
(ProtobufCMessageInit) update_fulfill_htlc__init,
NULL,NULL,NULL /* reserved[123] */
};
static const ProtobufCFieldDescriptor fail_reason__field_descriptors[1] =
{
{
"info",
1,
PROTOBUF_C_LABEL_REQUIRED,
PROTOBUF_C_TYPE_BYTES,
0, /* quantifier_offset */
offsetof(FailReason, info),
NULL,
NULL,
0, /* flags */
0,NULL,NULL /* reserved1,reserved2, etc */
},
};
static const unsigned fail_reason__field_indices_by_name[] = {
0, /* field[0] = info */
};
static const ProtobufCIntRange fail_reason__number_ranges[1 + 1] =
{
{ 1, 0 },
{ 0, 1 }
};
const ProtobufCMessageDescriptor fail_reason__descriptor =
{
PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC,
"fail_reason",
"FailReason",
"FailReason",
"",
sizeof(FailReason),
1,
fail_reason__field_descriptors,
fail_reason__field_indices_by_name,
1, fail_reason__number_ranges,
(ProtobufCMessageInit) fail_reason__init,
NULL,NULL,NULL /* reserved[123] */
};
static const ProtobufCFieldDescriptor update_fail_htlc__field_descriptors[2] =
{
{
"revocation_hash",
"id",
1,
PROTOBUF_C_LABEL_REQUIRED,
PROTOBUF_C_TYPE_MESSAGE,
PROTOBUF_C_TYPE_UINT64,
0, /* quantifier_offset */
offsetof(UpdateFailHtlc, revocation_hash),
&sha256_hash__descriptor,
offsetof(UpdateFailHtlc, id),
NULL,
NULL,
0, /* flags */
0,NULL,NULL /* reserved1,reserved2, etc */
},
{
"r_hash",
"reason",
2,
PROTOBUF_C_LABEL_REQUIRED,
PROTOBUF_C_TYPE_MESSAGE,
0, /* quantifier_offset */
offsetof(UpdateFailHtlc, r_hash),
&sha256_hash__descriptor,
offsetof(UpdateFailHtlc, reason),
&fail_reason__descriptor,
NULL,
0, /* flags */
0,NULL,NULL /* reserved1,reserved2, etc */
},
};
static const unsigned update_fail_htlc__field_indices_by_name[] = {
1, /* field[1] = r_hash */
0, /* field[0] = revocation_hash */
0, /* field[0] = id */
1, /* field[1] = reason */
};
static const ProtobufCIntRange update_fail_htlc__number_ranges[1 + 1] =
{
@@ -1850,7 +1888,7 @@ const ProtobufCMessageDescriptor update_fail_htlc__descriptor =
(ProtobufCMessageInit) update_fail_htlc__init,
NULL,NULL,NULL /* reserved[123] */
};
static const ProtobufCFieldDescriptor update_accept__field_descriptors[2] =
static const ProtobufCFieldDescriptor update_commit__field_descriptors[1] =
{
{
"sig",
@@ -1858,136 +1896,85 @@ static const ProtobufCFieldDescriptor update_accept__field_descriptors[2] =
PROTOBUF_C_LABEL_REQUIRED,
PROTOBUF_C_TYPE_MESSAGE,
0, /* quantifier_offset */
offsetof(UpdateAccept, sig),
offsetof(UpdateCommit, sig),
&signature__descriptor,
NULL,
0, /* flags */
0,NULL,NULL /* reserved1,reserved2, etc */
},
{
"revocation_hash",
2,
PROTOBUF_C_LABEL_REQUIRED,
PROTOBUF_C_TYPE_MESSAGE,
0, /* quantifier_offset */
offsetof(UpdateAccept, revocation_hash),
&sha256_hash__descriptor,
NULL,
0, /* flags */
0,NULL,NULL /* reserved1,reserved2, etc */
},
};
static const unsigned update_accept__field_indices_by_name[] = {
1, /* field[1] = revocation_hash */
static const unsigned update_commit__field_indices_by_name[] = {
0, /* field[0] = sig */
};
static const ProtobufCIntRange update_accept__number_ranges[1 + 1] =
{
{ 1, 0 },
{ 0, 2 }
};
const ProtobufCMessageDescriptor update_accept__descriptor =
{
PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC,
"update_accept",
"UpdateAccept",
"UpdateAccept",
"",
sizeof(UpdateAccept),
2,
update_accept__field_descriptors,
update_accept__field_indices_by_name,
1, update_accept__number_ranges,
(ProtobufCMessageInit) update_accept__init,
NULL,NULL,NULL /* reserved[123] */
};
static const ProtobufCFieldDescriptor update_signature__field_descriptors[2] =
{
{
"sig",
1,
PROTOBUF_C_LABEL_REQUIRED,
PROTOBUF_C_TYPE_MESSAGE,
0, /* quantifier_offset */
offsetof(UpdateSignature, sig),
&signature__descriptor,
NULL,
0, /* flags */
0,NULL,NULL /* reserved1,reserved2, etc */
},
{
"revocation_preimage",
2,
PROTOBUF_C_LABEL_REQUIRED,
PROTOBUF_C_TYPE_MESSAGE,
0, /* quantifier_offset */
offsetof(UpdateSignature, revocation_preimage),
&sha256_hash__descriptor,
NULL,
0, /* flags */
0,NULL,NULL /* reserved1,reserved2, etc */
},
};
static const unsigned update_signature__field_indices_by_name[] = {
1, /* field[1] = revocation_preimage */
0, /* field[0] = sig */
};
static const ProtobufCIntRange update_signature__number_ranges[1 + 1] =
{
{ 1, 0 },
{ 0, 2 }
};
const ProtobufCMessageDescriptor update_signature__descriptor =
{
PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC,
"update_signature",
"UpdateSignature",
"UpdateSignature",
"",
sizeof(UpdateSignature),
2,
update_signature__field_descriptors,
update_signature__field_indices_by_name,
1, update_signature__number_ranges,
(ProtobufCMessageInit) update_signature__init,
NULL,NULL,NULL /* reserved[123] */
};
static const ProtobufCFieldDescriptor update_complete__field_descriptors[1] =
{
{
"revocation_preimage",
1,
PROTOBUF_C_LABEL_REQUIRED,
PROTOBUF_C_TYPE_MESSAGE,
0, /* quantifier_offset */
offsetof(UpdateComplete, revocation_preimage),
&sha256_hash__descriptor,
NULL,
0, /* flags */
0,NULL,NULL /* reserved1,reserved2, etc */
},
};
static const unsigned update_complete__field_indices_by_name[] = {
0, /* field[0] = revocation_preimage */
};
static const ProtobufCIntRange update_complete__number_ranges[1 + 1] =
static const ProtobufCIntRange update_commit__number_ranges[1 + 1] =
{
{ 1, 0 },
{ 0, 1 }
};
const ProtobufCMessageDescriptor update_complete__descriptor =
const ProtobufCMessageDescriptor update_commit__descriptor =
{
PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC,
"update_complete",
"UpdateComplete",
"UpdateComplete",
"update_commit",
"UpdateCommit",
"UpdateCommit",
"",
sizeof(UpdateComplete),
sizeof(UpdateCommit),
1,
update_complete__field_descriptors,
update_complete__field_indices_by_name,
1, update_complete__number_ranges,
(ProtobufCMessageInit) update_complete__init,
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] =
{
{
"revocation_preimage",
1,
PROTOBUF_C_LABEL_REQUIRED,
PROTOBUF_C_TYPE_MESSAGE,
0, /* quantifier_offset */
offsetof(UpdateRevocation, revocation_preimage),
&sha256_hash__descriptor,
NULL,
0, /* flags */
0,NULL,NULL /* reserved1,reserved2, etc */
},
{
"next_revocation_hash",
2,
PROTOBUF_C_LABEL_REQUIRED,
PROTOBUF_C_TYPE_MESSAGE,
0, /* quantifier_offset */
offsetof(UpdateRevocation, next_revocation_hash),
&sha256_hash__descriptor,
NULL,
0, /* flags */
0,NULL,NULL /* reserved1,reserved2, etc */
},
};
static const unsigned update_revocation__field_indices_by_name[] = {
1, /* field[1] = next_revocation_hash */
0, /* field[0] = revocation_preimage */
};
static const ProtobufCIntRange update_revocation__number_ranges[1 + 1] =
{
{ 1, 0 },
{ 0, 2 }
};
const ProtobufCMessageDescriptor update_revocation__descriptor =
{
PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC,
"update_revocation",
"UpdateRevocation",
"UpdateRevocation",
"",
sizeof(UpdateRevocation),
2,
update_revocation__field_descriptors,
update_revocation__field_indices_by_name,
1, update_revocation__number_ranges,
(ProtobufCMessageInit) update_revocation__init,
NULL,NULL,NULL /* reserved[123] */
};
#define close_clearing__field_descriptors NULL
@@ -2097,7 +2084,7 @@ const ProtobufCMessageDescriptor error__descriptor =
(ProtobufCMessageInit) error__init,
NULL,NULL,NULL /* reserved[123] */
};
static const ProtobufCFieldDescriptor pkt__field_descriptors[15] =
static const ProtobufCFieldDescriptor pkt__field_descriptors[13] =
{
{
"update_add_htlc",
@@ -2111,57 +2098,9 @@ static const ProtobufCFieldDescriptor pkt__field_descriptors[15] =
0 | PROTOBUF_C_FIELD_FLAG_ONEOF, /* flags */
0,NULL,NULL /* reserved1,reserved2, etc */
},
{
"update_accept",
3,
PROTOBUF_C_LABEL_OPTIONAL,
PROTOBUF_C_TYPE_MESSAGE,
offsetof(Pkt, pkt_case),
offsetof(Pkt, update_accept),
&update_accept__descriptor,
NULL,
0 | PROTOBUF_C_FIELD_FLAG_ONEOF, /* flags */
0,NULL,NULL /* reserved1,reserved2, etc */
},
{
"update_signature",
4,
PROTOBUF_C_LABEL_OPTIONAL,
PROTOBUF_C_TYPE_MESSAGE,
offsetof(Pkt, pkt_case),
offsetof(Pkt, update_signature),
&update_signature__descriptor,
NULL,
0 | PROTOBUF_C_FIELD_FLAG_ONEOF, /* flags */
0,NULL,NULL /* reserved1,reserved2, etc */
},
{
"update_complete",
5,
PROTOBUF_C_LABEL_OPTIONAL,
PROTOBUF_C_TYPE_MESSAGE,
offsetof(Pkt, pkt_case),
offsetof(Pkt, update_complete),
&update_complete__descriptor,
NULL,
0 | PROTOBUF_C_FIELD_FLAG_ONEOF, /* flags */
0,NULL,NULL /* reserved1,reserved2, etc */
},
{
"update_decline_htlc",
6,
PROTOBUF_C_LABEL_OPTIONAL,
PROTOBUF_C_TYPE_MESSAGE,
offsetof(Pkt, pkt_case),
offsetof(Pkt, update_decline_htlc),
&update_decline_htlc__descriptor,
NULL,
0 | PROTOBUF_C_FIELD_FLAG_ONEOF, /* flags */
0,NULL,NULL /* reserved1,reserved2, etc */
},
{
"update_fulfill_htlc",
7,
3,
PROTOBUF_C_LABEL_OPTIONAL,
PROTOBUF_C_TYPE_MESSAGE,
offsetof(Pkt, pkt_case),
@@ -2173,7 +2112,7 @@ static const ProtobufCFieldDescriptor pkt__field_descriptors[15] =
},
{
"update_fail_htlc",
9,
4,
PROTOBUF_C_LABEL_OPTIONAL,
PROTOBUF_C_TYPE_MESSAGE,
offsetof(Pkt, pkt_case),
@@ -2183,6 +2122,30 @@ static const ProtobufCFieldDescriptor pkt__field_descriptors[15] =
0 | PROTOBUF_C_FIELD_FLAG_ONEOF, /* flags */
0,NULL,NULL /* reserved1,reserved2, etc */
},
{
"update_commit",
5,
PROTOBUF_C_LABEL_OPTIONAL,
PROTOBUF_C_TYPE_MESSAGE,
offsetof(Pkt, pkt_case),
offsetof(Pkt, update_commit),
&update_commit__descriptor,
NULL,
0 | PROTOBUF_C_FIELD_FLAG_ONEOF, /* flags */
0,NULL,NULL /* reserved1,reserved2, etc */
},
{
"update_revocation",
6,
PROTOBUF_C_LABEL_OPTIONAL,
PROTOBUF_C_TYPE_MESSAGE,
offsetof(Pkt, pkt_case),
offsetof(Pkt, update_revocation),
&update_revocation__descriptor,
NULL,
0 | PROTOBUF_C_FIELD_FLAG_ONEOF, /* flags */
0,NULL,NULL /* reserved1,reserved2, etc */
},
{
"open",
20,
@@ -2281,31 +2244,28 @@ static const ProtobufCFieldDescriptor pkt__field_descriptors[15] =
},
};
static const unsigned pkt__field_indices_by_name[] = {
14, /* field[14] = auth */
11, /* field[11] = close_clearing */
12, /* field[12] = close_signature */
13, /* field[13] = error */
7, /* field[7] = open */
8, /* field[8] = open_anchor */
9, /* field[9] = open_commit_sig */
10, /* field[10] = open_complete */
1, /* field[1] = update_accept */
12, /* field[12] = auth */
9, /* field[9] = close_clearing */
10, /* field[10] = close_signature */
11, /* field[11] = error */
5, /* field[5] = open */
6, /* field[6] = open_anchor */
7, /* field[7] = open_commit_sig */
8, /* field[8] = open_complete */
0, /* field[0] = update_add_htlc */
3, /* field[3] = update_complete */
4, /* field[4] = update_decline_htlc */
6, /* field[6] = update_fail_htlc */
5, /* field[5] = update_fulfill_htlc */
2, /* field[2] = update_signature */
3, /* field[3] = update_commit */
2, /* field[2] = update_fail_htlc */
1, /* field[1] = update_fulfill_htlc */
4, /* field[4] = update_revocation */
};
static const ProtobufCIntRange pkt__number_ranges[6 + 1] =
static const ProtobufCIntRange pkt__number_ranges[5 + 1] =
{
{ 2, 0 },
{ 9, 6 },
{ 20, 7 },
{ 30, 11 },
{ 40, 13 },
{ 50, 14 },
{ 0, 15 }
{ 20, 5 },
{ 30, 9 },
{ 40, 11 },
{ 50, 12 },
{ 0, 13 }
};
const ProtobufCMessageDescriptor pkt__descriptor =
{
@@ -2315,10 +2275,10 @@ const ProtobufCMessageDescriptor pkt__descriptor =
"Pkt",
"",
sizeof(Pkt),
15,
13,
pkt__field_descriptors,
pkt__field_indices_by_name,
6, pkt__number_ranges,
5, pkt__number_ranges,
(ProtobufCMessageInit) pkt__init,
NULL,NULL,NULL /* reserved[123] */
};