Skip to content

lncli: add missing wallet psbt sign sub command#10659

Open
guggero wants to merge 3 commits intolightningnetwork:masterfrom
guggero:lncli-wallet-psbt-sign
Open

lncli: add missing wallet psbt sign sub command#10659
guggero wants to merge 3 commits intolightningnetwork:masterfrom
guggero:lncli-wallet-psbt-sign

Conversation

@guggero
Copy link
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.

guggero added 3 commits March 24, 2026 08:19
Adds a new sub command `lncli wallet psbt sign` to `lncli` that calls
the wallet RPC's `SignPsbt` method.
@gemini-code-assist
Copy link

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

@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 {

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 on lines +105 to +107
* The `walletrpc.SignPsbt` now has a [corresponding `lncli wallet psbt sign`
command, and can be used to sign a
PSBT](https://github.com/lightningnetwork/lnd/pull/10659).

Choose a reason for hiding this comment

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

medium

This release note entry can be rephrased for better readability. The current formatting with line breaks inside the link text is a bit awkward.

Suggested change
* The `walletrpc.SignPsbt` now has a [corresponding `lncli wallet psbt sign`
command, and can be used to sign a
PSBT](https://github.com/lightningnetwork/lnd/pull/10659).
* The `walletrpc.SignPsbt` RPC call now has a corresponding [`lncli wallet psbt sign`](https://github.com/lightningnetwork/lnd/pull/10659) command to sign a PSBT.

Copy link
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
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

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants