mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-03-04 09:48:19 +01:00
lntest: fix flake in channel backup related tests
This commit fixes the channel backup tests by decreasing the recovery window used from 1000 to 100 to speed up the startup of node Dave.
This commit is contained in:
parent
3d7aae42b3
commit
aafe4c38fc
2 changed files with 17 additions and 7 deletions
|
@ -156,7 +156,7 @@ func (nm *nodeManager) restartNode(ctxt context.Context, node *node.HarnessNode,
|
|||
}
|
||||
if len(chanBackups) != 0 {
|
||||
unlockReq.ChannelBackups = chanBackups[0]
|
||||
unlockReq.RecoveryWindow = 1000
|
||||
unlockReq.RecoveryWindow = 100
|
||||
}
|
||||
|
||||
err = wait.NoError(func() error {
|
||||
|
|
|
@ -39,6 +39,10 @@ type (
|
|||
password []byte, mnemonic []string) nodeRestorer
|
||||
)
|
||||
|
||||
// revocationWindow is used when we specify the revocation window used when
|
||||
// restoring node.
|
||||
const revocationWindow = 100
|
||||
|
||||
// chanRestoreScenario represents a test case used by testing the channel
|
||||
// restore methods.
|
||||
type chanRestoreScenario struct {
|
||||
|
@ -309,7 +313,8 @@ func testChannelBackupRestoreBasic(ht *lntemp.HarnessTest) {
|
|||
return func() *node.HarnessNode {
|
||||
return st.RestoreNodeWithSeed(
|
||||
"dave", nil, password, mnemonic,
|
||||
"", 1000, backupSnapshot,
|
||||
"", revocationWindow,
|
||||
backupSnapshot,
|
||||
copyPorts(oldNode),
|
||||
)
|
||||
}
|
||||
|
@ -341,7 +346,7 @@ func testChannelBackupRestoreBasic(ht *lntemp.HarnessTest) {
|
|||
return func() *node.HarnessNode {
|
||||
newNode := st.RestoreNodeWithSeed(
|
||||
"dave", nil, password, mnemonic,
|
||||
"", 1000, nil,
|
||||
"", revocationWindow, nil,
|
||||
copyPorts(oldNode),
|
||||
)
|
||||
|
||||
|
@ -377,7 +382,7 @@ func testChannelBackupRestoreBasic(ht *lntemp.HarnessTest) {
|
|||
return func() *node.HarnessNode {
|
||||
newNode := st.RestoreNodeWithSeed(
|
||||
"dave", nil, password, mnemonic,
|
||||
"", 1000, nil,
|
||||
"", revocationWindow, nil,
|
||||
copyPorts(oldNode),
|
||||
)
|
||||
|
||||
|
@ -665,11 +670,16 @@ func testChannelBackupRestoreLegacy(ht *lntemp.HarnessTest) {
|
|||
func testChannelBackupRestoreForceClose(ht *lntemp.HarnessTest) {
|
||||
// Restore a channel that was force closed by dave just before going
|
||||
// offline.
|
||||
ht.Run("from backup file anchors", func(t *testing.T) {
|
||||
success := ht.Run("from backup file anchors", func(t *testing.T) {
|
||||
st := ht.Subtest(t)
|
||||
runChanRestoreScenarioForceClose(st, false)
|
||||
})
|
||||
|
||||
// Only run the second test if the first passed.
|
||||
if !success {
|
||||
return
|
||||
}
|
||||
|
||||
// Restore a zero-conf anchors channel that was force closed by dave
|
||||
// just before going offline.
|
||||
ht.Run("from backup file anchors w/ zero-conf", func(t *testing.T) {
|
||||
|
@ -1344,8 +1354,8 @@ func chanRestoreViaRPC(ht *lntemp.HarnessTest, password []byte,
|
|||
|
||||
return func() *node.HarnessNode {
|
||||
newNode := ht.RestoreNodeWithSeed(
|
||||
"dave", nil, password, mnemonic, "", 1000, nil,
|
||||
copyPorts(oldNode),
|
||||
"dave", nil, password, mnemonic, "", revocationWindow,
|
||||
nil, copyPorts(oldNode),
|
||||
)
|
||||
req := &lnrpc.RestoreChanBackupRequest{Backup: backup}
|
||||
newNode.RPC.RestoreChanBackups(req)
|
||||
|
|
Loading…
Add table
Reference in a new issue