onchaind: see closes when wrong_funding shutdowns are used.

Fairly easy to do, though we also have to add the watch when we load
from the database.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2021-03-16 06:56:13 +10:30
parent b62706aa01
commit a1b43a3653
4 changed files with 20 additions and 3 deletions

View File

@@ -264,6 +264,9 @@ static void peer_got_shutdown(struct channel *channel, const u8 *msg)
if (!channel->shutdown_wrong_funding)
channel->shutdown_wrong_funding = wrong_funding;
/* We now watch the "wrong" funding, in case we spend it. */
channel_watch_wrong_funding(ld, channel);
/* TODO(cdecker) Selectively save updated fields to DB */
wallet_channel_save(ld->wallet, channel);
}