Skip to content

lncli: add missing wallet psbt sign sub command#10659

Merged
ziggie1984 merged 3 commits intolightningnetwork:masterfrom
guggero:lncli-wallet-psbt-sign
Mar 25, 2026
Merged

lncli: add missing wallet psbt sign sub command#10659
ziggie1984 merged 3 commits intolightningnetwork:masterfrom
guggero:lncli-wallet-psbt-sign

Conversation

@guggero
Copy link
Copy Markdown
Collaborator

@guggero guggero commented Mar 24, 2026

Change Description

The walletrpc.SignPsbt didn't have a corresponding lncli command, which this PR now fixes.

Steps to Test

lncli newaddress p2wkh
{
    "address":  "bcrt1qkjha6h334gw5rxkcfecu2yldcrzetm0x0t7yqs"
}

lncli wallet psbt fund --outputs='{"bcrt1qkjha6h334gw5rxkcfecu2yldcrzetm0x0t7yqs":50000}' --sat_per_vbyte 2
{
    "psbt": "cHNidP8BAHECAAAAAUD0g7KTj137AwGWIezkhq1BBoXeg6AFoSBxIF3wKdgFAQAAAAD/////AlDDAAAAAAAAFgAUtK/dXjGqHUGa2E5xxRPtwMWV7eaWoMwdAAAAABYAFFZYcLBeOebrcHh1NrGUlx8dKuoWAAAAAAABAN4CAAAAAAEBdUeQyYiHDnAmqRykNoawpyANg2CN+zHSOk+P2OoEpL8BAAAAAP3///8C3Jud0AAAAAAWABQDHAPbN+zpkNkpdtcP9LeRpY1bkwBlzR0AAAAAFgAUaqqS/3qC9lFQ6rlmsg5bLTyYtdQCRzBEAiAQLleYosHTTQFT8GmV6pVwmffxNMm6zSrgc4Ug8W1hpQIgNIqJ3Nw7scyOyjBDXKUnGpD49Thjd1pxFYHJ5fDcOYABIQPL08RdZUkJuQNZx7kZBKCWcJNgwsFxsW1auNWJxiGvWHcAAAABAR8AZc0dAAAAABYAFGqqkv96gvZRUOq5ZrIOWy08mLXUAQMEAQAAACIGAyrOdtfVuHfFNtox6HaUwAH+fCubYl+XjEFBt3SYzyXvGAAAAABUAACAAAAAgAAAAIAAAAAAAAAAAAAAIgIDfRZgefLy9FzYiu2Eym18AqjBhYXQgBKJ+Zs5Elu5k8YYAAAAAFQAAIAAAACAAAAAgAEAAAAAAAAAAA==",
    "change_output_index": 1,
    "locks": [
        {
            "id": "ede19a92ed321a4705f8a1cccc1d4f6182545d4bb4fae08bd5937831b7e38f98",
            "outpoint": "05d829f05d207120a105a083de850641ad86e4ec21960103fb5d8f93b283f440:1",
            "expiration": 1774337236,
            "pk_script": "ABRqqpL/eoL2UVDquWayDlstPJi11A==",
            "value": 500000000
        }
    ]
}

lncli wallet psbt sign cHNidP8BAHECAAAAAUD0g7KTj137AwGWIezkhq1BBoXeg6AFoSBxIF3wKdgFAQAAAAD/////AlDDAAAAAAAAFgAUtK/dXjGqHUGa2E5xxRPtwMWV7eaWoMwdAAAAABYAFFZYcLBeOebrcHh1NrGUlx8dKuoWAAAAAAABAN4CAAAAAAEBdUeQyYiHDnAmqRykNoawpyANg2CN+zHSOk+P2OoEpL8BAAAAAP3///8C3Jud0AAAAAAWABQDHAPbN+zpkNkpdtcP9LeRpY1bkwBlzR0AAAAAFgAUaqqS/3qC9lFQ6rlmsg5bLTyYtdQCRzBEAiAQLleYosHT
TQFT8GmV6pVwmffxNMm6zSrgc4Ug8W1hpQIgNIqJ3Nw7scyOyjBDXKUnGpD49Thjd1pxFYHJ5fDcOYABIQPL08RdZUkJuQNZx7kZBKCWcJNgwsFxsW1auNWJxiGvWHcAAAABAR8AZc0dAAAAABYAFGqqkv96gvZRUOq5ZrIOWy08mLXUAQMEAQAAACIGAyrOdtfVuHfFNtox6HaUwAH+fCubYl+XjEFBt3SYzyXvGAAAAABUAACAAAAAgAAAAIAAAAAAAAAAAAAAIgIDfRZgefLy9FzYiu2Eym18AqjBhYXQgBKJ+Zs5Elu5k8YYAAAAAFQAAIAAAACAAAAAgAEAAAAAAAAAAA==
{
    "psbt": "cHNidP8BAHECAAAAAUD0g7KTj137AwGWIezkhq1BBoXeg6AFoSBxIF3wKdgFAQAAAAD/////AlDDAAAAAAAAFgAUtK/dXjGqHUGa2E5xxRPtwMWV7eaWoMwdAAAAABYAFFZYcLBeOebrcHh1NrGUlx8dKuoWAAAAAAABAN4CAAAAAAEBdUeQyYiHDnAmqRykNoawpyANg2CN+zHSOk+P2OoEpL8BAAAAAP3///8C3Jud0AAAAAAWABQDHAPbN+zpkNkpdtcP9LeRpY1bkwBlzR0AAAAAFgAUaqqS/3qC9lFQ6rlmsg5bLTyYtdQCRzBEAiAQLleYosHTTQFT8GmV6pVwmffxNMm6zSrgc4Ug8W1hpQIgNIqJ3Nw7scyOyjBDXKUnGpD49Thjd1pxFYHJ5fDcOYABIQPL08RdZUkJuQNZx7kZBKCWcJNgwsFxsW1auNWJxiGvWHcAAAABAR8AZc0dAAAAABYAFGqqkv96gvZRUOq5ZrIOWy08mLXUIgIDKs5219W4d8U22jHodpTAAf58K5tiX5eMQUG3dJjPJe9IMEUCIQCV8i0qexQuSCHYB4VXWUz0Bcy8yNDI4+4+FGzcpIiExAIgDPX4PnSv8RcjGVfICqZ0Lkb0YxNQkkru7Ypl0tf4gKEBAQMEAQAAACIGAyrOdtfVuHfFNtox6HaUwAH+fCubYl+XjEFBt3SYzyXvGAAAAABUAACAAAAAgAAAAIAAAAAAAAAAAAAAIgIDfRZgefLy9FzYiu2Eym18AqjBhYXQgBKJ+Zs5Elu5k8YYAAAAAFQAAIAAAACAAAAAgAEAAAAAAAAAAA==",
    "signed_input_indexes": [
        0
    ]
}

Pull Request Checklist

Testing

  • Your PR passes all CI checks.
  • Tests covering the positive and negative (error paths) are included.
  • Bug fixes contain tests triggering the bug to prevent regressions.

Code Style and Documentation

📝 Please see our Contribution Guidelines for further guidance.

@gemini-code-assist
Copy link
Copy Markdown

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces a new lncli command, wallet psbt sign, to expose the existing walletrpc.SignPsbt functionality to users. This enhancement provides more granular control over Partially Signed Bitcoin Transactions (PSBTs) by enabling users to sign inputs belonging to their wallet without immediately finalizing or publishing the transaction. It significantly improves lncli's wallet management capabilities, offering a crucial step in multi-party or complex transaction workflows.

Highlights

  • New lncli command: A new lncli wallet psbt sign command has been added, allowing users to sign Partially Signed Bitcoin Transactions (PSBTs) directly from the command line.
  • Updated finalizePsbt description: The description for the lncli wallet psbt finalize command has been updated to clarify its specific use cases and to reference the new sign subcommand for broader signing needs.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request adds the lncli wallet psbt sign command, which was missing for the walletrpc.SignPsbt RPC. The changes look good overall. I've added a couple of suggestions to improve documentation and adhere to the coding style guide.

Action: actionDecorator(signPsbt),
}

func signPsbt(ctx *cli.Context) error {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

According to the repository style guide (lines 17, 18), every function must have a comment that starts with the function name. The signPsbt function is missing this documentation.

Suggested change
func signPsbt(ctx *cli.Context) error {
// signPsbt handles the `lncli wallet psbt sign` command.
func signPsbt(ctx *cli.Context) error {
References
  1. Every function must be commented with its purpose and assumptions. (link)
  2. Function comments must begin with the function name. (link)

Comment thread docs/release-notes/release-notes-0.21.0.md
Copy link
Copy Markdown
Collaborator

@bhandras bhandras left a comment

Choose a reason for hiding this comment

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

LGTM, thanks Oli!

Copy link
Copy Markdown
Collaborator

@ellemouton ellemouton left a comment

Choose a reason for hiding this comment

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

noice 🙏 just needs linter fix

guggero added 3 commits March 24, 2026 13:13
Adds a new sub command `lncli wallet psbt sign` to `lncli` that calls
the wallet RPC's `SignPsbt` method.
@guggero guggero force-pushed the lncli-wallet-psbt-sign branch from b77ffb0 to aee7eb6 Compare March 24, 2026 12:13
@guggero
Copy link
Copy Markdown
Collaborator Author

guggero commented Mar 24, 2026

noice 🙏 just needs linter fix

Oops, I must be out of practice, don't know how I could've let a too-long line slip past 😬

@saubyk saubyk added this to v0.21 Mar 24, 2026
@saubyk saubyk removed this from v0.21 Mar 24, 2026
@saubyk saubyk added this to the v0.21.0 milestone Mar 24, 2026
@saubyk saubyk added this to v0.21 Mar 24, 2026
@saubyk saubyk moved this to In review in v0.21 Mar 24, 2026
@saubyk saubyk linked an issue Mar 24, 2026 that may be closed by this pull request
2 tasks
@ziggie1984 ziggie1984 enabled auto-merge March 25, 2026 14:30
@ziggie1984 ziggie1984 merged commit c14a054 into lightningnetwork:master Mar 25, 2026
75 of 81 checks passed
@github-project-automation github-project-automation Bot moved this from In review to Done in v0.21 Mar 25, 2026
@guggero guggero deleted the lncli-wallet-psbt-sign branch March 25, 2026 15:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

[bug]: Can't finalize psbt with 2-of-2 multisig p2wsh

5 participants