From 689cfdd55b7d4e2999cec0fef33aafc16c363c3b Mon Sep 17 00:00:00 2001 From: bitromortac Date: Fri, 12 Jun 2026 10:49:02 +0200 Subject: [PATCH] itest: bump lnd to v0.21.0-beta and fix close flakes Bump the integration test lnd binary to v0.21.0-beta. Two test fixes are required for the new version: - nodereport: the anchor commitment close fee changed by 10 sat, update the hardcoded CHANNEL_CLOSE_FEE expectation from 4535 to 4525 sat. - test_context: closeChannel mined a block while still waiting for the pending close update, which confirmed the force close tx out of the mempool before its fee could be read, causing a 'Transaction not in mempool' failure. Only start mining once the close fee has been captured from the mempool. --- itest/Dockerfile | 2 +- itest/nodereport_test.go | 2 +- itest/test_context.go | 22 +++++++++++++++++----- 3 files changed, 19 insertions(+), 7 deletions(-) diff --git a/itest/Dockerfile b/itest/Dockerfile index 22f1819..a797f81 100644 --- a/itest/Dockerfile +++ b/itest/Dockerfile @@ -4,7 +4,7 @@ # binaries required to run the tests with. FROM golang:1.25.10-alpine as builder -ARG LND_VERSION=dd65ba2b01063c4b6e3022835168b19a204f9408 +ARG LND_VERSION=v0.21.0-beta RUN apk add --no-cache git make diff --git a/itest/nodereport_test.go b/itest/nodereport_test.go index 1ac0a89..d492090 100644 --- a/itest/nodereport_test.go +++ b/itest/nodereport_test.go @@ -188,7 +188,7 @@ func TestNodeAudit(t *testing.T) { expected[accounting.FeeReference(closeTx.String())] = expectedReport{ eventType: frdrpc.EntryType_CHANNEL_CLOSE_FEE, - amount: lnwire.MilliSatoshi(4535 * 1000), + amount: lnwire.MilliSatoshi(4525 * 1000), onChain: true, } diff --git a/itest/test_context.go b/itest/test_context.go index 0d6cdd4..70d4e32 100644 --- a/itest/test_context.go +++ b/itest/test_context.go @@ -299,8 +299,9 @@ func (c *testContext) closeChannel(client lndclient.LightningClient, require.NoError(c.t, err, "could not close channel") var ( - closeTx chainhash.Hash - closeFee btcutil.Amount + closeTx chainhash.Hash + closeFee btcutil.Amount + gotPending bool ) // Wait for us to get an update from our channel indicating that it is @@ -314,7 +315,10 @@ func (c *testContext) closeChannel(client lndclient.LightningClient, case *lndclient.PendingCloseUpdate: // Get our close tx from the mempool to get its fee // and add an expected entry because we opened the - // channel so we pay the fees. + // channel so we pay the fees. This must happen + // before we mine any block, otherwise the close tx + // is confirmed out of the mempool and the lookup + // fails. close, err := c.bitcoindClient.GetMempoolEntry( closeTx.String(), ) @@ -323,6 +327,8 @@ func (c *testContext) closeChannel(client lndclient.LightningClient, closeFee, err = btcutil.NewAmount(close.Fee) require.NoError(c.t, err, "could not get fee") + gotPending = true + case *lndclient.ChannelClosedUpdate: return true } @@ -331,9 +337,15 @@ func (c *testContext) closeChannel(client lndclient.LightningClient, c.t.Fatalf("error closing channel: %v, %v", channel, err) - // If we have not received an update yet, mine a block. + // If we have not received an update yet, wait for the pending + // close to broadcast. Only once we have captured the close tx + // fee from the mempool do we start mining blocks to drive the + // channel to its fully resolved state, so that mining does not + // confirm the close tx before we read its fee. default: - c.mine() + if gotPending { + c.mine() + } } return false