openingd: Return the penalty base after funding completes

This commit is contained in:
Christian Decker
2020-05-07 10:13:42 +09:30
committed by Rusty Russell
parent eb8eabcc3c
commit 30e4443eae
5 changed files with 51 additions and 22 deletions

View File

@@ -11,6 +11,7 @@
#include <common/jsonrpc_errors.h>
#include <common/key_derive.h>
#include <common/param.h>
#include <common/penalty_base.h>
#include <common/per_peer_state.h>
#include <common/utils.h>
#include <common/wallet_tx.h>
@@ -374,6 +375,7 @@ static void opening_funder_finished(struct subd *openingd, const u8 *resp,
struct lightningd *ld = openingd->ld;
u8 *remote_upfront_shutdown_script;
struct per_peer_state *pps;
struct penalty_base *pbase;
/* This is a new channel_info.their_config so set its ID to 0 */
channel_info.their_config.id = 0;
@@ -381,6 +383,7 @@ static void opening_funder_finished(struct subd *openingd, const u8 *resp,
if (!fromwire_opening_funder_reply(resp, resp,
&channel_info.their_config,
&remote_commit,
&pbase,
&remote_commit_sig,
&pps,
&channel_info.theirbase.revocation,
@@ -464,6 +467,7 @@ static void opening_fundee_finished(struct subd *openingd,
struct channel *channel;
u8 *remote_upfront_shutdown_script, *local_upfront_shutdown_script;
struct per_peer_state *pps;
struct penalty_base *pbase;
log_debug(uc->log, "Got opening_fundee_finish_response");
@@ -471,26 +475,27 @@ static void opening_fundee_finished(struct subd *openingd,
channel_info.their_config.id = 0;
if (!fromwire_opening_fundee(tmpctx, reply,
&channel_info.their_config,
&remote_commit,
&remote_commit_sig,
&pps,
&channel_info.theirbase.revocation,
&channel_info.theirbase.payment,
&channel_info.theirbase.htlc,
&channel_info.theirbase.delayed_payment,
&channel_info.remote_per_commit,
&channel_info.remote_fundingkey,
&funding_txid,
&funding_outnum,
&funding,
&push,
&channel_flags,
&feerate,
&funding_signed,
&uc->our_config.channel_reserve,
&local_upfront_shutdown_script,
&remote_upfront_shutdown_script)) {
&channel_info.their_config,
&remote_commit,
&pbase,
&remote_commit_sig,
&pps,
&channel_info.theirbase.revocation,
&channel_info.theirbase.payment,
&channel_info.theirbase.htlc,
&channel_info.theirbase.delayed_payment,
&channel_info.remote_per_commit,
&channel_info.remote_fundingkey,
&funding_txid,
&funding_outnum,
&funding,
&push,
&channel_flags,
&feerate,
&funding_signed,
&uc->our_config.channel_reserve,
&local_upfront_shutdown_script,
&remote_upfront_shutdown_script)) {
log_broken(uc->log, "bad OPENING_FUNDEE_REPLY %s",
tal_hex(reply, reply));
uncommitted_channel_disconnect(uc, LOG_BROKEN,