mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-06-26 08:41:02 +02:00
itest: fix anchor SCB sweep tests
Fixes another flake related to Neutrino and how it handles UTXOs.
This commit is contained in:
parent
f68335d7e4
commit
6421fd532c
@ -1305,7 +1305,6 @@ func assertDLPExecuted(net *lntest.NetworkHarness, t *harnessTest,
|
|||||||
|
|
||||||
// Dave should sweep his funds immediately, as they are not timelocked.
|
// Dave should sweep his funds immediately, as they are not timelocked.
|
||||||
// We also expect Dave to sweep his anchor, if present.
|
// We also expect Dave to sweep his anchor, if present.
|
||||||
|
|
||||||
_, err = waitForNTxsInMempool(
|
_, err = waitForNTxsInMempool(
|
||||||
net.Miner.Client, expectedTxes, minerMempoolTimeout,
|
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.
|
// After the Carol's output matures, she should also reclaim her funds.
|
||||||
//
|
//
|
||||||
// The commit sweep resolver publishes the sweep tx at defaultCSV-1 and
|
// 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.
|
// take that into account.
|
||||||
mineBlocks(t, net, defaultCSV-1-1, 0)
|
mineBlocks(t, net, defaultCSV-1-1, 0)
|
||||||
carolSweep, err := waitForTxInMempool(
|
carolSweep, err := waitForTxInMempool(
|
||||||
@ -1363,6 +1362,16 @@ func assertDLPExecuted(net *lntest.NetworkHarness, t *harnessTest,
|
|||||||
}
|
}
|
||||||
|
|
||||||
carolBalance := carolBalResp.ConfirmedBalance
|
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 {
|
if carolBalance <= carolStartingBalance {
|
||||||
return fmt.Errorf("expected carol to have balance "+
|
return fmt.Errorf("expected carol to have balance "+
|
||||||
"above %d, instead had %v", carolStartingBalance,
|
"above %d, instead had %v", carolStartingBalance,
|
||||||
|
@ -847,6 +847,12 @@ func testChanRestoreScenario(t *harnessTest, net *lntest.NetworkHarness,
|
|||||||
ctxt, _ := context.WithTimeout(ctxb, defaultTimeout)
|
ctxt, _ := context.WithTimeout(ctxb, defaultTimeout)
|
||||||
net.SendCoins(ctxt, t.t, btcutil.SatoshiPerBitcoin, carol)
|
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)
|
ctxt, _ = context.WithTimeout(ctxb, defaultTimeout)
|
||||||
net.SendCoins(ctxt, t.t, btcutil.SatoshiPerBitcoin, dave)
|
net.SendCoins(ctxt, t.t, btcutil.SatoshiPerBitcoin, dave)
|
||||||
|
|
||||||
@ -1077,6 +1083,12 @@ func testChanRestoreScenario(t *harnessTest, net *lntest.NetworkHarness,
|
|||||||
err = restartCarol()
|
err = restartCarol()
|
||||||
require.NoError(t.t, err)
|
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
|
// Now that we have our new node up, we expect that it'll re-connect to
|
||||||
// Carol automatically based on the restored backup.
|
// Carol automatically based on the restored backup.
|
||||||
ctxt, _ = context.WithTimeout(ctxb, defaultTimeout)
|
ctxt, _ = context.WithTimeout(ctxb, defaultTimeout)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user