Skip to content

Commit

Permalink
itest: test channel.backup changes upon shutdown
Browse files Browse the repository at this point in the history
  • Loading branch information
starius committed Oct 11, 2024
1 parent d9580ab commit 30ce984
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions itest/lnd_channel_backup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -786,8 +786,22 @@ func runChanRestoreScenarioForceClose(ht *lntest.HarnessTest, zeroConf bool) {
ht.AssertNumTxsInMempool(1)

// Now that we're able to make our restored now, we'll shutdown the old
// Dave node as we'll be storing it shortly below.
ht.Shutdown(dave)
// Dave node as we'll be storing it shortly below. Use SuspendNode, not
// Shutdown to keep its directory including channel.backup file.
ht.SuspendNode(dave)

// Read Dave's channel.backup file again to make sure it was updated
// upon Dave's shutdown. In case LND state is lost and DLP protocol
// fails, the channel.backup file and the commit tx in it are the
// measure of last resort to recover funds from the channel. The file
// is updated upon LND server shutdown to update the commit tx just in
// case it is used this way. If an outdated commit tx is broadcasted,
// the funds may be lost in a justice transaction. The file is encrypted
// and we can't decrypt it here, so we just check that the content of
// the file has changed.
multi2, err := os.ReadFile(backupFilePath)
require.NoError(ht, err)
require.NotEqual(ht, multi, multi2)

// Mine a block to confirm the closing tx from Dave.
ht.MineBlocksAndAssertNumTxes(1, 1)
Expand Down

0 comments on commit 30ce984

Please sign in to comment.