Browse Source

protocol: remove update message

We never do unilateral transfers, except via an HTLC.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
ppa-0.6.1
Rusty Russell 9 years ago
parent
commit
3494cbfb7c
  1. 157
      lightning.pb-c.c
  2. 46
      lightning.pb-c.h
  3. 9
      lightning.proto

157
lightning.pb-c.c

@ -437,49 +437,6 @@ void open_complete__free_unpacked
assert(message->base.descriptor == &open_complete__descriptor);
protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator);
}
void update__init
(Update *message)
{
static Update init_value = UPDATE__INIT;
*message = init_value;
}
size_t update__get_packed_size
(const Update *message)
{
assert(message->base.descriptor == &update__descriptor);
return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message));
}
size_t update__pack
(const Update *message,
uint8_t *out)
{
assert(message->base.descriptor == &update__descriptor);
return protobuf_c_message_pack ((const ProtobufCMessage*)message, out);
}
size_t update__pack_to_buffer
(const Update *message,
ProtobufCBuffer *buffer)
{
assert(message->base.descriptor == &update__descriptor);
return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer);
}
Update *
update__unpack
(ProtobufCAllocator *allocator,
size_t len,
const uint8_t *data)
{
return (Update *)
protobuf_c_message_unpack (&update__descriptor,
allocator, len, data);
}
void update__free_unpacked
(Update *message,
ProtobufCAllocator *allocator)
{
assert(message->base.descriptor == &update__descriptor);
protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator);
}
void update_add_htlc__init
(UpdateAddHtlc *message)
{
@ -1736,57 +1693,6 @@ const ProtobufCMessageDescriptor open_complete__descriptor =
(ProtobufCMessageInit) open_complete__init,
NULL,NULL,NULL /* reserved[123] */
};
static const ProtobufCFieldDescriptor update__field_descriptors[2] =
{
{
"revocation_hash",
1,
PROTOBUF_C_LABEL_REQUIRED,
PROTOBUF_C_TYPE_MESSAGE,
0, /* quantifier_offset */
offsetof(Update, revocation_hash),
&sha256_hash__descriptor,
NULL,
0, /* flags */
0,NULL,NULL /* reserved1,reserved2, etc */
},
{
"delta_msat",
2,
PROTOBUF_C_LABEL_REQUIRED,
PROTOBUF_C_TYPE_SINT64,
0, /* quantifier_offset */
offsetof(Update, delta_msat),
NULL,
NULL,
0, /* flags */
0,NULL,NULL /* reserved1,reserved2, etc */
},
};
static const unsigned update__field_indices_by_name[] = {
1, /* field[1] = delta_msat */
0, /* field[0] = revocation_hash */
};
static const ProtobufCIntRange update__number_ranges[1 + 1] =
{
{ 1, 0 },
{ 0, 2 }
};
const ProtobufCMessageDescriptor update__descriptor =
{
PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC,
"update",
"Update",
"Update",
"",
sizeof(Update),
2,
update__field_descriptors,
update__field_indices_by_name,
1, update__number_ranges,
(ProtobufCMessageInit) update__init,
NULL,NULL,NULL /* reserved[123] */
};
static const ProtobufCFieldDescriptor update_add_htlc__field_descriptors[4] =
{
{
@ -2353,20 +2259,8 @@ const ProtobufCMessageDescriptor error__descriptor =
(ProtobufCMessageInit) error__init,
NULL,NULL,NULL /* reserved[123] */
};
static const ProtobufCFieldDescriptor pkt__field_descriptors[18] =
static const ProtobufCFieldDescriptor pkt__field_descriptors[17] =
{
{
"update",
1,
PROTOBUF_C_LABEL_OPTIONAL,
PROTOBUF_C_TYPE_MESSAGE,
offsetof(Pkt, pkt_case),
offsetof(Pkt, update),
&update__descriptor,
NULL,
0 | PROTOBUF_C_FIELD_FLAG_ONEOF, /* flags */
0,NULL,NULL /* reserved1,reserved2, etc */
},
{
"update_add_htlc",
2,
@ -2573,33 +2467,32 @@ static const ProtobufCFieldDescriptor pkt__field_descriptors[18] =
},
};
static const unsigned pkt__field_indices_by_name[] = {
17, /* field[17] = auth */
13, /* field[13] = close */
15, /* field[15] = close_ack */
14, /* field[14] = close_complete */
16, /* field[16] = error */
9, /* field[9] = open */
10, /* field[10] = open_anchor */
11, /* field[11] = open_commit_sig */
12, /* field[12] = open_complete */
0, /* field[0] = update */
2, /* field[2] = update_accept */
1, /* field[1] = update_add_htlc */
4, /* field[4] = update_complete */
5, /* field[5] = update_decline_htlc */
6, /* field[6] = update_fulfill_htlc */
8, /* field[8] = update_routefail_htlc */
3, /* field[3] = update_signature */
7, /* field[7] = update_timedout_htlc */
16, /* field[16] = auth */
12, /* field[12] = close */
14, /* field[14] = close_ack */
13, /* field[13] = close_complete */
15, /* field[15] = error */
8, /* field[8] = open */
9, /* field[9] = open_anchor */
10, /* field[10] = open_commit_sig */
11, /* field[11] = open_complete */
1, /* field[1] = update_accept */
0, /* field[0] = update_add_htlc */
3, /* field[3] = update_complete */
4, /* field[4] = update_decline_htlc */
5, /* field[5] = update_fulfill_htlc */
7, /* field[7] = update_routefail_htlc */
2, /* field[2] = update_signature */
6, /* field[6] = update_timedout_htlc */
};
static const ProtobufCIntRange pkt__number_ranges[5 + 1] =
{
{ 1, 0 },
{ 20, 9 },
{ 30, 13 },
{ 40, 16 },
{ 50, 17 },
{ 0, 18 }
{ 2, 0 },
{ 20, 8 },
{ 30, 12 },
{ 40, 15 },
{ 50, 16 },
{ 0, 17 }
};
const ProtobufCMessageDescriptor pkt__descriptor =
{
@ -2609,7 +2502,7 @@ const ProtobufCMessageDescriptor pkt__descriptor =
"Pkt",
"",
sizeof(Pkt),
18,
17,
pkt__field_descriptors,
pkt__field_indices_by_name,
5, pkt__number_ranges,

46
lightning.pb-c.h

@ -25,7 +25,6 @@ typedef struct _OpenChannel OpenChannel;
typedef struct _OpenAnchor OpenAnchor;
typedef struct _OpenCommitSig OpenCommitSig;
typedef struct _OpenComplete OpenComplete;
typedef struct _Update Update;
typedef struct _UpdateAddHtlc UpdateAddHtlc;
typedef struct _UpdateDeclineHtlc UpdateDeclineHtlc;
typedef struct _UpdateFulfillHtlc UpdateFulfillHtlc;
@ -266,26 +265,6 @@ struct _OpenComplete
, NULL }
/*
* Let's spend some money in the channel!
*/
struct _Update
{
ProtobufCMessage base;
/*
* Hash for which I will supply preimage to revoke this.
*/
Sha256Hash *revocation_hash;
/*
* Change in current payment to-me (implies reverse to-you).
*/
int64_t delta_msat;
};
#define UPDATE__INIT \
{ PROTOBUF_C_MESSAGE_INIT (&update__descriptor) \
, NULL, 0 }
/*
* Start a new commitment tx to add an HTLC me -> you.
*/
@ -526,7 +505,6 @@ typedef enum {
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,
PKT__PKT_UPDATE_SIGNATURE = 4,
@ -563,7 +541,6 @@ struct _Pkt
/*
* Updating (most common)
*/
Update *update;
UpdateAddHtlc *update_add_htlc;
UpdateAccept *update_accept;
UpdateSignature *update_signature;
@ -779,25 +756,6 @@ OpenComplete *
void open_complete__free_unpacked
(OpenComplete *message,
ProtobufCAllocator *allocator);
/* Update methods */
void update__init
(Update *message);
size_t update__get_packed_size
(const Update *message);
size_t update__pack
(const Update *message,
uint8_t *out);
size_t update__pack_to_buffer
(const Update *message,
ProtobufCBuffer *buffer);
Update *
update__unpack
(ProtobufCAllocator *allocator,
size_t len,
const uint8_t *data);
void update__free_unpacked
(Update *message,
ProtobufCAllocator *allocator);
/* UpdateAddHtlc methods */
void update_add_htlc__init
(UpdateAddHtlc *message);
@ -1077,9 +1035,6 @@ typedef void (*OpenCommitSig_Closure)
typedef void (*OpenComplete_Closure)
(const OpenComplete *message,
void *closure_data);
typedef void (*Update_Closure)
(const Update *message,
void *closure_data);
typedef void (*UpdateAddHtlc_Closure)
(const UpdateAddHtlc *message,
void *closure_data);
@ -1136,7 +1091,6 @@ extern const ProtobufCEnumDescriptor open_channel__anchor_offer__descriptor;
extern const ProtobufCMessageDescriptor open_anchor__descriptor;
extern const ProtobufCMessageDescriptor open_commit_sig__descriptor;
extern const ProtobufCMessageDescriptor open_complete__descriptor;
extern const ProtobufCMessageDescriptor update__descriptor;
extern const ProtobufCMessageDescriptor update_add_htlc__descriptor;
extern const ProtobufCMessageDescriptor update_decline_htlc__descriptor;
extern const ProtobufCMessageDescriptor update_fulfill_htlc__descriptor;

9
lightning.proto

@ -110,14 +110,6 @@ message open_complete {
// FIXME: add a merkle proof plus block headers here?
}
// Let's spend some money in the channel!
message update {
// Hash for which I will supply preimage to revoke this.
required sha256_hash revocation_hash = 1;
// Change in current payment to-me (implies reverse to-you).
required sint64 delta_msat = 2;
}
// Start a new commitment tx to add an HTLC me -> you.
message update_add_htlc {
// Hash for which I will supply preimage to revoke this commitment tx.
@ -221,7 +213,6 @@ message pkt {
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;
update_accept update_accept = 3;
update_signature update_signature = 4;

Loading…
Cancel
Save