What changed, and why it matters
This commit only adds integration tests and release notes for a previously implemented feature: output leases that never expire. It does not change production code, so it cannot introduce a new security vulnerability or fix one directly.
No security action required; this is a test-only and documentation commit. Review the parent PR (#11396) if assessing the security of the actual no-expiry lease implementation.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The commit registers a new integration test, testFundPsbtNoExpiryLease, and documents the no-expiry lease RPC changes in the release notes. The test exercises FundPsbt with InputLeaseNoExpiry, restart persistence, ReleaseOutput, LeaseOutput with NoExpiry, and automatic lease removal after first confirmed spend. No application logic is modified.
Changed components
itest/lnd_psbt_test.goitest/list_on_test.godocs/release-notes/unreleased/11396.mdInspect captured patch +129 / −0
### docs/release-notes/unreleased/11396.md
@@ -0,0 +1,34 @@
+# New Features
+
+## RPC Additions
+
+* WalletKit [adds explicit no-expiry
+ leases](https://github.com/lightningnetwork/lnd/pull/11396). Set
+ `LeaseOutput.no_expiry` or `FundPsbt.input_lease_no_expiry` to reserve unused
+ outputs without a timeout. The owner can release the reservation, and the
+ wallet removes the lease at the first confirmed spend.
+ New no-expiry leases therefore do not expose confirmation progress through
+ `confirmed_spend_height`.
+
+# Improvements
+
+## Breaking Changes
+
+* WalletKit [replaces the confirmation-count RPC
+ parameters](https://github.com/lightningnetwork/lnd/pull/11396)
+ `LeaseOutput.release_after_spend_confs` and
+ `FundPsbt.input_release_after_spend_confs` with the explicit no-expiry flags
+ and removes the `release_after_spend_confs` response fields from
+ `LeaseOutputResponse` and `UtxoLease`.
+ The retired fields were introduced in v0.21.4-beta by
+ [#11125](https://github.com/lightningnetwork/lnd/pull/11125).
+ Callers must migrate and verify the returned `no_expiry` acknowledgement;
+ requests using the retired count parameters now fail explicitly, including
+ requests from old protobuf clients, instead of falling back to timed leases.
+ After a confirmed spend, a reorg does not restore the removed lease. If the
+ spending transaction is later removed, an otherwise unspent input can become
+ selectable again.
+ Any pre-upgrade leases with a confirmation depth above one retain that policy
+ and ignore expiration, despite `ListLeases` reporting `no_expiry=false`.
+ The owner can release them with `ReleaseOutput`; an unspent output can also
+ be re-leased with `no_expiry=true` to adopt first-confirmed-spend cleanup.
### itest/list_on_test.go
@@ -326,6 +326,10 @@ var allTestCases = []*lntest.TestCase{
Name: "fund psbt custom lock",
TestFunc: testFundPsbtCustomLock,
},
+ {
+ Name: "fund psbt no expiry lease",
+ TestFunc: testFundPsbtNoExpiryLease,
+ },
{
Name: "resolution handoff",
TestFunc: testResHandoff,
### itest/lnd_psbt_test.go
@@ -2041,3 +2041,94 @@ func testFundPsbtCustomLock(ht *lntest.HarnessTest) {
leasesRespAfter := alice.RPC.ListLeases()
require.Empty(ht, leasesRespAfter.LockedUtxos)
}
+
+// testFundPsbtNoExpiryLease verifies that an unused input stays reserved across
+// restart, can be owner-released, and needs no lease after its first spend.
+func testFundPsbtNoExpiryLease(ht *lntest.HarnessTest) {
+ // Arrange one confirmed input so its absence from eligible candidates
+ // proves reservation, and its reappearance proves owner cancellation.
+ alice := ht.NewNode("Alice", nil)
+ ht.FundNumCoins(alice, 1)
+ input := ht.AssertNumUTXOsConfirmed(alice, 1)[0].Outpoint
+ lockID := ht.Random32Bytes()
+ aliceAddr := alice.RPC.NewAddress(&lnrpc.NewAddressRequest{
+ Type: lnrpc.AddressType_WITNESS_PUBKEY_HASH,
+ })
+
+ // Act by funding without a timeout or a user-supplied confirmation
+ // count. The selected input remains unused until the later publication.
+ fundResp := alice.RPC.FundPsbt(&walletrpc.FundPsbtRequest{
+ Template: &walletrpc.FundPsbtRequest_Raw{
+ Raw: &walletrpc.TxTemplate{
+ Outputs: map[string]uint64{
+ aliceAddr.Address: 100_000,
+ },
+ },
+ },
+ Fees: &walletrpc.FundPsbtRequest_SatPerVbyte{
+ SatPerVbyte: 2,
+ },
+ MinConfs: 1,
+ CustomLockId: lockID,
+ InputLeaseNoExpiry: true,
+ })
+
+ // Assert the funding response reports the selected input's policy, and
+ // restarting before broadcast preserves both the policy and exclusion.
+ require.Len(ht, fundResp.LockedUtxos, 1)
+ require.True(ht, fundResp.LockedUtxos[0].NoExpiry)
+ require.Equal(
+ ht, lntest.LnrpcOutpointToStr(input),
+ lntest.LnrpcOutpointToStr(fundResp.LockedUtxos[0].Outpoint),
+ )
+ ht.RestartNode(alice)
+ leases := alice.RPC.ListLeases().LockedUtxos
+ require.Len(ht, leases, 1)
+ require.True(ht, leases[0].NoExpiry)
+ require.Equal(ht, lockID, leases[0].Id)
+ ht.AssertNumUTXOsConfirmed(alice, 0)
+
+ // Act through owner cancellation while the input is still unspent. This
+ // must restore eligibility without waiting for a block or a deadline.
+ _, err := alice.RPC.WalletKit.ReleaseOutput(
+ ht.Context(), &walletrpc.ReleaseOutputRequest{
+ Id: lockID,
+ Outpoint: input,
+ },
+ )
+ require.NoError(ht, err)
+ ht.AssertUTXOInWallet(alice, input, "")
+ require.Empty(ht, alice.RPC.ListLeases().LockedUtxos)
+
+ // Reacquire the input through LeaseOutput before spending the original
+ // PSBT, covering both entry points without creating a second lifetime.
+ leaseResp, err := alice.RPC.WalletKit.LeaseOutput(
+ ht.Context(), &walletrpc.LeaseOutputRequest{
+ Id: lockID,
+ Outpoint: input,
+ NoExpiry: true,
+ },
+ )
+ require.NoError(ht, err)
+ require.True(ht, leaseResp.NoExpiry)
+ ht.AssertNumUTXOsConfirmed(alice, 0)
+ finalizeResp := alice.RPC.FinalizePsbt(&walletrpc.FinalizePsbtRequest{
+ FundedPsbt: fundResp.FundedPsbt,
+ })
+ alice.RPC.PublishTransaction(&walletrpc.Transaction{
+ TxHex: finalizeResp.RawFinalTx,
+ })
+ ht.MineBlocksAndAssertNumTxes(1, 1)
+
+ // Assert after wallet synchronization that the first confirmed spend
+ // removes the lease. Only the spending transaction's output and change
+ // are selectable; spend tracking excludes the original input without a
+ // retained reservation.
+ for _, utxo := range ht.AssertNumUTXOsConfirmed(alice, 2) {
+ require.NotEqual(
+ ht, lntest.LnrpcOutpointToStr(input),
+ lntest.LnrpcOutpointToStr(utxo.Outpoint),
+ )
+ }
+ require.Empty(ht, alice.RPC.ListLeases().LockedUtxos)
+}Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.