mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-01-18 05:12:45 +01:00
channel: wire blockheight updates from channeld in to database
This commit is contained in:
parent
265f960cfe
commit
67b8a22aa7
@ -927,6 +927,7 @@ static u8 *sending_commitsig_msg(const tal_t *ctx,
|
||||
u64 remote_commit_index,
|
||||
struct penalty_base *pbase,
|
||||
const struct fee_states *fee_states,
|
||||
const struct height_states *blockheight_states,
|
||||
const struct htlc **changed_htlcs,
|
||||
const struct bitcoin_signature *commit_sig,
|
||||
const struct bitcoin_signature *htlc_sigs)
|
||||
@ -937,8 +938,10 @@ static u8 *sending_commitsig_msg(const tal_t *ctx,
|
||||
/* We tell master what (of our) HTLCs peer will now be
|
||||
* committed to. */
|
||||
changed = changed_htlc_arr(tmpctx, changed_htlcs);
|
||||
msg = towire_channeld_sending_commitsig(ctx, remote_commit_index, pbase, fee_states, changed,
|
||||
commit_sig, htlc_sigs);
|
||||
msg = towire_channeld_sending_commitsig(ctx, remote_commit_index,
|
||||
pbase, fee_states,
|
||||
blockheight_states, changed,
|
||||
commit_sig, htlc_sigs);
|
||||
return msg;
|
||||
}
|
||||
|
||||
@ -1388,6 +1391,7 @@ static void send_commit(struct peer *peer)
|
||||
msg = sending_commitsig_msg(NULL, peer->next_index[REMOTE],
|
||||
pbase,
|
||||
peer->channel->fee_states,
|
||||
peer->channel->blockheight_states,
|
||||
changed_htlcs,
|
||||
&commit_sig,
|
||||
htlc_sigs);
|
||||
@ -1562,6 +1566,7 @@ static void send_revocation(struct peer *peer,
|
||||
= towire_channeld_got_commitsig(NULL,
|
||||
peer->next_index[LOCAL] - 1,
|
||||
peer->channel->fee_states,
|
||||
peer->channel->blockheight_states,
|
||||
commit_sig, htlc_sigs,
|
||||
added,
|
||||
fulfilled,
|
||||
@ -1740,7 +1745,8 @@ static u8 *got_revoke_msg(struct peer *peer, u64 revoke_num,
|
||||
const struct secret *per_commitment_secret,
|
||||
const struct pubkey *next_per_commit_point,
|
||||
const struct htlc **changed_htlcs,
|
||||
const struct fee_states *fee_states)
|
||||
const struct fee_states *fee_states,
|
||||
const struct height_states *blockheight_states)
|
||||
{
|
||||
u8 *msg;
|
||||
struct penalty_base *pbase;
|
||||
@ -1772,7 +1778,8 @@ static u8 *got_revoke_msg(struct peer *peer, u64 revoke_num,
|
||||
|
||||
msg = towire_channeld_got_revoke(peer, revoke_num, per_commitment_secret,
|
||||
next_per_commit_point, fee_states,
|
||||
changed, pbase, ptx);
|
||||
blockheight_states, changed,
|
||||
pbase, ptx);
|
||||
tal_free(ptx);
|
||||
return msg;
|
||||
}
|
||||
@ -1829,7 +1836,8 @@ static void handle_peer_revoke_and_ack(struct peer *peer, const u8 *msg)
|
||||
msg = got_revoke_msg(peer, peer->revocations_received++,
|
||||
&old_commit_secret, &next_per_commit,
|
||||
changed_htlcs,
|
||||
peer->channel->fee_states);
|
||||
peer->channel->fee_states,
|
||||
peer->channel->blockheight_states);
|
||||
master_wait_sync_reply(tmpctx, peer, take(msg),
|
||||
WIRE_CHANNELD_GOT_REVOKE_REPLY);
|
||||
|
||||
|
@ -121,6 +121,7 @@ msgtype,channeld_sending_commitsig,1020
|
||||
msgdata,channeld_sending_commitsig,commitnum,u64,
|
||||
msgdata,channeld_sending_commitsig,pbase,?penalty_base,
|
||||
msgdata,channeld_sending_commitsig,fee_states,fee_states,
|
||||
msgdata,channeld_sending_commitsig,blockheight_states,height_states,
|
||||
# SENT_ADD_COMMIT, SENT_REMOVE_ACK_COMMIT, SENT_ADD_ACK_COMMIT, SENT_REMOVE_COMMIT
|
||||
msgdata,channeld_sending_commitsig,num_changed,u16,
|
||||
msgdata,channeld_sending_commitsig,changed,changed_htlc,num_changed
|
||||
@ -135,6 +136,7 @@ msgtype,channeld_sending_commitsig_reply,1120
|
||||
msgtype,channeld_got_commitsig,1021
|
||||
msgdata,channeld_got_commitsig,commitnum,u64,
|
||||
msgdata,channeld_got_commitsig,fee_states,fee_states,
|
||||
msgdata,channeld_got_commitsig,blockheight_states,height_states,
|
||||
msgdata,channeld_got_commitsig,signature,bitcoin_signature,
|
||||
msgdata,channeld_got_commitsig,num_htlcs,u16,
|
||||
msgdata,channeld_got_commitsig,htlc_signature,bitcoin_signature,num_htlcs
|
||||
@ -162,6 +164,7 @@ msgdata,channeld_got_revoke,per_commitment_secret,secret,
|
||||
msgdata,channeld_got_revoke,next_per_commit_point,pubkey,
|
||||
# RCVD_ADD_ACK_REVOCATION, RCVD_REMOVE_ACK_REVOCATION, RCVD_ADD_REVOCATION, RCVD_REMOVE_REVOCATION
|
||||
msgdata,channeld_got_revoke,fee_states,fee_states,
|
||||
msgdata,channeld_got_revoke,blockheight_states,height_states,
|
||||
msgdata,channeld_got_revoke,num_changed,u16,
|
||||
msgdata,channeld_got_revoke,changed,changed_htlc,num_changed
|
||||
msgdata,channeld_got_revoke,pbase,?penalty_base,
|
||||
|
Can't render this file because it has a wrong number of fields in line 13.
|
20
channeld/channeld_wiregen.c
generated
20
channeld/channeld_wiregen.c
generated
@ -490,7 +490,7 @@ bool fromwire_channeld_got_funding_locked(const void *p, struct pubkey *next_per
|
||||
|
||||
/* WIRE: CHANNELD_SENDING_COMMITSIG */
|
||||
/* When we send a commitment_signed message */
|
||||
u8 *towire_channeld_sending_commitsig(const tal_t *ctx, u64 commitnum, const struct penalty_base *pbase, const struct fee_states *fee_states, const struct changed_htlc *changed, const struct bitcoin_signature *commit_sig, const struct bitcoin_signature *htlc_sigs)
|
||||
u8 *towire_channeld_sending_commitsig(const tal_t *ctx, u64 commitnum, const struct penalty_base *pbase, const struct fee_states *fee_states, const struct height_states *blockheight_states, const struct changed_htlc *changed, const struct bitcoin_signature *commit_sig, const struct bitcoin_signature *htlc_sigs)
|
||||
{
|
||||
u16 num_changed = tal_count(changed);
|
||||
u16 num_htlc_sigs = tal_count(htlc_sigs);
|
||||
@ -505,6 +505,7 @@ u8 *towire_channeld_sending_commitsig(const tal_t *ctx, u64 commitnum, const str
|
||||
towire_penalty_base(&p, pbase);
|
||||
}
|
||||
towire_fee_states(&p, fee_states);
|
||||
towire_height_states(&p, blockheight_states);
|
||||
/* SENT_ADD_COMMIT */
|
||||
towire_u16(&p, num_changed);
|
||||
for (size_t i = 0; i < num_changed; i++)
|
||||
@ -516,7 +517,7 @@ u8 *towire_channeld_sending_commitsig(const tal_t *ctx, u64 commitnum, const str
|
||||
|
||||
return memcheck(p, tal_count(p));
|
||||
}
|
||||
bool fromwire_channeld_sending_commitsig(const tal_t *ctx, const void *p, u64 *commitnum, struct penalty_base **pbase, struct fee_states **fee_states, struct changed_htlc **changed, struct bitcoin_signature *commit_sig, struct bitcoin_signature **htlc_sigs)
|
||||
bool fromwire_channeld_sending_commitsig(const tal_t *ctx, const void *p, u64 *commitnum, struct penalty_base **pbase, struct fee_states **fee_states, struct height_states **blockheight_states, struct changed_htlc **changed, struct bitcoin_signature *commit_sig, struct bitcoin_signature **htlc_sigs)
|
||||
{
|
||||
u16 num_changed;
|
||||
u16 num_htlc_sigs;
|
||||
@ -534,6 +535,7 @@ bool fromwire_channeld_sending_commitsig(const tal_t *ctx, const void *p, u64 *c
|
||||
fromwire_penalty_base(&cursor, &plen, *pbase);
|
||||
}
|
||||
*fee_states = fromwire_fee_states(ctx, &cursor, &plen);
|
||||
*blockheight_states = fromwire_height_states(ctx, &cursor, &plen);
|
||||
/* SENT_ADD_COMMIT */
|
||||
num_changed = fromwire_u16(&cursor, &plen);
|
||||
// 2nd case changed
|
||||
@ -571,7 +573,7 @@ bool fromwire_channeld_sending_commitsig_reply(const void *p)
|
||||
|
||||
/* WIRE: CHANNELD_GOT_COMMITSIG */
|
||||
/* When we have a commitment_signed message */
|
||||
u8 *towire_channeld_got_commitsig(const tal_t *ctx, u64 commitnum, const struct fee_states *fee_states, const struct bitcoin_signature *signature, const struct bitcoin_signature *htlc_signature, const struct added_htlc *added, const struct fulfilled_htlc *fulfilled, const struct failed_htlc **failed, const struct changed_htlc *changed, const struct bitcoin_tx *tx)
|
||||
u8 *towire_channeld_got_commitsig(const tal_t *ctx, u64 commitnum, const struct fee_states *fee_states, const struct height_states *blockheight_states, const struct bitcoin_signature *signature, const struct bitcoin_signature *htlc_signature, const struct added_htlc *added, const struct fulfilled_htlc *fulfilled, const struct failed_htlc **failed, const struct changed_htlc *changed, const struct bitcoin_tx *tx)
|
||||
{
|
||||
u16 num_htlcs = tal_count(htlc_signature);
|
||||
u16 num_added = tal_count(added);
|
||||
@ -583,6 +585,7 @@ u8 *towire_channeld_got_commitsig(const tal_t *ctx, u64 commitnum, const struct
|
||||
towire_u16(&p, WIRE_CHANNELD_GOT_COMMITSIG);
|
||||
towire_u64(&p, commitnum);
|
||||
towire_fee_states(&p, fee_states);
|
||||
towire_height_states(&p, blockheight_states);
|
||||
towire_bitcoin_signature(&p, signature);
|
||||
towire_u16(&p, num_htlcs);
|
||||
for (size_t i = 0; i < num_htlcs; i++)
|
||||
@ -606,7 +609,7 @@ u8 *towire_channeld_got_commitsig(const tal_t *ctx, u64 commitnum, const struct
|
||||
|
||||
return memcheck(p, tal_count(p));
|
||||
}
|
||||
bool fromwire_channeld_got_commitsig(const tal_t *ctx, const void *p, u64 *commitnum, struct fee_states **fee_states, struct bitcoin_signature *signature, struct bitcoin_signature **htlc_signature, struct added_htlc **added, struct fulfilled_htlc **fulfilled, struct failed_htlc ***failed, struct changed_htlc **changed, struct bitcoin_tx **tx)
|
||||
bool fromwire_channeld_got_commitsig(const tal_t *ctx, const void *p, u64 *commitnum, struct fee_states **fee_states, struct height_states **blockheight_states, struct bitcoin_signature *signature, struct bitcoin_signature **htlc_signature, struct added_htlc **added, struct fulfilled_htlc **fulfilled, struct failed_htlc ***failed, struct changed_htlc **changed, struct bitcoin_tx **tx)
|
||||
{
|
||||
u16 num_htlcs;
|
||||
u16 num_added;
|
||||
@ -621,6 +624,7 @@ bool fromwire_channeld_got_commitsig(const tal_t *ctx, const void *p, u64 *commi
|
||||
return false;
|
||||
*commitnum = fromwire_u64(&cursor, &plen);
|
||||
*fee_states = fromwire_fee_states(ctx, &cursor, &plen);
|
||||
*blockheight_states = fromwire_height_states(ctx, &cursor, &plen);
|
||||
fromwire_bitcoin_signature(&cursor, &plen, signature);
|
||||
num_htlcs = fromwire_u16(&cursor, &plen);
|
||||
// 2nd case htlc_signature
|
||||
@ -675,7 +679,7 @@ bool fromwire_channeld_got_commitsig_reply(const void *p)
|
||||
}
|
||||
|
||||
/* WIRE: CHANNELD_GOT_REVOKE */
|
||||
u8 *towire_channeld_got_revoke(const tal_t *ctx, u64 revokenum, const struct secret *per_commitment_secret, const struct pubkey *next_per_commit_point, const struct fee_states *fee_states, const struct changed_htlc *changed, const struct penalty_base *pbase, const struct bitcoin_tx *penalty_tx)
|
||||
u8 *towire_channeld_got_revoke(const tal_t *ctx, u64 revokenum, const struct secret *per_commitment_secret, const struct pubkey *next_per_commit_point, const struct fee_states *fee_states, const struct height_states *blockheight_states, const struct changed_htlc *changed, const struct penalty_base *pbase, const struct bitcoin_tx *penalty_tx)
|
||||
{
|
||||
u16 num_changed = tal_count(changed);
|
||||
u8 *p = tal_arr(ctx, u8, 0);
|
||||
@ -686,6 +690,7 @@ u8 *towire_channeld_got_revoke(const tal_t *ctx, u64 revokenum, const struct sec
|
||||
towire_pubkey(&p, next_per_commit_point);
|
||||
/* RCVD_ADD_ACK_REVOCATION */
|
||||
towire_fee_states(&p, fee_states);
|
||||
towire_height_states(&p, blockheight_states);
|
||||
towire_u16(&p, num_changed);
|
||||
for (size_t i = 0; i < num_changed; i++)
|
||||
towire_changed_htlc(&p, changed + i);
|
||||
@ -704,7 +709,7 @@ u8 *towire_channeld_got_revoke(const tal_t *ctx, u64 revokenum, const struct sec
|
||||
|
||||
return memcheck(p, tal_count(p));
|
||||
}
|
||||
bool fromwire_channeld_got_revoke(const tal_t *ctx, const void *p, u64 *revokenum, struct secret *per_commitment_secret, struct pubkey *next_per_commit_point, struct fee_states **fee_states, struct changed_htlc **changed, struct penalty_base **pbase, struct bitcoin_tx **penalty_tx)
|
||||
bool fromwire_channeld_got_revoke(const tal_t *ctx, const void *p, u64 *revokenum, struct secret *per_commitment_secret, struct pubkey *next_per_commit_point, struct fee_states **fee_states, struct height_states **blockheight_states, struct changed_htlc **changed, struct penalty_base **pbase, struct bitcoin_tx **penalty_tx)
|
||||
{
|
||||
u16 num_changed;
|
||||
|
||||
@ -718,6 +723,7 @@ bool fromwire_channeld_got_revoke(const tal_t *ctx, const void *p, u64 *revokenu
|
||||
fromwire_pubkey(&cursor, &plen, next_per_commit_point);
|
||||
/* RCVD_ADD_ACK_REVOCATION */
|
||||
*fee_states = fromwire_fee_states(ctx, &cursor, &plen);
|
||||
*blockheight_states = fromwire_height_states(ctx, &cursor, &plen);
|
||||
num_changed = fromwire_u16(&cursor, &plen);
|
||||
// 2nd case changed
|
||||
*changed = num_changed ? tal_arr(ctx, struct changed_htlc, num_changed) : NULL;
|
||||
@ -1175,4 +1181,4 @@ bool fromwire_channeld_blockheight(const void *p, u32 *blockheight)
|
||||
*blockheight = fromwire_u32(&cursor, &plen);
|
||||
return cursor != NULL;
|
||||
}
|
||||
// SHA256STAMP:40a8d4ea75d57eeddfb5cc648a9ca3e3914dfe500a6054b6a6942f4023a17d82
|
||||
// SHA256STAMP:977cf1dac7bbca4163cfbbf53f8f448430775368496205ee6f181eb4d8c8c8af
|
||||
|
14
channeld/channeld_wiregen.h
generated
14
channeld/channeld_wiregen.h
generated
@ -129,8 +129,8 @@ bool fromwire_channeld_got_funding_locked(const void *p, struct pubkey *next_per
|
||||
|
||||
/* WIRE: CHANNELD_SENDING_COMMITSIG */
|
||||
/* When we send a commitment_signed message */
|
||||
u8 *towire_channeld_sending_commitsig(const tal_t *ctx, u64 commitnum, const struct penalty_base *pbase, const struct fee_states *fee_states, const struct changed_htlc *changed, const struct bitcoin_signature *commit_sig, const struct bitcoin_signature *htlc_sigs);
|
||||
bool fromwire_channeld_sending_commitsig(const tal_t *ctx, const void *p, u64 *commitnum, struct penalty_base **pbase, struct fee_states **fee_states, struct changed_htlc **changed, struct bitcoin_signature *commit_sig, struct bitcoin_signature **htlc_sigs);
|
||||
u8 *towire_channeld_sending_commitsig(const tal_t *ctx, u64 commitnum, const struct penalty_base *pbase, const struct fee_states *fee_states, const struct height_states *blockheight_states, const struct changed_htlc *changed, const struct bitcoin_signature *commit_sig, const struct bitcoin_signature *htlc_sigs);
|
||||
bool fromwire_channeld_sending_commitsig(const tal_t *ctx, const void *p, u64 *commitnum, struct penalty_base **pbase, struct fee_states **fee_states, struct height_states **blockheight_states, struct changed_htlc **changed, struct bitcoin_signature *commit_sig, struct bitcoin_signature **htlc_sigs);
|
||||
|
||||
/* WIRE: CHANNELD_SENDING_COMMITSIG_REPLY */
|
||||
/* Wait for reply */
|
||||
@ -139,8 +139,8 @@ bool fromwire_channeld_sending_commitsig_reply(const void *p);
|
||||
|
||||
/* WIRE: CHANNELD_GOT_COMMITSIG */
|
||||
/* When we have a commitment_signed message */
|
||||
u8 *towire_channeld_got_commitsig(const tal_t *ctx, u64 commitnum, const struct fee_states *fee_states, const struct bitcoin_signature *signature, const struct bitcoin_signature *htlc_signature, const struct added_htlc *added, const struct fulfilled_htlc *fulfilled, const struct failed_htlc **failed, const struct changed_htlc *changed, const struct bitcoin_tx *tx);
|
||||
bool fromwire_channeld_got_commitsig(const tal_t *ctx, const void *p, u64 *commitnum, struct fee_states **fee_states, struct bitcoin_signature *signature, struct bitcoin_signature **htlc_signature, struct added_htlc **added, struct fulfilled_htlc **fulfilled, struct failed_htlc ***failed, struct changed_htlc **changed, struct bitcoin_tx **tx);
|
||||
u8 *towire_channeld_got_commitsig(const tal_t *ctx, u64 commitnum, const struct fee_states *fee_states, const struct height_states *blockheight_states, const struct bitcoin_signature *signature, const struct bitcoin_signature *htlc_signature, const struct added_htlc *added, const struct fulfilled_htlc *fulfilled, const struct failed_htlc **failed, const struct changed_htlc *changed, const struct bitcoin_tx *tx);
|
||||
bool fromwire_channeld_got_commitsig(const tal_t *ctx, const void *p, u64 *commitnum, struct fee_states **fee_states, struct height_states **blockheight_states, struct bitcoin_signature *signature, struct bitcoin_signature **htlc_signature, struct added_htlc **added, struct fulfilled_htlc **fulfilled, struct failed_htlc ***failed, struct changed_htlc **changed, struct bitcoin_tx **tx);
|
||||
|
||||
/* WIRE: CHANNELD_GOT_COMMITSIG_REPLY */
|
||||
/* Wait for reply */
|
||||
@ -148,8 +148,8 @@ u8 *towire_channeld_got_commitsig_reply(const tal_t *ctx);
|
||||
bool fromwire_channeld_got_commitsig_reply(const void *p);
|
||||
|
||||
/* WIRE: CHANNELD_GOT_REVOKE */
|
||||
u8 *towire_channeld_got_revoke(const tal_t *ctx, u64 revokenum, const struct secret *per_commitment_secret, const struct pubkey *next_per_commit_point, const struct fee_states *fee_states, const struct changed_htlc *changed, const struct penalty_base *pbase, const struct bitcoin_tx *penalty_tx);
|
||||
bool fromwire_channeld_got_revoke(const tal_t *ctx, const void *p, u64 *revokenum, struct secret *per_commitment_secret, struct pubkey *next_per_commit_point, struct fee_states **fee_states, struct changed_htlc **changed, struct penalty_base **pbase, struct bitcoin_tx **penalty_tx);
|
||||
u8 *towire_channeld_got_revoke(const tal_t *ctx, u64 revokenum, const struct secret *per_commitment_secret, const struct pubkey *next_per_commit_point, const struct fee_states *fee_states, const struct height_states *blockheight_states, const struct changed_htlc *changed, const struct penalty_base *pbase, const struct bitcoin_tx *penalty_tx);
|
||||
bool fromwire_channeld_got_revoke(const tal_t *ctx, const void *p, u64 *revokenum, struct secret *per_commitment_secret, struct pubkey *next_per_commit_point, struct fee_states **fee_states, struct height_states **blockheight_states, struct changed_htlc **changed, struct penalty_base **pbase, struct bitcoin_tx **penalty_tx);
|
||||
|
||||
/* WIRE: CHANNELD_GOT_REVOKE_REPLY */
|
||||
/* Wait for reply */
|
||||
@ -240,4 +240,4 @@ bool fromwire_channeld_blockheight(const void *p, u32 *blockheight);
|
||||
|
||||
|
||||
#endif /* LIGHTNING_CHANNELD_CHANNELD_WIREGEN_H */
|
||||
// SHA256STAMP:40a8d4ea75d57eeddfb5cc648a9ca3e3914dfe500a6054b6a6942f4023a17d82
|
||||
// SHA256STAMP:977cf1dac7bbca4163cfbbf53f8f448430775368496205ee6f181eb4d8c8c8af
|
||||
|
@ -161,6 +161,12 @@ u32 channel_feerate(const struct channel *channel, enum side side)
|
||||
return get_feerate(channel->fee_states, channel->opener, side);
|
||||
}
|
||||
|
||||
u32 channel_blockheight(const struct channel *channel, enum side side)
|
||||
{
|
||||
return get_blockheight(channel->blockheight_states,
|
||||
channel->opener, side);
|
||||
}
|
||||
|
||||
#if EXPERIMENTAL_FEATURES
|
||||
/* BOLT-upgrade_protocol #2:
|
||||
* Channel features are explicitly enumerated as `channel_type` bitfields,
|
||||
|
@ -151,6 +151,13 @@ struct bitcoin_tx *initial_channel_tx(const tal_t *ctx,
|
||||
*/
|
||||
u32 channel_feerate(const struct channel *channel, enum side side);
|
||||
|
||||
/**
|
||||
* channel_blockheight: Get blockheight for this side of channel.
|
||||
* @channel: The channel
|
||||
* @side: the side
|
||||
*/
|
||||
u32 channel_blockheight(const struct channel *channel, enum side side);
|
||||
|
||||
#if EXPERIMENTAL_FEATURES
|
||||
/* BOLT-upgrade_protocol #2:
|
||||
* Channel features are explicitly enumerated as `channel_type` bitfields,
|
||||
|
@ -1736,6 +1736,7 @@ void peer_sending_commitsig(struct channel *channel, const u8 *msg)
|
||||
{
|
||||
u64 commitnum;
|
||||
struct fee_states *fee_states;
|
||||
struct height_states *blockheight_states;
|
||||
struct changed_htlc *changed_htlcs;
|
||||
size_t i, maxid = 0, num_local_added = 0;
|
||||
struct bitcoin_signature commit_sig;
|
||||
@ -1747,9 +1748,11 @@ void peer_sending_commitsig(struct channel *channel, const u8 *msg)
|
||||
&commitnum,
|
||||
&pbase,
|
||||
&fee_states,
|
||||
&blockheight_states,
|
||||
&changed_htlcs,
|
||||
&commit_sig, &htlc_sigs)
|
||||
|| !fee_states_valid(fee_states, channel->opener)) {
|
||||
|| !fee_states_valid(fee_states, channel->opener)
|
||||
|| !height_states_valid(blockheight_states, channel->opener)) {
|
||||
channel_internal_error(channel, "bad channel_sending_commitsig %s",
|
||||
tal_hex(channel, msg));
|
||||
return;
|
||||
@ -1792,6 +1795,9 @@ void peer_sending_commitsig(struct channel *channel, const u8 *msg)
|
||||
channel->opener,
|
||||
REMOTE));
|
||||
|
||||
tal_free(channel->blockheight_states);
|
||||
channel->blockheight_states = tal_steal(channel, blockheight_states);
|
||||
|
||||
if (!peer_save_commitsig_sent(channel, commitnum))
|
||||
return;
|
||||
|
||||
@ -1927,6 +1933,7 @@ void peer_got_commitsig(struct channel *channel, const u8 *msg)
|
||||
{
|
||||
u64 commitnum;
|
||||
struct fee_states *fee_states;
|
||||
struct height_states *blockheight_states;
|
||||
struct bitcoin_signature commit_sig, *htlc_sigs;
|
||||
struct added_htlc *added;
|
||||
struct fulfilled_htlc *fulfilled;
|
||||
@ -1939,6 +1946,7 @@ void peer_got_commitsig(struct channel *channel, const u8 *msg)
|
||||
if (!fromwire_channeld_got_commitsig(msg, msg,
|
||||
&commitnum,
|
||||
&fee_states,
|
||||
&blockheight_states,
|
||||
&commit_sig,
|
||||
&htlc_sigs,
|
||||
&added,
|
||||
@ -1946,7 +1954,8 @@ void peer_got_commitsig(struct channel *channel, const u8 *msg)
|
||||
&failed,
|
||||
&changed,
|
||||
&tx)
|
||||
|| !fee_states_valid(fee_states, channel->opener)) {
|
||||
|| !fee_states_valid(fee_states, channel->opener)
|
||||
|| !height_states_valid(blockheight_states, channel->opener)) {
|
||||
channel_internal_error(channel,
|
||||
"bad fromwire_channeld_got_commitsig %s",
|
||||
tal_hex(channel, msg));
|
||||
@ -1975,8 +1984,9 @@ void peer_got_commitsig(struct channel *channel, const u8 *msg)
|
||||
|
||||
log_debug(channel->log,
|
||||
"got commitsig %"PRIu64
|
||||
": feerate %u, %zu added, %zu fulfilled, %zu failed, %zu changed",
|
||||
": feerate %u, blockheight: %u, %zu added, %zu fulfilled, %zu failed, %zu changed",
|
||||
commitnum, get_feerate(fee_states, channel->opener, LOCAL),
|
||||
get_blockheight(blockheight_states, channel->opener, LOCAL),
|
||||
tal_count(added), tal_count(fulfilled),
|
||||
tal_count(failed), tal_count(changed));
|
||||
|
||||
@ -2011,6 +2021,8 @@ void peer_got_commitsig(struct channel *channel, const u8 *msg)
|
||||
get_feerate(fee_states,
|
||||
channel->opener,
|
||||
LOCAL));
|
||||
tal_free(channel->blockheight_states);
|
||||
channel->blockheight_states = tal_steal(channel, blockheight_states);
|
||||
|
||||
/* Since we're about to send revoke, bump state again. */
|
||||
if (!peer_sending_revocation(channel, added, fulfilled, failed, changed))
|
||||
@ -2087,6 +2099,7 @@ void peer_got_revoke(struct channel *channel, const u8 *msg)
|
||||
size_t i;
|
||||
struct lightningd *ld = channel->peer->ld;
|
||||
struct fee_states *fee_states;
|
||||
struct height_states *blockheight_states;
|
||||
struct penalty_base *pbase;
|
||||
struct commitment_revocation_payload *payload;
|
||||
struct bitcoin_tx *penalty_tx;
|
||||
@ -2095,10 +2108,12 @@ void peer_got_revoke(struct channel *channel, const u8 *msg)
|
||||
&revokenum, &per_commitment_secret,
|
||||
&next_per_commitment_point,
|
||||
&fee_states,
|
||||
&blockheight_states,
|
||||
&changed,
|
||||
&pbase,
|
||||
&penalty_tx)
|
||||
|| !fee_states_valid(fee_states, channel->opener)) {
|
||||
|| !fee_states_valid(fee_states, channel->opener)
|
||||
|| !height_states_valid(blockheight_states, channel->opener)) {
|
||||
channel_internal_error(channel, "bad fromwire_channeld_got_revoke %s",
|
||||
tal_hex(channel, msg));
|
||||
return;
|
||||
@ -2161,6 +2176,9 @@ void peer_got_revoke(struct channel *channel, const u8 *msg)
|
||||
tal_free(channel->fee_states);
|
||||
channel->fee_states = tal_steal(channel, fee_states);
|
||||
|
||||
tal_free(channel->blockheight_states);
|
||||
channel->blockheight_states = tal_steal(channel, blockheight_states);
|
||||
|
||||
/* FIXME: Check per_commitment_secret -> per_commit_point */
|
||||
update_per_commit_point(channel, &next_per_commitment_point);
|
||||
|
||||
|
@ -810,7 +810,7 @@ def test_penalty_htlc_tx_fulfill(node_factory, bitcoind, chainparams):
|
||||
|
||||
# reconnect with l1, which will fulfill the payment
|
||||
l2.rpc.connect(l1.info['id'], 'localhost', l1.port)
|
||||
l2.daemon.wait_for_log('got commitsig .*: feerate 11000, 0 added, 1 fulfilled, 0 failed, 0 changed')
|
||||
l2.daemon.wait_for_log('got commitsig .*: feerate 11000, blockheight: 0, 0 added, 1 fulfilled, 0 failed, 0 changed')
|
||||
l2.daemon.wait_for_log('coins payment_hash: {}'.format(sticky_inv['payment_hash']))
|
||||
|
||||
# l2 moves on for closed l3
|
||||
@ -966,7 +966,7 @@ def test_penalty_htlc_tx_timeout(node_factory, bitcoind, chainparams):
|
||||
|
||||
# reconnect with l1, which will fulfill the payment
|
||||
l2.rpc.connect(l1.info['id'], 'localhost', l1.port)
|
||||
l2.daemon.wait_for_log('got commitsig .*: feerate 11000, 0 added, 1 fulfilled, 0 failed, 0 changed')
|
||||
l2.daemon.wait_for_log('got commitsig .*: feerate 11000, blockheight: 0, 0 added, 1 fulfilled, 0 failed, 0 changed')
|
||||
l2.daemon.wait_for_log('coins payment_hash: {}'.format(sticky_inv_2['payment_hash']))
|
||||
|
||||
# l2 moves on for closed l3
|
||||
|
2
wallet/db_postgres_sqlgen.c
generated
2
wallet/db_postgres_sqlgen.c
generated
@ -2014,4 +2014,4 @@ struct db_query db_postgres_queries[] = {
|
||||
|
||||
#endif /* LIGHTNINGD_WALLET_GEN_DB_POSTGRES */
|
||||
|
||||
// SHA256STAMP:1778bd4f49bef247c2b4789d1f7db3542fd606cbe186e299738aecbfbb2d44ae
|
||||
// SHA256STAMP:aa315b69d7586fe52d3f224d87db05201c9582ff9cacdb31b5e94a0287ec7e95
|
||||
|
2
wallet/db_sqlite3_sqlgen.c
generated
2
wallet/db_sqlite3_sqlgen.c
generated
@ -2014,4 +2014,4 @@ struct db_query db_sqlite3_queries[] = {
|
||||
|
||||
#endif /* LIGHTNINGD_WALLET_GEN_DB_SQLITE3 */
|
||||
|
||||
// SHA256STAMP:1778bd4f49bef247c2b4789d1f7db3542fd606cbe186e299738aecbfbb2d44ae
|
||||
// SHA256STAMP:aa315b69d7586fe52d3f224d87db05201c9582ff9cacdb31b5e94a0287ec7e95
|
||||
|
2
wallet/statements_gettextgen.po
generated
2
wallet/statements_gettextgen.po
generated
@ -1329,4 +1329,4 @@ msgstr ""
|
||||
#: wallet/test/run-wallet.c:1696
|
||||
msgid "INSERT INTO channels (id) VALUES (1);"
|
||||
msgstr ""
|
||||
# SHA256STAMP:03557959b260db89fed45406e7fae168e0ce9810b47351f22bbd8741a2910898
|
||||
# SHA256STAMP:0867158b98125b1f5cb273f3e8fcc8bcac21f4a8b06032fb86a6ee1c34427ab2
|
||||
|
@ -132,16 +132,16 @@ bool feature_offered(const u8 *features UNNEEDED, size_t f UNNEEDED)
|
||||
bool fromwire_channeld_dev_memleak_reply(const void *p UNNEEDED, bool *leak UNNEEDED)
|
||||
{ fprintf(stderr, "fromwire_channeld_dev_memleak_reply called!\n"); abort(); }
|
||||
/* Generated stub for fromwire_channeld_got_commitsig */
|
||||
bool fromwire_channeld_got_commitsig(const tal_t *ctx UNNEEDED, const void *p UNNEEDED, u64 *commitnum UNNEEDED, struct fee_states **fee_states UNNEEDED, struct bitcoin_signature *signature UNNEEDED, struct bitcoin_signature **htlc_signature UNNEEDED, struct added_htlc **added UNNEEDED, struct fulfilled_htlc **fulfilled UNNEEDED, struct failed_htlc ***failed UNNEEDED, struct changed_htlc **changed UNNEEDED, struct bitcoin_tx **tx UNNEEDED)
|
||||
bool fromwire_channeld_got_commitsig(const tal_t *ctx UNNEEDED, const void *p UNNEEDED, u64 *commitnum UNNEEDED, struct fee_states **fee_states UNNEEDED, struct height_states **blockheight_states UNNEEDED, struct bitcoin_signature *signature UNNEEDED, struct bitcoin_signature **htlc_signature UNNEEDED, struct added_htlc **added UNNEEDED, struct fulfilled_htlc **fulfilled UNNEEDED, struct failed_htlc ***failed UNNEEDED, struct changed_htlc **changed UNNEEDED, struct bitcoin_tx **tx UNNEEDED)
|
||||
{ fprintf(stderr, "fromwire_channeld_got_commitsig called!\n"); abort(); }
|
||||
/* Generated stub for fromwire_channeld_got_revoke */
|
||||
bool fromwire_channeld_got_revoke(const tal_t *ctx UNNEEDED, const void *p UNNEEDED, u64 *revokenum UNNEEDED, struct secret *per_commitment_secret UNNEEDED, struct pubkey *next_per_commit_point UNNEEDED, struct fee_states **fee_states UNNEEDED, struct changed_htlc **changed UNNEEDED, struct penalty_base **pbase UNNEEDED, struct bitcoin_tx **penalty_tx UNNEEDED)
|
||||
bool fromwire_channeld_got_revoke(const tal_t *ctx UNNEEDED, const void *p UNNEEDED, u64 *revokenum UNNEEDED, struct secret *per_commitment_secret UNNEEDED, struct pubkey *next_per_commit_point UNNEEDED, struct fee_states **fee_states UNNEEDED, struct height_states **blockheight_states UNNEEDED, struct changed_htlc **changed UNNEEDED, struct penalty_base **pbase UNNEEDED, struct bitcoin_tx **penalty_tx UNNEEDED)
|
||||
{ fprintf(stderr, "fromwire_channeld_got_revoke called!\n"); abort(); }
|
||||
/* Generated stub for fromwire_channeld_offer_htlc_reply */
|
||||
bool fromwire_channeld_offer_htlc_reply(const tal_t *ctx UNNEEDED, const void *p UNNEEDED, u64 *id UNNEEDED, u8 **failuremsg UNNEEDED, wirestring **failurestr UNNEEDED)
|
||||
{ fprintf(stderr, "fromwire_channeld_offer_htlc_reply called!\n"); abort(); }
|
||||
/* Generated stub for fromwire_channeld_sending_commitsig */
|
||||
bool fromwire_channeld_sending_commitsig(const tal_t *ctx UNNEEDED, const void *p UNNEEDED, u64 *commitnum UNNEEDED, struct penalty_base **pbase UNNEEDED, struct fee_states **fee_states UNNEEDED, struct changed_htlc **changed UNNEEDED, struct bitcoin_signature *commit_sig UNNEEDED, struct bitcoin_signature **htlc_sigs UNNEEDED)
|
||||
bool fromwire_channeld_sending_commitsig(const tal_t *ctx UNNEEDED, const void *p UNNEEDED, u64 *commitnum UNNEEDED, struct penalty_base **pbase UNNEEDED, struct fee_states **fee_states UNNEEDED, struct height_states **blockheight_states UNNEEDED, struct changed_htlc **changed UNNEEDED, struct bitcoin_signature *commit_sig UNNEEDED, struct bitcoin_signature **htlc_sigs UNNEEDED)
|
||||
{ fprintf(stderr, "fromwire_channeld_sending_commitsig called!\n"); abort(); }
|
||||
/* Generated stub for fromwire_connectd_peer_connected */
|
||||
bool fromwire_connectd_peer_connected(const tal_t *ctx UNNEEDED, const void *p UNNEEDED, struct node_id *id UNNEEDED, struct wireaddr_internal *addr UNNEEDED, bool *incoming UNNEEDED, struct per_peer_state **pps UNNEEDED, u8 **features UNNEEDED)
|
||||
|
Loading…
Reference in New Issue
Block a user