channel: only delete saved channels from database

There will be 'unsaved' channels now, with a dbid of 0
This commit is contained in:
niftynei 2021-01-19 18:21:45 -06:00 committed by Rusty Russell
parent 99123ddbe4
commit e15de71375

View File

@ -118,7 +118,8 @@ static void destroy_channel(struct channel *channel)
void delete_channel(struct channel *channel STEALS) void delete_channel(struct channel *channel STEALS)
{ {
struct peer *peer = channel->peer; struct peer *peer = channel->peer;
wallet_channel_close(channel->peer->ld->wallet, channel->dbid); if (channel->dbid != 0)
wallet_channel_close(channel->peer->ld->wallet, channel->dbid);
tal_free(channel); tal_free(channel);
maybe_delete_peer(peer); maybe_delete_peer(peer);