coin_mvts: don't overwrite account names we add in onchaind

we assume that every event coming from onchaind is for that channel's
account, but now that we sometimes track external + wallet events from
onchaind, we should only add the channel account name if there's nothing
set there already
This commit is contained in:
niftynei
2021-12-01 09:37:23 -06:00
committed by Rusty Russell
parent 3b3b8fb3ec
commit ade2242d14

View File

@@ -276,8 +276,10 @@ static void handle_onchain_log_coin_move(struct channel *channel, const u8 *msg)
return;
}
mvt->account_name =
type_to_string(mvt, struct channel_id, &channel->cid);
/* Any 'ignored' payments get registed to the wallet */
if (!mvt->account_name)
mvt->account_name = type_to_string(mvt, struct channel_id,
&channel->cid);
notify_chain_mvt(channel->peer->ld, mvt);
tal_free(mvt);
}