Browse Source

wallet: Store penalty_bases from openingd and channeld in the DB

nifty/pset-pre
Christian Decker 5 years ago
committed by Rusty Russell
parent
commit
4af1db9ad5
  1. 6
      lightningd/opening_control.c
  2. 3
      lightningd/peer_htlcs.c

6
lightningd/opening_control.c

@ -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);

3
lightningd/peer_htlcs.c

@ -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)));

Loading…
Cancel
Save