diff --git a/lntest/itest/assertions.go b/lntest/itest/assertions.go index c22b8f3fc..1df8e812e 100644 --- a/lntest/itest/assertions.go +++ b/lntest/itest/assertions.go @@ -1305,7 +1305,6 @@ func assertDLPExecuted(net *lntest.NetworkHarness, t *harnessTest, // Dave should sweep his funds immediately, as they are not timelocked. // We also expect Dave to sweep his anchor, if present. - _, err = waitForNTxsInMempool( net.Miner.Client, expectedTxes, minerMempoolTimeout, ) @@ -1341,7 +1340,7 @@ func assertDLPExecuted(net *lntest.NetworkHarness, t *harnessTest, // After the Carol's output matures, she should also reclaim her funds. // // The commit sweep resolver publishes the sweep tx at defaultCSV-1 and - // we already mined one block after the commitmment was published, so + // we already mined one block after the commitment was published, so // take that into account. mineBlocks(t, net, defaultCSV-1-1, 0) carolSweep, err := waitForTxInMempool( @@ -1363,6 +1362,16 @@ func assertDLPExecuted(net *lntest.NetworkHarness, t *harnessTest, } carolBalance := carolBalResp.ConfirmedBalance + + // With Neutrino we don't get a backend error when trying to + // publish an orphan TX (which is what the sweep for the remote + // anchor is since the remote commitment TX was not broadcast). + // That's why the wallet still sees that as unconfirmed and we + // need to count the total balance instead of the confirmed. + if net.BackendCfg.Name() == lntest.NeutrinoBackendName { + carolBalance = carolBalResp.TotalBalance + } + if carolBalance <= carolStartingBalance { return fmt.Errorf("expected carol to have balance "+ "above %d, instead had %v", carolStartingBalance, diff --git a/lntest/itest/lnd_channel_backup_test.go b/lntest/itest/lnd_channel_backup_test.go index 89558dcb3..4c383bcb0 100644 --- a/lntest/itest/lnd_channel_backup_test.go +++ b/lntest/itest/lnd_channel_backup_test.go @@ -847,6 +847,12 @@ func testChanRestoreScenario(t *harnessTest, net *lntest.NetworkHarness, ctxt, _ := context.WithTimeout(ctxb, defaultTimeout) net.SendCoins(ctxt, t.t, btcutil.SatoshiPerBitcoin, carol) + // For the anchor output case we need two UTXOs for Carol so she can + // sweep both the local and remote anchor. + if testCase.anchorCommit { + net.SendCoins(ctxt, t.t, btcutil.SatoshiPerBitcoin, carol) + } + ctxt, _ = context.WithTimeout(ctxb, defaultTimeout) net.SendCoins(ctxt, t.t, btcutil.SatoshiPerBitcoin, dave) @@ -1077,6 +1083,12 @@ func testChanRestoreScenario(t *harnessTest, net *lntest.NetworkHarness, err = restartCarol() require.NoError(t.t, err) + numUTXOs := 1 + if testCase.anchorCommit { + numUTXOs = 2 + } + assertNumUTXOs(t.t, carol, numUTXOs) + // Now that we have our new node up, we expect that it'll re-connect to // Carol automatically based on the restored backup. ctxt, _ = context.WithTimeout(ctxb, defaultTimeout)