|
@ -725,6 +725,7 @@ static struct changed_htlc *changed_htlc_arr(const tal_t *ctx, |
|
|
|
|
|
|
|
|
static u8 *sending_commitsig_msg(const tal_t *ctx, |
|
|
static u8 *sending_commitsig_msg(const tal_t *ctx, |
|
|
u64 remote_commit_index, |
|
|
u64 remote_commit_index, |
|
|
|
|
|
struct penalty_base *pbase, |
|
|
const struct fee_states *fee_states, |
|
|
const struct fee_states *fee_states, |
|
|
const struct htlc **changed_htlcs, |
|
|
const struct htlc **changed_htlcs, |
|
|
const struct bitcoin_signature *commit_sig, |
|
|
const struct bitcoin_signature *commit_sig, |
|
@ -736,9 +737,8 @@ static u8 *sending_commitsig_msg(const tal_t *ctx, |
|
|
/* We tell master what (of our) HTLCs peer will now be
|
|
|
/* We tell master what (of our) HTLCs peer will now be
|
|
|
* committed to. */ |
|
|
* committed to. */ |
|
|
changed = changed_htlc_arr(tmpctx, changed_htlcs); |
|
|
changed = changed_htlc_arr(tmpctx, changed_htlcs); |
|
|
msg = towire_channel_sending_commitsig(ctx, remote_commit_index, |
|
|
msg = towire_channel_sending_commitsig(ctx, remote_commit_index, pbase, fee_states, changed, |
|
|
fee_states, |
|
|
commit_sig, htlc_sigs); |
|
|
changed, commit_sig, htlc_sigs); |
|
|
|
|
|
return msg; |
|
|
return msg; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -930,6 +930,7 @@ static void send_commit(struct peer *peer) |
|
|
const u8 *funding_wscript; |
|
|
const u8 *funding_wscript; |
|
|
const struct htlc **htlc_map; |
|
|
const struct htlc **htlc_map; |
|
|
struct wally_tx_output *direct_outputs[NUM_SIDES]; |
|
|
struct wally_tx_output *direct_outputs[NUM_SIDES]; |
|
|
|
|
|
struct penalty_base *pbase; |
|
|
|
|
|
|
|
|
#if DEVELOPER |
|
|
#if DEVELOPER |
|
|
/* Hack to suppress all commit sends if dev_disconnect says to */ |
|
|
/* Hack to suppress all commit sends if dev_disconnect says to */ |
|
@ -1028,9 +1029,16 @@ static void send_commit(struct peer *peer) |
|
|
calc_commitsigs(tmpctx, peer, txs, funding_wscript, htlc_map, |
|
|
calc_commitsigs(tmpctx, peer, txs, funding_wscript, htlc_map, |
|
|
peer->next_index[REMOTE], &commit_sig); |
|
|
peer->next_index[REMOTE], &commit_sig); |
|
|
|
|
|
|
|
|
|
|
|
if (direct_outputs[LOCAL] != NULL) { |
|
|
|
|
|
pbase = penalty_base_new(tmpctx, peer->next_index[REMOTE], |
|
|
|
|
|
txs[0], direct_outputs[LOCAL]); |
|
|
|
|
|
} else |
|
|
|
|
|
pbase = NULL; |
|
|
|
|
|
|
|
|
status_debug("Telling master we're about to commit..."); |
|
|
status_debug("Telling master we're about to commit..."); |
|
|
/* Tell master to save this next commit to database, then wait. */ |
|
|
/* Tell master to save this next commit to database, then wait. */ |
|
|
msg = sending_commitsig_msg(NULL, peer->next_index[REMOTE], |
|
|
msg = sending_commitsig_msg(NULL, peer->next_index[REMOTE], |
|
|
|
|
|
pbase, |
|
|
peer->channel->fee_states, |
|
|
peer->channel->fee_states, |
|
|
changed_htlcs, |
|
|
changed_htlcs, |
|
|
&commit_sig, |
|
|
&commit_sig, |
|
|