peer: Save whenever we change last_was_revoke as well

Pulling up the save call from `peer_save_commitsig_received` into its
caller `peer_got_commitsig` and adding a call to
`peer_sending_commitsig`

Signed-off-by: Christian Decker <decker.christian@gmail.com>
This commit is contained in:
Christian Decker
2018-01-13 15:33:51 +01:00
parent cc77012f63
commit dd599706cd

View File

@@ -918,7 +918,6 @@ static bool peer_save_commitsig_received(struct peer *peer, u64 commitnum,
/* Update peer->last_sig and peer->last_tx before saving to db */
peer_last_tx(peer, tx, commit_sig);
wallet_channel_save(peer->ld->wallet, peer->channel, 0);
return true;
}
@@ -992,10 +991,11 @@ void peer_sending_commitsig(struct peer *peer, const u8 *msg)
if (!peer_save_commitsig_sent(peer, commitnum))
return;
/* Last was commit. FIXME: Save to db. */
/* Last was commit. */
peer->last_was_revoke = false;
tal_free(peer->last_sent_commit);
peer->last_sent_commit = tal_steal(peer, changed_htlcs);
wallet_channel_save(peer->ld->wallet, peer->channel, 0);
/* Tell it we've got it, and to go ahead with commitment_signed. */
subd_send_msg(peer->owner,
@@ -1135,6 +1135,8 @@ void peer_got_commitsig(struct peer *peer, const u8 *msg)
if (!peer_save_commitsig_received(peer, commitnum, tx, &commit_sig))
return;
wallet_channel_save(peer->ld->wallet, peer->channel, 0);
/* FIXME: Put these straight in the db! */
tal_free(peer->last_htlc_sigs);
peer->last_htlc_sigs = tal_steal(peer, htlc_sigs);