coin_mvt: log channel_open for channels that close before they're locked

We don't push out a coin_move for a channel open until it's locked in,
but this causes problems for channels that close before they're locked.

So if we go the "close before locked in" route, we push out a channel
open event.

These will get a blockheight of 0, if we haven't seen the
funding transaction in a block yet.
This commit is contained in:
niftynei
2022-07-19 17:04:38 +09:30
committed by Rusty Russell
parent 91ebddeb78
commit d87bdeeace
4 changed files with 21 additions and 8 deletions

View File

@@ -3,6 +3,7 @@
* saves and funding tx watching for a channel open */
#include "config.h"
#include <bitcoin/short_channel_id.h>
#include <ccan/array_size/array_size.h>
#include <ccan/cast/cast.h>
#include <ccan/mem/mem.h>
@@ -1748,7 +1749,8 @@ static void handle_channel_locked(struct subd *dualopend,
CHANNELD_NORMAL,
REASON_UNKNOWN,
"Lockin complete");
channel_record_open(channel);
channel_record_open(channel,
short_channel_id_blocknum(channel->scid));
/* Empty out the inflights */
wallet_channel_clear_inflights(dualopend->ld->wallet, channel);