mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-06-03 19:50:25 +02:00
rpcserver+itest: remove channel from backup when abandoning it
This commit is contained in:
parent
4e0c276154
commit
ab024b98ee
@ -13303,6 +13303,15 @@ func testAbandonChannel(net *lntest.NetworkHarness, t *harnessTest) {
|
|||||||
t.Fatalf("unable to find channel")
|
t.Fatalf("unable to find channel")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// To make sure the channel is removed from the backup file as well when
|
||||||
|
// being abandoned, grab a backup snapshot so we can compare it with the
|
||||||
|
// later state.
|
||||||
|
bkupBefore, err := ioutil.ReadFile(net.Alice.ChanBackupPath())
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("could not get channel backup before abandoning "+
|
||||||
|
"channel: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
// Send request to abandon channel.
|
// Send request to abandon channel.
|
||||||
abandonChannelRequest := &lnrpc.AbandonChannelRequest{
|
abandonChannelRequest := &lnrpc.AbandonChannelRequest{
|
||||||
ChannelPoint: chanPoint,
|
ChannelPoint: chanPoint,
|
||||||
@ -13373,6 +13382,16 @@ func testAbandonChannel(net *lntest.NetworkHarness, t *harnessTest) {
|
|||||||
"graph!")
|
"graph!")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Make sure the channel is no longer in the channel backup list.
|
||||||
|
bkupAfter, err := ioutil.ReadFile(net.Alice.ChanBackupPath())
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("could not get channel backup before abandoning "+
|
||||||
|
"channel: %v", err)
|
||||||
|
}
|
||||||
|
if len(bkupAfter) >= len(bkupBefore) {
|
||||||
|
t.Fatalf("channel wasn't removed from channel backup file")
|
||||||
|
}
|
||||||
|
|
||||||
// Calling AbandonChannel again, should result in no new errors, as the
|
// Calling AbandonChannel again, should result in no new errors, as the
|
||||||
// channel has already been removed.
|
// channel has already been removed.
|
||||||
ctxt, _ = context.WithTimeout(ctxb, defaultTimeout)
|
ctxt, _ = context.WithTimeout(ctxb, defaultTimeout)
|
||||||
|
@ -2254,6 +2254,10 @@ func (r *rpcServer) AbandonChannel(ctx context.Context,
|
|||||||
return nil, err
|
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
|
return &lnrpc.AbandonChannelResponse{}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user