-
Notifications
You must be signed in to change notification settings - Fork 2.3k
[WIP] Add change address to SendCoinsRequest (#10271) #10769
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,31 @@ | ||||||||
| # LND #10271 Implementation Guide | ||||||||
|
|
||||||||
| ## Changes Needed | ||||||||
|
|
||||||||
| ### 1. lnrpc/lightning.proto | ||||||||
| Add to `SendCoinsRequest`: | ||||||||
| ```protobuf | ||||||||
| string change_address = 15; | ||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The proposed protobuf field definition has two issues:
Suggested change
|
||||||||
| ``` | ||||||||
|
|
||||||||
| ### 2. cmd/lncli/commands.go | ||||||||
| Add flag: | ||||||||
| ```go | ||||||||
| cli.StringFlag{ | ||||||||
| Name: "change_address", | ||||||||
| Usage: "Optional address to send change to", | ||||||||
| }, | ||||||||
| ``` | ||||||||
|
|
||||||||
| ### 3. lnd/lnwallet/btcwallet/btcwallet.go | ||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||||||||
| Update `SendCoins` to use change address. | ||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The
Suggested change
|
||||||||
|
|
||||||||
| ## Generate Protobuf | ||||||||
| ```bash | ||||||||
| make rpc | ||||||||
| ``` | ||||||||
|
|
||||||||
| ## Test | ||||||||
| ```bash | ||||||||
| make check | ||||||||
| ``` | ||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| # PR #10769 Completion Checklist | ||
|
|
||
| ## Completed ✅ | ||
| - [x] Add `change_addr` field to `SendCoinsRequest` proto | ||
| - [x] Add `--change_addr` flag to `sendcoins` CLI command | ||
| - [x] Pass change address to SendCoins RPC call | ||
| - [x] Push branch to fork | ||
| - [x] Create upstream PR | ||
|
|
||
| ## Remaining Work 📝 | ||
|
|
||
| ### 1. Regenerate Protobuf Code | ||
| ```bash | ||
| make rpc | ||
| ``` | ||
| This will regenerate: | ||
| - `lnrpc/lightning.pb.go` | ||
| - `lnrpc/lightning_grpc.pb.go` | ||
|
|
||
| ### 2. Add Unit Tests | ||
| Create `cmd/commands/commands_test.go` or update existing tests: | ||
| ```go | ||
| func TestSendCoinsWithChangeAddr(t *testing.T) { | ||
| // Test that change_addr is properly parsed and passed | ||
| } | ||
| ``` | ||
|
|
||
| ### 3. Add Integration Tests | ||
| Update `lntest/itest/lnd_on_chain_test.go`: | ||
| ```go | ||
| func testSendCoinsWithChangeAddr(t *harnessTest) { | ||
| // Test sending coins with custom change address | ||
| } | ||
| ``` | ||
|
|
||
| ### 4. Update Documentation | ||
| - Update `docs/cmd/lncli.md` if it exists | ||
| - Add example usage to PR description | ||
|
|
||
| ### 5. Wallet Implementation | ||
| The wallet needs to actually use the change address. Update: | ||
| - `lnwallet/btcwallet/btcwallet.go` - `SendCoins` method | ||
| - `rpcserver.go` - Pass change address to wallet | ||
|
|
||
| ## How to Get Write Access | ||
|
|
||
| 1. **Become a regular contributor:** | ||
| - Submit quality PRs | ||
| - Review other PRs | ||
| - Participate in discussions | ||
|
|
||
| 2. **Join the LND community:** | ||
| - Discord: https://discord.gg/lightning | ||
| - IRC: #lnd on Libera.Chat | ||
| - Mailing list: lightning-dev | ||
|
|
||
| 3. **Build reputation:** | ||
| - Fix bugs | ||
| - Add features | ||
| - Write documentation | ||
|
|
||
| 4. **Apply for maintainership:** | ||
| - After consistent contributions | ||
| - Ask existing maintainers | ||
|
|
||
| ## Current Status | ||
| - PR is open and ready for review | ||
| - Basic implementation is complete | ||
| - Needs protobuf regeneration and tests |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While the PR focuses on
SendCoinsRequest, it would be beneficial to also addchange_addresssupport toSendManyRequestfor completeness, as both RPCs involve creating on-chain transactions where a custom change address might be desired.