diff --git a/channeld/channeld.c b/channeld/channeld.c index a2ee13dec561..611373ab4ea5 100644 --- a/channeld/channeld.c +++ b/channeld/channeld.c @@ -1517,6 +1517,7 @@ static u8 *send_commit_part(struct peer *peer, peer->channel, &peer->remote_per_commit, peer->next_index[REMOTE], REMOTE, splice_amnt, remote_splice_amnt); + htlc_sigs = calc_commitsigs(tmpctx, peer, txs, funding_wscript, htlc_map, peer->next_index[REMOTE], &commit_sig); @@ -3450,6 +3451,39 @@ static struct inflight *inflights_new(struct peer *peer) return inf; } +static void update_hsmd_with_splice(struct peer *peer, struct inflight *inflight) +{ + u8 *msg; + + // These aren't allowed to change, so we don't need to gather them + u8 *local_upfront_shutdown_script = NULL; + u32 * local_upfront_shutdown_wallet_index = NULL; + u8 *remote_upfront_shutdown_script = NULL; + + // FIXME - the push_value needs to reflect what is owed to the non-opener + struct amount_msat push_value = AMOUNT_MSAT(0); + + msg = towire_hsmd_ready_channel( + NULL, + peer->channel->opener == LOCAL, + inflight->amnt, + push_value, + &inflight->outpoint.txid, + inflight->outpoint.n, + peer->channel->config[LOCAL].to_self_delay, + local_upfront_shutdown_script, + local_upfront_shutdown_wallet_index, + &peer->channel->basepoints[REMOTE], + &peer->channel->funding_pubkey[REMOTE], + peer->channel->config[REMOTE].to_self_delay, + remote_upfront_shutdown_script, + peer->channel->type); + msg = (u8 *) hsm_req(tmpctx, take(msg)); + if (!fromwire_hsmd_ready_channel_reply(msg)) + status_failed(STATUS_FAIL_HSM_IO, "Bad ready_channel_reply %s", + tal_hex(tmpctx, msg)); +} + /* ACCEPTER side of the splice. Here we handle all the accepter's steps for the * splice. Since the channel must be in STFU mode we block the daemon here until * the splice is finished or aborted. */ @@ -3586,6 +3620,8 @@ static void splice_accepter(struct peer *peer, const u8 *inmsg) new_inflight->last_tx = NULL; new_inflight->i_am_initiator = false; + update_hsmd_with_splice(peer, new_inflight); + update_view_from_inflights(peer); peer->splice_state->count++; @@ -3820,6 +3856,8 @@ static void splice_initiator_user_finalized(struct peer *peer) new_inflight->last_tx = NULL; new_inflight->i_am_initiator = true; + update_hsmd_with_splice(peer, new_inflight); + update_view_from_inflights(peer); peer->splice_state->count++;