mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-01-17 19:03:42 +01:00
protocol: rename update_complete_htlc to update_fulfill_htlc.
Complete was an overloaded word. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
ca68c5c47f
commit
31459d6cd2
@ -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
|
||||
@ -1821,7 +1821,7 @@ 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",
|
||||
@ -1829,7 +1829,7 @@ static const ProtobufCFieldDescriptor update_complete_htlc__field_descriptors[2]
|
||||
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 */
|
||||
@ -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] =
|
||||
@ -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 */
|
||||
@ -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 */
|
||||
|
@ -27,7 +27,7 @@ typedef struct _OpenComplete OpenComplete;
|
||||
typedef struct _Update Update;
|
||||
typedef struct _UpdateAddHtlc UpdateAddHtlc;
|
||||
typedef struct _UpdateDeclineHtlc UpdateDeclineHtlc;
|
||||
typedef struct _UpdateCompleteHtlc UpdateCompleteHtlc;
|
||||
typedef struct _UpdateFulfillHtlc UpdateFulfillHtlc;
|
||||
typedef struct _UpdateTimedoutHtlc UpdateTimedoutHtlc;
|
||||
typedef struct _UpdateRoutefailHtlc UpdateRoutefailHtlc;
|
||||
typedef struct _UpdateAccept UpdateAccept;
|
||||
@ -322,7 +322,7 @@ struct _UpdateDeclineHtlc
|
||||
/*
|
||||
* Complete your HTLC: I have the R value, pay me!
|
||||
*/
|
||||
struct _UpdateCompleteHtlc
|
||||
struct _UpdateFulfillHtlc
|
||||
{
|
||||
ProtobufCMessage base;
|
||||
/*
|
||||
@ -334,8 +334,8 @@ struct _UpdateCompleteHtlc
|
||||
*/
|
||||
Sha256Hash *r;
|
||||
};
|
||||
#define UPDATE_COMPLETE_HTLC__INIT \
|
||||
{ PROTOBUF_C_MESSAGE_INIT (&update_complete_htlc__descriptor) \
|
||||
#define UPDATE_FULFILL_HTLC__INIT \
|
||||
{ PROTOBUF_C_MESSAGE_INIT (&update_fulfill_htlc__descriptor) \
|
||||
, NULL, NULL }
|
||||
|
||||
|
||||
@ -510,7 +510,7 @@ typedef enum {
|
||||
PKT__PKT_UPDATE_SIGNATURE = 4,
|
||||
PKT__PKT_UPDATE_COMPLETE = 5,
|
||||
PKT__PKT_UPDATE_DECLINE_HTLC = 6,
|
||||
PKT__PKT_UPDATE_COMPLETE_HTLC = 7,
|
||||
PKT__PKT_UPDATE_FULFILL_HTLC = 7,
|
||||
PKT__PKT_UPDATE_TIMEDOUT_HTLC = 8,
|
||||
PKT__PKT_UPDATE_ROUTEFAIL_HTLC = 9,
|
||||
PKT__PKT_CLOSE = 30,
|
||||
@ -543,7 +543,7 @@ struct _Pkt
|
||||
UpdateSignature *update_signature;
|
||||
UpdateComplete *update_complete;
|
||||
UpdateDeclineHtlc *update_decline_htlc;
|
||||
UpdateCompleteHtlc *update_complete_htlc;
|
||||
UpdateFulfillHtlc *update_fulfill_htlc;
|
||||
UpdateTimedoutHtlc *update_timedout_htlc;
|
||||
UpdateRoutefailHtlc *update_routefail_htlc;
|
||||
/*
|
||||
@ -791,24 +791,24 @@ UpdateDeclineHtlc *
|
||||
void update_decline_htlc__free_unpacked
|
||||
(UpdateDeclineHtlc *message,
|
||||
ProtobufCAllocator *allocator);
|
||||
/* UpdateCompleteHtlc methods */
|
||||
void update_complete_htlc__init
|
||||
(UpdateCompleteHtlc *message);
|
||||
size_t update_complete_htlc__get_packed_size
|
||||
(const UpdateCompleteHtlc *message);
|
||||
size_t update_complete_htlc__pack
|
||||
(const UpdateCompleteHtlc *message,
|
||||
/* UpdateFulfillHtlc methods */
|
||||
void update_fulfill_htlc__init
|
||||
(UpdateFulfillHtlc *message);
|
||||
size_t update_fulfill_htlc__get_packed_size
|
||||
(const UpdateFulfillHtlc *message);
|
||||
size_t update_fulfill_htlc__pack
|
||||
(const UpdateFulfillHtlc *message,
|
||||
uint8_t *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);
|
||||
UpdateCompleteHtlc *
|
||||
update_complete_htlc__unpack
|
||||
UpdateFulfillHtlc *
|
||||
update_fulfill_htlc__unpack
|
||||
(ProtobufCAllocator *allocator,
|
||||
size_t len,
|
||||
const uint8_t *data);
|
||||
void update_complete_htlc__free_unpacked
|
||||
(UpdateCompleteHtlc *message,
|
||||
void update_fulfill_htlc__free_unpacked
|
||||
(UpdateFulfillHtlc *message,
|
||||
ProtobufCAllocator *allocator);
|
||||
/* UpdateTimedoutHtlc methods */
|
||||
void update_timedout_htlc__init
|
||||
@ -1038,8 +1038,8 @@ typedef void (*UpdateAddHtlc_Closure)
|
||||
typedef void (*UpdateDeclineHtlc_Closure)
|
||||
(const UpdateDeclineHtlc *message,
|
||||
void *closure_data);
|
||||
typedef void (*UpdateCompleteHtlc_Closure)
|
||||
(const UpdateCompleteHtlc *message,
|
||||
typedef void (*UpdateFulfillHtlc_Closure)
|
||||
(const UpdateFulfillHtlc *message,
|
||||
void *closure_data);
|
||||
typedef void (*UpdateTimedoutHtlc_Closure)
|
||||
(const UpdateTimedoutHtlc *message,
|
||||
@ -1090,7 +1090,7 @@ 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_complete_htlc__descriptor;
|
||||
extern const ProtobufCMessageDescriptor update_fulfill_htlc__descriptor;
|
||||
extern const ProtobufCMessageDescriptor update_timedout_htlc__descriptor;
|
||||
extern const ProtobufCMessageDescriptor update_routefail_htlc__descriptor;
|
||||
extern const ProtobufCMessageDescriptor update_accept__descriptor;
|
||||
|
@ -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.
|
||||
@ -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
|
||||
|
4
pkt.c
4
pkt.c
@ -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,
|
||||
|
18
state.c
18
state.c
@ -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. */
|
||||
@ -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)) {
|
||||
@ -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))
|
||||
@ -743,8 +743,8 @@ accept_htlc_timedout:
|
||||
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));
|
||||
|
6
state.h
6
state.h
@ -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);
|
||||
}
|
||||
@ -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);
|
||||
@ -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,
|
||||
|
@ -134,25 +134,44 @@ enum state {
|
||||
};
|
||||
|
||||
enum state_input {
|
||||
/* Packet inputs. */
|
||||
/*
|
||||
* Packet inputs.
|
||||
*/
|
||||
PKT_OPEN = PKT__PKT_OPEN,
|
||||
PKT_OPEN_ANCHOR = PKT__PKT_OPEN_ANCHOR,
|
||||
PKT_OPEN_COMMIT_SIG = PKT__PKT_OPEN_COMMIT_SIG,
|
||||
PKT_OPEN_COMPLETE = PKT__PKT_OPEN_COMPLETE,
|
||||
|
||||
/* Updating the commit transaction: new HTLC */
|
||||
PKT_UPDATE_ADD_HTLC = PKT__PKT_UPDATE_ADD_HTLC,
|
||||
PKT_UPDATE_ACCEPT = PKT__PKT_UPDATE_ACCEPT,
|
||||
PKT_UPDATE_SIGNATURE = PKT__PKT_UPDATE_SIGNATURE,
|
||||
PKT_UPDATE_COMPLETE = PKT__PKT_UPDATE_COMPLETE,
|
||||
PKT_UPDATE_COMPLETE_HTLC = PKT__PKT_UPDATE_COMPLETE_HTLC,
|
||||
/* Updating the commit transaction: I have your R value! */
|
||||
PKT_UPDATE_FULFILL_HTLC = PKT__PKT_UPDATE_FULFILL_HTLC,
|
||||
/* Updating the commit transaction: my HTLC timed out! */
|
||||
PKT_UPDATE_TIMEDOUT_HTLC = PKT__PKT_UPDATE_TIMEDOUT_HTLC,
|
||||
/* Updating the commit transaction: your HTLC failed upstream */
|
||||
PKT_UPDATE_ROUTEFAIL_HTLC = PKT__PKT_UPDATE_ROUTEFAIL_HTLC,
|
||||
|
||||
/* Update replies: */
|
||||
PKT_UPDATE_ACCEPT = PKT__PKT_UPDATE_ACCEPT,
|
||||
/* Only for PKT_UPDATE_ADD_HTLC. */
|
||||
PKT_UPDATE_DECLINE_HTLC = PKT__PKT_UPDATE_DECLINE_HTLC,
|
||||
|
||||
/* Reply to PKT_UPDATE_ACCEPT */
|
||||
PKT_UPDATE_SIGNATURE = PKT__PKT_UPDATE_SIGNATURE,
|
||||
/* Reply to PKT_UPDATE_SIGNATURE */
|
||||
PKT_UPDATE_COMPLETE = PKT__PKT_UPDATE_COMPLETE,
|
||||
|
||||
/* Mutual close sequence. */
|
||||
PKT_CLOSE = PKT__PKT_CLOSE,
|
||||
PKT_CLOSE_COMPLETE = PKT__PKT_CLOSE_COMPLETE,
|
||||
PKT_CLOSE_ACK = PKT__PKT_CLOSE_ACK,
|
||||
|
||||
/* Something unexpected went wrong. */
|
||||
PKT_ERROR = PKT__PKT_ERROR,
|
||||
|
||||
/* Non-packet inputs. */
|
||||
/*
|
||||
* Non-packet inputs.
|
||||
*/
|
||||
INPUT_NONE,
|
||||
|
||||
/*
|
||||
@ -187,7 +206,7 @@ enum state_input {
|
||||
|
||||
/* Commands */
|
||||
CMD_SEND_HTLC_UPDATE,
|
||||
CMD_SEND_HTLC_COMPLETE,
|
||||
CMD_SEND_HTLC_FULFILL,
|
||||
CMD_SEND_HTLC_TIMEDOUT,
|
||||
CMD_SEND_HTLC_ROUTEFAIL,
|
||||
CMD_CLOSE,
|
||||
|
@ -228,12 +228,12 @@ struct channel_state *gather_updates(const tal_t *ctx,
|
||||
our_rhash, their_rhash);
|
||||
break;
|
||||
|
||||
case PKT__PKT_UPDATE_COMPLETE_HTLC: {
|
||||
case PKT__PKT_UPDATE_FULFILL_HTLC: {
|
||||
struct sha256 r_hash, r_val;
|
||||
Sha256Hash *rh;
|
||||
|
||||
/* Get hash, to find the HTLC. */
|
||||
proto_to_sha256(pkt->update_complete_htlc->r, &r_val);
|
||||
proto_to_sha256(pkt->update_fulfill_htlc->r, &r_val);
|
||||
sha256(&r_hash, &r_val, sizeof(r_val));
|
||||
rh = sha256_to_proto(ctx, &r_hash);
|
||||
|
||||
@ -260,7 +260,7 @@ struct channel_state *gather_updates(const tal_t *ctx,
|
||||
(long long)amount, *argv);
|
||||
remove_htlc(&cstate->b, n);
|
||||
}
|
||||
update_rhash(pkt->update_complete_htlc->revocation_hash,
|
||||
update_rhash(pkt->update_fulfill_htlc->revocation_hash,
|
||||
received, num_updates,
|
||||
&old_our_rhash, &old_their_rhash,
|
||||
our_rhash, their_rhash);
|
||||
|
@ -232,9 +232,9 @@ Pkt *pkt_htlc_update(const tal_t *ctx, const struct state_data *sdata, void *dat
|
||||
return new_pkt(ctx, PKT_UPDATE_ADD_HTLC);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
return new_pkt(ctx, PKT_UPDATE_COMPLETE_HTLC);
|
||||
return new_pkt(ctx, PKT_UPDATE_FULFILL_HTLC);
|
||||
}
|
||||
|
||||
Pkt *pkt_htlc_timedout(const tal_t *ctx, const struct state_data *sdata, void *data)
|
||||
@ -323,7 +323,7 @@ Pkt *accept_pkt_htlc_timedout(struct state_effect *effect, const struct state_da
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Pkt *accept_pkt_htlc_complete(struct state_effect *effect, const struct state_data *sdata, const Pkt *pkt)
|
||||
Pkt *accept_pkt_htlc_fulfill(struct state_effect *effect, const struct state_data *sdata, const Pkt *pkt)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
@ -633,7 +633,7 @@ static bool is_current_command(const struct state_data *sdata,
|
||||
{
|
||||
if (cmd == CMD_SEND_UPDATE_ANY) {
|
||||
return is_current_command(sdata, CMD_SEND_HTLC_UPDATE)
|
||||
|| is_current_command(sdata, CMD_SEND_HTLC_COMPLETE)
|
||||
|| is_current_command(sdata, CMD_SEND_HTLC_FULFILL)
|
||||
|| is_current_command(sdata, CMD_SEND_HTLC_TIMEDOUT)
|
||||
|| is_current_command(sdata, CMD_SEND_HTLC_ROUTEFAIL);
|
||||
}
|
||||
@ -827,7 +827,7 @@ static bool normal_path(enum state_input i, enum state src, enum state dst)
|
||||
/* These clutter the graph, so only handle from normal state. */
|
||||
static bool too_cluttered(enum state_input i, enum state src)
|
||||
{
|
||||
if (i == CMD_CLOSE || i == PKT_CLOSE || i == PKT_UPDATE_ADD_HTLC || i == PKT_UPDATE_COMPLETE_HTLC)
|
||||
if (i == CMD_CLOSE || i == PKT_CLOSE || i == PKT_UPDATE_ADD_HTLC || i == PKT_UPDATE_FULFILL_HTLC)
|
||||
return src != STATE_NORMAL_LOWPRIO
|
||||
&& src != STATE_NORMAL_HIGHPRIO;
|
||||
return false;
|
||||
@ -1105,7 +1105,7 @@ static struct trail *run_peer(const struct state_data *sdata,
|
||||
size_t i;
|
||||
static const enum state_input cmds[]
|
||||
= { CMD_SEND_HTLC_UPDATE,
|
||||
CMD_SEND_HTLC_COMPLETE,
|
||||
CMD_SEND_HTLC_FULFILL,
|
||||
CMD_SEND_HTLC_TIMEDOUT,
|
||||
CMD_SEND_HTLC_ROUTEFAIL,
|
||||
CMD_CLOSE };
|
||||
|
Loading…
Reference in New Issue
Block a user