wallet: Store penalty_bases from openingd and channeld in the DB

This commit is contained in:
Christian Decker 2020-05-07 10:19:38 +09:30 committed by Rusty Russell
parent f9dab1e50a
commit 4af1db9ad5
2 changed files with 9 additions and 0 deletions

View File

@ -438,6 +438,9 @@ static void opening_funder_finished(struct subd *openingd, const u8 *resp,
/* Needed for the success statement */
derive_channel_id(&fc->cid, &channel->funding_txid, funding_txout);
if (pbase)
wallet_penalty_base_add(ld->wallet, channel->dbid, pbase);
funding_success(channel);
peer_start_channeld(channel, pps, NULL, false);
@ -543,6 +546,9 @@ static void opening_fundee_finished(struct subd *openingd,
notify_channel_opened(ld, &channel->peer->id, &channel->funding,
&channel->funding_txid, &channel->remote_funding_locked);
if (pbase)
wallet_penalty_base_add(ld->wallet, channel->dbid, pbase);
/* On to normal operation! */
peer_start_channeld(channel, pps, funding_signed, false);

View File

@ -1731,6 +1731,9 @@ void peer_sending_commitsig(struct channel *channel, const u8 *msg)
channel->last_sent_commit = tal_steal(channel, changed_htlcs);
wallet_channel_save(ld->wallet, channel);
if (pbase)
wallet_penalty_base_add(ld->wallet, channel->dbid, pbase);
/* Tell it we've got it, and to go ahead with commitment_signed. */
subd_send_msg(channel->owner,
take(towire_channel_sending_commitsig_reply(msg)));