Skip to content

lncli: expose no-expiry output leases - #11550

Open
MPins wants to merge 4 commits into
lightningnetwork:masterfrom
MPins:lncli-lease-no-expiry
Open

MPins wants to merge 4 commits into
lightningnetwork:masterfrom
MPins:lncli-lease-no-expiry

Conversation

@MPins

@MPins MPins commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Change Description

Follow-up to #11396, which made no-expiry output leases explicit in WalletKit. lncli had no way to use them, and its lease output hid the new acknowledgement:

  • lncli wallet leaseoutput gains --no_expiry. Exactly one of --expiry and --no_expiry must be set; combining them is rejected before calling the server.
  • lncli wallet psbt fund and lncli wallet psbt fundtemplate gain --lockid, --lock_expiry and --no_expiry, mapping to the existing custom_lock_id, lock_expiration_seconds and input_lease_no_expiry request fields. None of the three was exposed before, and --no_expiry needs --lockid because the server requires a caller-specific lock ID for that mode. The server keeps validating the combination.
  • The JSON lease output used by lncli wallet listleases and by both fund commands now includes no_expiry. Previously a no-expiry lease looked like an ordinary timed lease there, with an expiration that is not enforced.

lncli wallet leaseoutput already printed the raw RPC response, so it showed no_expiry before this change.

Steps to Test

go test -tags="dev walletrpc" ./cmd/commands/ -run 'TestParseLeaseOutputRequest|TestParseFundLeaseFlags|TestMarshallLocksNoExpiry'

I also tested it by hand on a regtest node (btcd + lnd built from this branch without the dev tag), using lncli directly:

  • wallet leaseoutput --no_expiry --expiry 30 is rejected locally, --no_expiry returns "no_expiry": true and --expiry 300 returns false; wallet listleases shows both leases with the matching no_expiry value.
  • wallet psbt fund --no_expiry fails without --lockid ("custom lock ID required"), with --lock_expiry 60 ("cannot be combined with a duration") and with a non-hex --lockid. With --lockid ... --no_expiry, both psbt fund and psbt fundtemplate return locks with the given ID and "no_expiry": true. Without the new flags, psbt fund still uses lnd's internal lock ID and reports "no_expiry": false.
  • wallet releaseoutput --lockid ... releases a no-expiry lease.
  • After finalizing and publishing a PSBT funded with --no_expiry, its lease stays while the transaction is in the mempool and disappears once the spend confirms.
  • Waiting past the stored expiration, the timed leases expired and their outputs became spendable again, while the no-expiry lease was still listed and its output stayed excluded from listunspent.

The JSON lease output used by listleases and the psbt fund commands
only carried the expiration, so a lease without a timeout looked like
an ordinary timed lease. Report the no_expiry flag returned by the
server alongside it.
Allow leasing an output without a timeout. The flag cannot be combined
with --expiry, and exactly one of the two must be set. Move the request
parsing into its own function so the flag validation can be tested
without a running node.
FundPsbt accepts a custom lock ID, a lease duration and the no-expiry
option for the inputs it acquires, but neither psbt fund nor psbt
fundtemplate exposed them. Add --lockid, --lock_expiry and --no_expiry
to both commands and leave validating the combination to the server.
@github-actions github-actions Bot added ci-hold CI is held; remove this label to run CI severity-medium Focused review required labels Nov 10, 2026
@github-actions

Copy link
Copy Markdown

🟡 PR Severity: MEDIUM

gh pr view | 3 files | 325 lines changed

🟡 Medium (1 file)
  • cmd/commands/walletrpc_active.go - CLI client command code under cmd/*; classified as MEDIUM per path regardless of the walletrpc name (not server-side lnrpc/wallet logic)
🟢 Low (2 files)
  • cmd/commands/walletrpc_active_test.go - test-only change
  • docs/release-notes/unreleased/11550.md - release notes

Analysis

The only non-test, non-doc file touched is cmd/commands/walletrpc_active.go, which lives under cmd/* (CLI client commands). Per classification rules, cmd/* files are always MEDIUM regardless of filename keywords (e.g. "walletrpc"), since this is client-side command code, not the server-side wallet RPC implementation itself. Total file count (3) and non-test/non-generated line count (~157) are both well under the thresholds for a severity bump, and no other critical/high packages are touched.


To override, add a severity-override-{critical,high,medium,low} label.

@agammann agammann left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new TestParseFundLeaseFlags loop exercises both fund and fundtemplate, including their unchanged default request and explicit lease fields. TestMarshallLocksNoExpiry also checks that JSON carries the NoExpiry bit independently of Expiration, which matters because an indefinite lease may still have an expiration value in the response. The local leaseoutput parser covers both mutually exclusive flag choices.

@litbot-9000 litbot-9000 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/gateway review

Verdict: no issues found — approve-worthy. Posting as COMMENT rather than APPROVE because the requesting party is not this workspace's approval delegate; the outward approval belongs to roasbeef.

Verified (head d55ffd5):

  • go build ./..., go build -tags="dev walletrpc" ./cmd/commands/, go vet -tags="dev walletrpc" ./cmd/commands/ — all clean.
  • Per-commit build of cmd/commands at each of the 4 commits — every commit compiles.
  • New tests pass, and each named test was confirmed executed in -v output: go test -tags="dev walletrpc" ./cmd/commands/ -run 'TestParseLeaseOutputRequest|TestParseFundLeaseFlags|TestMarshallLocksNoExpiry' -v -count=1.
  • Mutation-tested all four new guards; each neutralization fails the suite as it should:
    • case noExpiry && expiry != 0 → && false: TestParseLeaseOutputRequest/both fails.
    • case !noExpiry && expiry == 0 → && false: TestParseLeaseOutputRequest/neither fails.
    • if ctx.IsSet(fundLockIDFlag.Name) → && false: TestParseFundLeaseFlags/{fund,fundtemplate} fail (CustomLockId stays nil).
    • NoExpiry: lock.NoExpiry → false: TestMarshallLocksNoExpiry fails.
      (Worktree restored clean afterwards.)
  • 80-column check on the diff: clean.
  • Server side honors the fields as the PR body claims (FundPsbt in walletkit_server.go): input_lease_no_expiry combined with lock_expiration_seconds → errLeaseLifetimeConflict; missing/zero/reserved custom lock ID rejected for no-expiry funding. The local --expiry/--no_expiry exclusivity check in leaseoutput complements this correctly, and deferring combination validation to the server for the fund commands is consistent with the existing design.
  • Release note present at docs/release-notes/unreleased/11550.md.

Not verified: itests and the full CI matrix — the ci-hold label holds all tier jobs by design, so the CI result failure is the hold mechanism working, not a code signal. This pod has no Docker for itests. The author's regtest steps in the PR body cover the end-to-end paths and are consistent with the server-side validation quoted above.

Required changes: none.

— claudell ⚡ (OpenClaw dev agent; approval posts as litbot-9000 and does not count toward branch protection)

@litbot-9000

Copy link
Copy Markdown
Collaborator

@MPins, remember to re-request review from reviewers when ready

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci-hold CI is held; remove this label to run CI severity-medium Focused review required

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants