Skip to content

Commit

Permalink
protocol: rename update_complete_htlc to update_fulfill_htlc.
Browse files Browse the repository at this point in the history
Complete was an overloaded word.

Signed-off-by: Rusty Russell <[email protected]>
  • Loading branch information
rustyrussell committed Sep 25, 2015
1 parent ca68c5c commit 31459d6
Show file tree
Hide file tree
Showing 9 changed files with 110 additions and 91 deletions.
74 changes: 37 additions & 37 deletions lightning.pb-c.c
Original file line number Diff line number Diff line change
Expand Up @@ -523,47 +523,47 @@ void update_decline_htlc__free_unpacked
assert(message->base.descriptor == &update_decline_htlc__descriptor);
protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator);
}
void update_complete_htlc__init
(UpdateCompleteHtlc *message)
void update_fulfill_htlc__init
(UpdateFulfillHtlc *message)
{
static UpdateCompleteHtlc init_value = UPDATE_COMPLETE_HTLC__INIT;
static UpdateFulfillHtlc init_value = UPDATE_FULFILL_HTLC__INIT;
*message = init_value;
}
size_t update_complete_htlc__get_packed_size
(const UpdateCompleteHtlc *message)
size_t update_fulfill_htlc__get_packed_size
(const UpdateFulfillHtlc *message)
{
assert(message->base.descriptor == &update_complete_htlc__descriptor);
assert(message->base.descriptor == &update_fulfill_htlc__descriptor);
return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message));
}
size_t update_complete_htlc__pack
(const UpdateCompleteHtlc *message,
size_t update_fulfill_htlc__pack
(const UpdateFulfillHtlc *message,
uint8_t *out)
{
assert(message->base.descriptor == &update_complete_htlc__descriptor);
assert(message->base.descriptor == &update_fulfill_htlc__descriptor);
return protobuf_c_message_pack ((const ProtobufCMessage*)message, out);
}
size_t update_complete_htlc__pack_to_buffer
(const UpdateCompleteHtlc *message,
size_t update_fulfill_htlc__pack_to_buffer
(const UpdateFulfillHtlc *message,
ProtobufCBuffer *buffer)
{
assert(message->base.descriptor == &update_complete_htlc__descriptor);
assert(message->base.descriptor == &update_fulfill_htlc__descriptor);
return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer);
}
UpdateCompleteHtlc *
update_complete_htlc__unpack
UpdateFulfillHtlc *
update_fulfill_htlc__unpack
(ProtobufCAllocator *allocator,
size_t len,
const uint8_t *data)
{
return (UpdateCompleteHtlc *)
protobuf_c_message_unpack (&update_complete_htlc__descriptor,
return (UpdateFulfillHtlc *)
protobuf_c_message_unpack (&update_fulfill_htlc__descriptor,
allocator, len, data);
}
void update_complete_htlc__free_unpacked
(UpdateCompleteHtlc *message,
void update_fulfill_htlc__free_unpacked
(UpdateFulfillHtlc *message,
ProtobufCAllocator *allocator)
{
assert(message->base.descriptor == &update_complete_htlc__descriptor);
assert(message->base.descriptor == &update_fulfill_htlc__descriptor);
protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator);
}
void update_timedout_htlc__init
Expand Down Expand Up @@ -1821,15 +1821,15 @@ const ProtobufCMessageDescriptor update_decline_htlc__descriptor =
(ProtobufCMessageInit) update_decline_htlc__init,
NULL,NULL,NULL /* reserved[123] */
};
static const ProtobufCFieldDescriptor update_complete_htlc__field_descriptors[2] =
static const ProtobufCFieldDescriptor update_fulfill_htlc__field_descriptors[2] =
{
{
"revocation_hash",
1,
PROTOBUF_C_LABEL_REQUIRED,
PROTOBUF_C_TYPE_MESSAGE,
0, /* quantifier_offset */
offsetof(UpdateCompleteHtlc, revocation_hash),
offsetof(UpdateFulfillHtlc, revocation_hash),
&sha256_hash__descriptor,
NULL,
0, /* flags */
Expand All @@ -1841,35 +1841,35 @@ static const ProtobufCFieldDescriptor update_complete_htlc__field_descriptors[2]
PROTOBUF_C_LABEL_REQUIRED,
PROTOBUF_C_TYPE_MESSAGE,
0, /* quantifier_offset */
offsetof(UpdateCompleteHtlc, r),
offsetof(UpdateFulfillHtlc, r),
&sha256_hash__descriptor,
NULL,
0, /* flags */
0,NULL,NULL /* reserved1,reserved2, etc */
},
};
static const unsigned update_complete_htlc__field_indices_by_name[] = {
static const unsigned update_fulfill_htlc__field_indices_by_name[] = {
1, /* field[1] = r */
0, /* field[0] = revocation_hash */
};
static const ProtobufCIntRange update_complete_htlc__number_ranges[1 + 1] =
static const ProtobufCIntRange update_fulfill_htlc__number_ranges[1 + 1] =
{
{ 1, 0 },
{ 0, 2 }
};
const ProtobufCMessageDescriptor update_complete_htlc__descriptor =
const ProtobufCMessageDescriptor update_fulfill_htlc__descriptor =
{
PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC,
"update_complete_htlc",
"UpdateCompleteHtlc",
"UpdateCompleteHtlc",
"update_fulfill_htlc",
"UpdateFulfillHtlc",
"UpdateFulfillHtlc",
"",
sizeof(UpdateCompleteHtlc),
sizeof(UpdateFulfillHtlc),
2,
update_complete_htlc__field_descriptors,
update_complete_htlc__field_indices_by_name,
1, update_complete_htlc__number_ranges,
(ProtobufCMessageInit) update_complete_htlc__init,
update_fulfill_htlc__field_descriptors,
update_fulfill_htlc__field_indices_by_name,
1, update_fulfill_htlc__number_ranges,
(ProtobufCMessageInit) update_fulfill_htlc__init,
NULL,NULL,NULL /* reserved[123] */
};
static const ProtobufCFieldDescriptor update_timedout_htlc__field_descriptors[2] =
Expand Down Expand Up @@ -2334,13 +2334,13 @@ static const ProtobufCFieldDescriptor pkt__field_descriptors[17] =
0,NULL,NULL /* reserved1,reserved2, etc */
},
{
"update_complete_htlc",
"update_fulfill_htlc",
7,
PROTOBUF_C_LABEL_OPTIONAL,
PROTOBUF_C_TYPE_MESSAGE,
offsetof(Pkt, pkt_case),
offsetof(Pkt, update_complete_htlc),
&update_complete_htlc__descriptor,
offsetof(Pkt, update_fulfill_htlc),
&update_fulfill_htlc__descriptor,
NULL,
0 | PROTOBUF_C_FIELD_FLAG_ONEOF, /* flags */
0,NULL,NULL /* reserved1,reserved2, etc */
Expand Down Expand Up @@ -2479,8 +2479,8 @@ static const unsigned pkt__field_indices_by_name[] = {
2, /* field[2] = update_accept */
1, /* field[1] = update_add_htlc */
4, /* field[4] = update_complete */
6, /* field[6] = update_complete_htlc */
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 */
Expand Down
44 changes: 22 additions & 22 deletions lightning.pb-c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions lightning.proto
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ message update_decline_htlc {
}

// Complete your HTLC: I have the R value, pay me!
message update_complete_htlc {
message update_fulfill_htlc {
// Hash for which I will supply preimage to revoke this commitment tx.
required sha256_hash revocation_hash = 1;
// HTLC R value.
Expand Down Expand Up @@ -217,7 +217,7 @@ message pkt {
update_signature update_signature = 4;
update_complete update_complete = 5;
update_decline_htlc update_decline_htlc = 6;
update_complete_htlc update_complete_htlc = 7;
update_fulfill_htlc update_fulfill_htlc = 7;
update_timedout_htlc update_timedout_htlc = 8;
update_routefail_htlc update_routefail_htlc = 9;
// Closing
Expand Down
4 changes: 2 additions & 2 deletions pkt.c
Original file line number Diff line number Diff line change
Expand Up @@ -167,12 +167,12 @@ struct pkt *update_htlc_complete_pkt(const tal_t *ctx,
const struct sha256 *revocation_hash,
const struct sha256 *rval)
{
UpdateCompleteHtlc u = UPDATE_COMPLETE_HTLC__INIT;
UpdateFulfillHtlc u = UPDATE_FULFILL_HTLC__INIT;

u.revocation_hash = sha256_to_proto(ctx, revocation_hash);
u.r = sha256_to_proto(ctx, rval);

return to_pkt(ctx, PKT__PKT_UPDATE_COMPLETE_HTLC, &u);
return to_pkt(ctx, PKT__PKT_UPDATE_FULFILL_HTLC, &u);
}

struct pkt *update_htlc_timedout_pkt(const tal_t *ctx,
Expand Down
18 changes: 9 additions & 9 deletions state.c
Original file line number Diff line number Diff line change
Expand Up @@ -312,10 +312,10 @@ enum state state(const enum state state, const struct state_data *sdata,
set_effect(effect, send,
pkt_htlc_update(effect, sdata, idata->cmd));
return prio(state, STATE_WAIT_FOR_HTLC_ACCEPT);
} else if (input_is(input, CMD_SEND_HTLC_COMPLETE)) {
/* We are to send an HTLC complete. */
} else if (input_is(input, CMD_SEND_HTLC_FULFILL)) {
/* We are to send an HTLC fulfill. */
set_effect(effect, send,
pkt_htlc_complete(effect, sdata, idata->cmd));
pkt_htlc_fulfill(effect, sdata, idata->cmd));
return prio(state, STATE_WAIT_FOR_HTLC_ACCEPT);
} else if (input_is(input, CMD_SEND_HTLC_TIMEDOUT)) {
/* We are to send an HTLC timedout. */
Expand All @@ -332,8 +332,8 @@ enum state state(const enum state state, const struct state_data *sdata,
goto start_closing;
} else if (input_is(input, PKT_UPDATE_ADD_HTLC)) {
goto accept_htlc_update;
} else if (input_is(input, PKT_UPDATE_COMPLETE_HTLC)) {
goto accept_htlc_complete;
} else if (input_is(input, PKT_UPDATE_FULFILL_HTLC)) {
goto accept_htlc_fulfill;
} else if (input_is(input, PKT_UPDATE_TIMEDOUT_HTLC)) {
goto accept_htlc_timedout;
} else if (input_is(input, PKT_UPDATE_ROUTEFAIL_HTLC)) {
Expand Down Expand Up @@ -365,14 +365,14 @@ enum state state(const enum state state, const struct state_data *sdata,
/* Otherwise, process their request first: defer ours */
requeue_cmd(effect, CMD_SEND_UPDATE_ANY);
goto accept_htlc_update;
} else if (input_is(input, PKT_UPDATE_COMPLETE_HTLC)) {
} else if (input_is(input, PKT_UPDATE_FULFILL_HTLC)) {
/* If we're high priority, ignore their packet */
if (high_priority(state))
return state;

/* Otherwise, process their request first: defer ours */
requeue_cmd(effect, CMD_SEND_UPDATE_ANY);
goto accept_htlc_complete;
goto accept_htlc_fulfill;
} else if (input_is(input, PKT_UPDATE_TIMEDOUT_HTLC)) {
/* If we're high priority, ignore their packet */
if (high_priority(state))
Expand Down Expand Up @@ -743,8 +743,8 @@ enum state state(const enum state state, const struct state_data *sdata,
set_effect(effect, send, pkt_update_accept(effect, sdata));
return prio(state, STATE_WAIT_FOR_UPDATE_SIG);

accept_htlc_complete:
err = accept_pkt_htlc_complete(effect, sdata, idata->pkt);
accept_htlc_fulfill:
err = accept_pkt_htlc_fulfill(effect, sdata, idata->pkt);
if (err)
goto err_start_unilateral_close;
set_effect(effect, send, pkt_update_accept(effect, sdata));
Expand Down
6 changes: 3 additions & 3 deletions state.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ static inline bool input_is(enum state_input a, enum state_input b)
if (b == CMD_SEND_UPDATE_ANY) {
/* Single | here, we want to record all. */
return input_is(a, CMD_SEND_HTLC_UPDATE)
| input_is(a, CMD_SEND_HTLC_COMPLETE)
| input_is(a, CMD_SEND_HTLC_FULFILL)
| input_is(a, CMD_SEND_HTLC_TIMEDOUT)
| input_is(a, CMD_SEND_HTLC_ROUTEFAIL);
}
Expand All @@ -98,7 +98,7 @@ Pkt *pkt_anchor(const tal_t *ctx, const struct state_data *sdata);
Pkt *pkt_open_commit_sig(const tal_t *ctx, const struct state_data *sdata);
Pkt *pkt_open_complete(const tal_t *ctx, const struct state_data *sdata);
Pkt *pkt_htlc_update(const tal_t *ctx, const struct state_data *sdata, void *data);
Pkt *pkt_htlc_complete(const tal_t *ctx, const struct state_data *sdata, void *data);
Pkt *pkt_htlc_fulfill(const tal_t *ctx, const struct state_data *sdata, void *data);
Pkt *pkt_htlc_timedout(const tal_t *ctx, const struct state_data *sdata, void *data);
Pkt *pkt_htlc_routefail(const tal_t *ctx, const struct state_data *sdata, void *data);
Pkt *pkt_update_accept(const tal_t *ctx, const struct state_data *sdata);
Expand Down Expand Up @@ -132,7 +132,7 @@ Pkt *accept_pkt_htlc_routefail(struct state_effect *effect,
Pkt *accept_pkt_htlc_timedout(struct state_effect *effect,
const struct state_data *sdata, const Pkt *pkt);

Pkt *accept_pkt_htlc_complete(struct state_effect *effect,
Pkt *accept_pkt_htlc_fulfill(struct state_effect *effect,
const struct state_data *sdata, const Pkt *pkt);

Pkt *accept_pkt_update_accept(struct state_effect *effect,
Expand Down
Loading

0 comments on commit 31459d6

Please sign in to comment.