protocol: renumber.

Use lower numbers and clean up.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2015-09-24 15:02:54 +09:30
parent fefe2deea2
commit 02a563ba82
3 changed files with 74 additions and 79 deletions

View File

@@ -1375,21 +1375,9 @@ const ProtobufCEnumDescriptor open_channel__anchor_offer__descriptor =
static const uint32_t open_channel__min_depth__default_value = 0u;
static const ProtobufCFieldDescriptor open_channel__field_descriptors[7] =
{
{
"final_key",
1,
PROTOBUF_C_LABEL_REQUIRED,
PROTOBUF_C_TYPE_MESSAGE,
0, /* quantifier_offset */
offsetof(OpenChannel, final_key),
&bitcoin_pubkey__descriptor,
NULL,
0, /* flags */
0,NULL,NULL /* reserved1,reserved2, etc */
},
{
"delay",
2,
1,
PROTOBUF_C_LABEL_REQUIRED,
PROTOBUF_C_TYPE_MESSAGE,
0, /* quantifier_offset */
@@ -1401,7 +1389,7 @@ static const ProtobufCFieldDescriptor open_channel__field_descriptors[7] =
},
{
"revocation_hash",
4,
2,
PROTOBUF_C_LABEL_REQUIRED,
PROTOBUF_C_TYPE_MESSAGE,
0, /* quantifier_offset */
@@ -1413,7 +1401,7 @@ static const ProtobufCFieldDescriptor open_channel__field_descriptors[7] =
},
{
"commit_key",
5,
3,
PROTOBUF_C_LABEL_REQUIRED,
PROTOBUF_C_TYPE_MESSAGE,
0, /* quantifier_offset */
@@ -1423,9 +1411,21 @@ static const ProtobufCFieldDescriptor open_channel__field_descriptors[7] =
0, /* flags */
0,NULL,NULL /* reserved1,reserved2, etc */
},
{
"final_key",
4,
PROTOBUF_C_LABEL_REQUIRED,
PROTOBUF_C_TYPE_MESSAGE,
0, /* quantifier_offset */
offsetof(OpenChannel, final_key),
&bitcoin_pubkey__descriptor,
NULL,
0, /* flags */
0,NULL,NULL /* reserved1,reserved2, etc */
},
{
"anch",
6,
5,
PROTOBUF_C_LABEL_REQUIRED,
PROTOBUF_C_TYPE_ENUM,
0, /* quantifier_offset */
@@ -1437,7 +1437,7 @@ static const ProtobufCFieldDescriptor open_channel__field_descriptors[7] =
},
{
"min_depth",
7,
6,
PROTOBUF_C_LABEL_OPTIONAL,
PROTOBUF_C_TYPE_UINT32,
offsetof(OpenChannel, has_min_depth),
@@ -1449,7 +1449,7 @@ static const ProtobufCFieldDescriptor open_channel__field_descriptors[7] =
},
{
"commitment_fee",
8,
7,
PROTOBUF_C_LABEL_REQUIRED,
PROTOBUF_C_TYPE_UINT64,
0, /* quantifier_offset */
@@ -1462,17 +1462,16 @@ static const ProtobufCFieldDescriptor open_channel__field_descriptors[7] =
};
static const unsigned open_channel__field_indices_by_name[] = {
4, /* field[4] = anch */
3, /* field[3] = commit_key */
2, /* field[2] = commit_key */
6, /* field[6] = commitment_fee */
1, /* field[1] = delay */
0, /* field[0] = final_key */
0, /* field[0] = delay */
3, /* field[3] = final_key */
5, /* field[5] = min_depth */
2, /* field[2] = revocation_hash */
1, /* field[1] = revocation_hash */
};
static const ProtobufCIntRange open_channel__number_ranges[2 + 1] =
static const ProtobufCIntRange open_channel__number_ranges[1 + 1] =
{
{ 1, 0 },
{ 4, 2 },
{ 0, 7 }
};
const ProtobufCMessageDescriptor open_channel__descriptor =
@@ -1486,7 +1485,7 @@ const ProtobufCMessageDescriptor open_channel__descriptor =
7,
open_channel__field_descriptors,
open_channel__field_indices_by_name,
2, open_channel__number_ranges,
1, open_channel__number_ranges,
(ProtobufCMessageInit) open_channel__init,
NULL,NULL,NULL /* reserved[123] */
};
@@ -1838,7 +1837,7 @@ static const ProtobufCFieldDescriptor update_complete_htlc__field_descriptors[2]
},
{
"r",
3,
2,
PROTOBUF_C_LABEL_REQUIRED,
PROTOBUF_C_TYPE_MESSAGE,
0, /* quantifier_offset */
@@ -1853,10 +1852,9 @@ static const unsigned update_complete_htlc__field_indices_by_name[] = {
1, /* field[1] = r */
0, /* field[0] = revocation_hash */
};
static const ProtobufCIntRange update_complete_htlc__number_ranges[2 + 1] =
static const ProtobufCIntRange update_complete_htlc__number_ranges[1 + 1] =
{
{ 1, 0 },
{ 3, 1 },
{ 0, 2 }
};
const ProtobufCMessageDescriptor update_complete_htlc__descriptor =
@@ -1870,7 +1868,7 @@ const ProtobufCMessageDescriptor update_complete_htlc__descriptor =
2,
update_complete_htlc__field_descriptors,
update_complete_htlc__field_indices_by_name,
2, update_complete_htlc__number_ranges,
1, update_complete_htlc__number_ranges,
(ProtobufCMessageInit) update_complete_htlc__init,
NULL,NULL,NULL /* reserved[123] */
};
@@ -1890,7 +1888,7 @@ static const ProtobufCFieldDescriptor update_timedout_htlc__field_descriptors[2]
},
{
"r_hash",
3,
2,
PROTOBUF_C_LABEL_REQUIRED,
PROTOBUF_C_TYPE_MESSAGE,
0, /* quantifier_offset */
@@ -1905,10 +1903,9 @@ static const unsigned update_timedout_htlc__field_indices_by_name[] = {
1, /* field[1] = r_hash */
0, /* field[0] = revocation_hash */
};
static const ProtobufCIntRange update_timedout_htlc__number_ranges[2 + 1] =
static const ProtobufCIntRange update_timedout_htlc__number_ranges[1 + 1] =
{
{ 1, 0 },
{ 3, 1 },
{ 0, 2 }
};
const ProtobufCMessageDescriptor update_timedout_htlc__descriptor =
@@ -1922,7 +1919,7 @@ const ProtobufCMessageDescriptor update_timedout_htlc__descriptor =
2,
update_timedout_htlc__field_descriptors,
update_timedout_htlc__field_indices_by_name,
2, update_timedout_htlc__number_ranges,
1, update_timedout_htlc__number_ranges,
(ProtobufCMessageInit) update_timedout_htlc__init,
NULL,NULL,NULL /* reserved[123] */
};
@@ -1942,7 +1939,7 @@ static const ProtobufCFieldDescriptor update_routefail_htlc__field_descriptors[2
},
{
"r_hash",
3,
2,
PROTOBUF_C_LABEL_REQUIRED,
PROTOBUF_C_TYPE_MESSAGE,
0, /* quantifier_offset */
@@ -1957,10 +1954,9 @@ static const unsigned update_routefail_htlc__field_indices_by_name[] = {
1, /* field[1] = r_hash */
0, /* field[0] = revocation_hash */
};
static const ProtobufCIntRange update_routefail_htlc__number_ranges[2 + 1] =
static const ProtobufCIntRange update_routefail_htlc__number_ranges[1 + 1] =
{
{ 1, 0 },
{ 3, 1 },
{ 0, 2 }
};
const ProtobufCMessageDescriptor update_routefail_htlc__descriptor =
@@ -1974,7 +1970,7 @@ const ProtobufCMessageDescriptor update_routefail_htlc__descriptor =
2,
update_routefail_htlc__field_descriptors,
update_routefail_htlc__field_indices_by_name,
2, update_routefail_htlc__number_ranges,
1, update_routefail_htlc__number_ranges,
(ProtobufCMessageInit) update_routefail_htlc__init,
NULL,NULL,NULL /* reserved[123] */
};
@@ -1994,7 +1990,7 @@ static const ProtobufCFieldDescriptor update_accept__field_descriptors[2] =
},
{
"revocation_hash",
3,
2,
PROTOBUF_C_LABEL_REQUIRED,
PROTOBUF_C_TYPE_MESSAGE,
0, /* quantifier_offset */
@@ -2009,10 +2005,9 @@ static const unsigned update_accept__field_indices_by_name[] = {
1, /* field[1] = revocation_hash */
0, /* field[0] = sig */
};
static const ProtobufCIntRange update_accept__number_ranges[2 + 1] =
static const ProtobufCIntRange update_accept__number_ranges[1 + 1] =
{
{ 1, 0 },
{ 3, 1 },
{ 0, 2 }
};
const ProtobufCMessageDescriptor update_accept__descriptor =
@@ -2026,7 +2021,7 @@ const ProtobufCMessageDescriptor update_accept__descriptor =
2,
update_accept__field_descriptors,
update_accept__field_indices_by_name,
2, update_accept__number_ranges,
1, update_accept__number_ranges,
(ProtobufCMessageInit) update_accept__init,
NULL,NULL,NULL /* reserved[123] */
};
@@ -2376,7 +2371,7 @@ static const ProtobufCFieldDescriptor pkt__field_descriptors[17] =
},
{
"open",
201,
20,
PROTOBUF_C_LABEL_OPTIONAL,
PROTOBUF_C_TYPE_MESSAGE,
offsetof(Pkt, pkt_case),
@@ -2388,7 +2383,7 @@ static const ProtobufCFieldDescriptor pkt__field_descriptors[17] =
},
{
"open_anchor",
202,
21,
PROTOBUF_C_LABEL_OPTIONAL,
PROTOBUF_C_TYPE_MESSAGE,
offsetof(Pkt, pkt_case),
@@ -2400,7 +2395,7 @@ static const ProtobufCFieldDescriptor pkt__field_descriptors[17] =
},
{
"open_commit_sig",
203,
22,
PROTOBUF_C_LABEL_OPTIONAL,
PROTOBUF_C_TYPE_MESSAGE,
offsetof(Pkt, pkt_case),
@@ -2412,7 +2407,7 @@ static const ProtobufCFieldDescriptor pkt__field_descriptors[17] =
},
{
"open_complete",
204,
23,
PROTOBUF_C_LABEL_OPTIONAL,
PROTOBUF_C_TYPE_MESSAGE,
offsetof(Pkt, pkt_case),
@@ -2424,7 +2419,7 @@ static const ProtobufCFieldDescriptor pkt__field_descriptors[17] =
},
{
"close",
401,
30,
PROTOBUF_C_LABEL_OPTIONAL,
PROTOBUF_C_TYPE_MESSAGE,
offsetof(Pkt, pkt_case),
@@ -2436,7 +2431,7 @@ static const ProtobufCFieldDescriptor pkt__field_descriptors[17] =
},
{
"close_complete",
402,
31,
PROTOBUF_C_LABEL_OPTIONAL,
PROTOBUF_C_TYPE_MESSAGE,
offsetof(Pkt, pkt_case),
@@ -2448,7 +2443,7 @@ static const ProtobufCFieldDescriptor pkt__field_descriptors[17] =
},
{
"close_ack",
403,
32,
PROTOBUF_C_LABEL_OPTIONAL,
PROTOBUF_C_TYPE_MESSAGE,
offsetof(Pkt, pkt_case),
@@ -2460,7 +2455,7 @@ static const ProtobufCFieldDescriptor pkt__field_descriptors[17] =
},
{
"error",
1000,
40,
PROTOBUF_C_LABEL_OPTIONAL,
PROTOBUF_C_TYPE_MESSAGE,
offsetof(Pkt, pkt_case),
@@ -2493,9 +2488,9 @@ static const unsigned pkt__field_indices_by_name[] = {
static const ProtobufCIntRange pkt__number_ranges[4 + 1] =
{
{ 1, 0 },
{ 201, 9 },
{ 401, 13 },
{ 1000, 16 },
{ 20, 9 },
{ 30, 13 },
{ 40, 16 },
{ 0, 17 }
};
const ProtobufCMessageDescriptor pkt__descriptor =

View File

@@ -500,10 +500,10 @@ struct _Error
typedef enum {
PKT__PKT__NOT_SET = 0,
PKT__PKT_OPEN = 201,
PKT__PKT_OPEN_ANCHOR = 202,
PKT__PKT_OPEN_COMMIT_SIG = 203,
PKT__PKT_OPEN_COMPLETE = 204,
PKT__PKT_OPEN = 20,
PKT__PKT_OPEN_ANCHOR = 21,
PKT__PKT_OPEN_COMMIT_SIG = 22,
PKT__PKT_OPEN_COMPLETE = 23,
PKT__PKT_UPDATE = 1,
PKT__PKT_UPDATE_ADD_HTLC = 2,
PKT__PKT_UPDATE_ACCEPT = 3,
@@ -513,10 +513,10 @@ typedef enum {
PKT__PKT_UPDATE_COMPLETE_HTLC = 7,
PKT__PKT_UPDATE_TIMEDOUT_HTLC = 8,
PKT__PKT_UPDATE_ROUTEFAIL_HTLC = 9,
PKT__PKT_CLOSE = 401,
PKT__PKT_CLOSE_COMPLETE = 402,
PKT__PKT_CLOSE_ACK = 403,
PKT__PKT_ERROR = 1000,
PKT__PKT_CLOSE = 30,
PKT__PKT_CLOSE_COMPLETE = 31,
PKT__PKT_CLOSE_ACK = 32,
PKT__PKT_ERROR = 40,
} Pkt__PktCase;
/*

View File

@@ -54,13 +54,13 @@ message funding {
// Set channel params.
message open_channel {
// Relative locktime for outputs going to us.
required locktime delay = 2;
required locktime delay = 1;
// Hash for revoking first commitment transaction.
required sha256_hash revocation_hash = 4;
required sha256_hash revocation_hash = 2;
// Pubkey for anchor to pay into commitment tx.
required bitcoin_pubkey commit_key = 5;
required bitcoin_pubkey commit_key = 3;
// How to pay money to us from commit_tx.
required bitcoin_pubkey final_key = 1;
required bitcoin_pubkey final_key = 4;
enum anchor_offer {
// I will create the anchor
@@ -68,13 +68,13 @@ message open_channel {
// I won't create the anchor
WONT_CREATE_ANCHOR = 2;
}
required anchor_offer anch = 6;
required anchor_offer anch = 5;
// How far must anchor be buried before we consider channel live?
optional uint32 min_depth = 7 [ default = 0 ];
optional uint32 min_depth = 6 [ default = 0 ];
// How much fee would I like on commitment tx?
required uint64 commitment_fee = 8;
required uint64 commitment_fee = 7;
}
// Whoever is supplying anchor sends this.
@@ -136,7 +136,7 @@ message update_complete_htlc {
// Hash for which I will supply preimage to revoke this commitment tx.
required sha256_hash revocation_hash = 1;
// HTLC R value.
required sha256_hash r = 3;
required sha256_hash r = 2;
}
// Remove my HTLC: it has timed out, before you got the R value.
@@ -144,7 +144,7 @@ message update_timedout_htlc {
// Hash for which I will supply preimage to revoke this commitment tx.
required sha256_hash revocation_hash = 1;
// Hash for HTLC R value.
required sha256_hash r_hash = 3;
required sha256_hash r_hash = 2;
}
// Remove your HTLC: routing has failed upstream
@@ -152,7 +152,7 @@ message update_routefail_htlc {
// Hash for which I will supply preimage to revoke this commitment tx.
required sha256_hash revocation_hash = 1;
// Hash for HTLC R value.
required sha256_hash r_hash = 3;
required sha256_hash r_hash = 2;
}
// OK, I accept that update; here's your signature.
@@ -160,7 +160,7 @@ message update_accept {
// Signature for your new commitment tx.
required signature sig = 1;
// Hash for which I will supply preimage to revoke this new commit tx.
required sha256_hash revocation_hash = 3;
required sha256_hash revocation_hash = 2;
}
// Thanks for accepting, here's my last bit.
@@ -206,10 +206,10 @@ message error {
message pkt {
oneof pkt {
// Opening
open_channel open = 201;
open_anchor open_anchor = 202;
open_commit_sig open_commit_sig = 203;
open_complete open_complete = 204;
open_channel open = 20;
open_anchor open_anchor = 21;
open_commit_sig open_commit_sig = 22;
open_complete open_complete = 23;
// Updating (most common)
update update = 1;
update_add_htlc update_add_htlc = 2;
@@ -221,11 +221,11 @@ message pkt {
update_timedout_htlc update_timedout_htlc = 8;
update_routefail_htlc update_routefail_htlc = 9;
// Closing
close_channel close = 401;
close_channel_complete close_complete = 402;
close_channel_ack close_ack = 403;
close_channel close = 30;
close_channel_complete close_complete = 31;
close_channel_ack close_ack = 32;
// Unexpected issue.
error error = 1000;
error error = 40;
}
}