mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-01-19 05:45:21 +01:00
Merge pull request #5905 from guggero/itest-fixes
itest: fix two flakes
This commit is contained in:
commit
b99157efbe
@ -462,6 +462,9 @@ messages directly. There is no routing/path finding involved.
|
||||
|
||||
* [Run channeldb tests on postgres](https://github.com/lightningnetwork/lnd/pull/5550)
|
||||
|
||||
* [Fixed two flakes in itests that were caused by things progressing too
|
||||
fast](https://github.com/lightningnetwork/lnd/pull/5905).
|
||||
|
||||
## Database
|
||||
|
||||
* [Ensure single writer for legacy
|
||||
|
@ -1615,7 +1615,9 @@ func (n *NetworkHarness) sendCoins(amt btcutil.Amount, target *HarnessNode,
|
||||
return err
|
||||
}
|
||||
|
||||
expectedBalance := btcutil.Amount(initialBalance.ConfirmedBalance) + amt
|
||||
fullInitialBalance := initialBalance.ConfirmedBalance +
|
||||
initialBalance.UnconfirmedBalance
|
||||
expectedBalance := btcutil.Amount(fullInitialBalance) + amt
|
||||
return target.WaitForBalance(expectedBalance, true)
|
||||
}
|
||||
|
||||
|
@ -209,8 +209,7 @@ func testAnchorReservedValue(net *lntest.NetworkHarness, t *harnessTest) {
|
||||
// Alice opens a smaller channel. This works since it will have a
|
||||
// change output.
|
||||
aliceChanPoint1 := openChannelAndAssert(
|
||||
t, net, alice, bob,
|
||||
lntest.OpenChannelParams{
|
||||
t, net, alice, bob, lntest.OpenChannelParams{
|
||||
Amt: chanAmt / 4,
|
||||
},
|
||||
)
|
||||
@ -326,7 +325,7 @@ func testAnchorReservedValue(net *lntest.NetworkHarness, t *harnessTest) {
|
||||
block = mineBlocks(t, net, 1, 1)[0]
|
||||
|
||||
// The sweep transaction should have exactly one inputs as we only had
|
||||
// the the single output from above in the wallet.
|
||||
// the single output from above in the wallet.
|
||||
sweepTx = block.Transactions[1]
|
||||
if len(sweepTx.TxIn) != 1 {
|
||||
t.Fatalf("expected 1 inputs instead have %v", len(sweepTx.TxIn))
|
||||
@ -352,9 +351,12 @@ func testAnchorReservedValue(net *lntest.NetworkHarness, t *harnessTest) {
|
||||
t.Fatalf("Alice's balance did not increase after channel close")
|
||||
}
|
||||
|
||||
// Assert there are no open or pending channels anymore.
|
||||
assertNumPendingChannels(t, alice, 0, 0)
|
||||
assertNodeNumChannels(t, alice, 0)
|
||||
|
||||
// We'll wait for the balance to reflect that the channel has been
|
||||
// closed and the funds are in the wallet.
|
||||
|
||||
sweepReq = &lnrpc.SendCoinsRequest{
|
||||
Addr: minerAddr.String(),
|
||||
SendAll: true,
|
||||
|
@ -638,6 +638,16 @@ func wsTestPingPongTimeout(ht *harnessTest, net *lntest.NetworkHarness) {
|
||||
}
|
||||
}()
|
||||
|
||||
// The SubscribeInvoices call returns immediately after the gRPC/REST
|
||||
// connection is established. But it can happen that the goroutine in
|
||||
// lnd that actually registers the subscriber in the invoice backend
|
||||
// didn't get any CPU time just yet. So we can run into the situation
|
||||
// where we add our first invoice _before_ the subscription client is
|
||||
// registered. If that happens, we'll never get notified about the
|
||||
// invoice in question. So all we really can do is wait a bit here to
|
||||
// make sure the subscription is registered correctly.
|
||||
time.Sleep(500 * time.Millisecond)
|
||||
|
||||
// Let's create five invoices and wait for them to arrive. We'll wait
|
||||
// for at least one ping/pong cycle between each invoice.
|
||||
ctxb := context.Background()
|
||||
|
Loading…
Reference in New Issue
Block a user