Merge pull request #3993 from guggero/unconfirmed-chanbackup

chanbackup: update on-disk backup file with unconfirmed channels
This commit is contained in:
Olaoluwa Osuntokun
2020-03-09 17:18:23 -07:00
committed by GitHub
6 changed files with 212 additions and 52 deletions

View File

@@ -2253,6 +2253,10 @@ func (r *rpcServer) AbandonChannel(ctx context.Context,
return nil, err
}
// Finally, notify the backup listeners that the channel can be removed
// from any channel backups.
r.server.channelNotifier.NotifyClosedChannelEvent(*chanPoint)
return &lnrpc.AbandonChannelResponse{}, nil
}
@@ -5711,7 +5715,7 @@ func (r *rpcServer) SubscribeChannelBackups(req *lnrpc.ChannelBackupSubscription
updateStream lnrpc.Lightning_SubscribeChannelBackupsServer) error {
// First, we'll subscribe to the primary channel notifier so we can
// obtain events for new opened/closed channels.
// obtain events for new pending/opened/closed channels.
chanSubscription, err := r.server.channelNotifier.SubscribeChannelEvents()
if err != nil {
return err
@@ -5728,9 +5732,10 @@ func (r *rpcServer) SubscribeChannelBackups(req *lnrpc.ChannelBackupSubscription
switch e.(type) {
// We only care about new/closed channels, so we'll
// skip any events for pending/active/inactive channels.
case channelnotifier.PendingOpenChannelEvent:
continue
// skip any events for active/inactive channels.
// To make the subscription behave the same way as the
// synchronous call and the file based backup, we also
// include pending channels in the update.
case channelnotifier.ActiveChannelEvent:
continue
case channelnotifier.InactiveChannelEvent: