Skip to content
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

lnwallet+lnrpc: add ability to fetch the last unused wallet addr #2661

Merged
merged 3 commits into from Mar 6, 2019

Conversation

Projects
None yet
4 participants
@Roasbeef
Copy link
Member

commented Feb 20, 2019

In this PR, we add the ability to fetch the last unused wallet address over the RPC interface. This is useful for end-users UIs as they can spam this call at will without having to worry about potentially unbounded "address inflation".

The current implementation simply adds two new (previously unused) address types. This makes it easy for any existing UIs, as they don't need to switch to a brand new call (or even update their protos), and can instead just pass in the new address type. The alternative was to add a new RPC call all together. I opted to not pursue this approach, as it seemed wasteful to add an entirely new RPC call for what is really a modification on an existing call. Also given that was have soooo many RPC methods, adding a new enum type seemed more conservative.

@Roasbeef Roasbeef force-pushed the Roasbeef:last-unused-addr branch from d847028 to 1fa8f9a Feb 20, 2019

@bjarnemagnussen
Copy link

left a comment

Hi,

I just took a look at this PR to learn about the LND codebase and found a tiny typo in the comments :) Furthermore I got a question with the unit test, which for my own learning I hope you could find the time to answer me at some point.

Show resolved Hide resolved lnwallet/btcwallet/btcwallet.go Outdated
Show resolved Hide resolved lnwallet/interface.go Outdated
Show resolved Hide resolved lnwallet/interface_test.go
Show resolved Hide resolved lnwallet/btcwallet/btcwallet.go Outdated
Show resolved Hide resolved lnwallet/btcwallet/btcwallet.go Outdated
Show resolved Hide resolved rpcserver.go Outdated

Roasbeef added some commits Feb 20, 2019

lnrpc: add new unused address types for NewAddressRequest
In this commit, we add two new address types to `NewAddressRequest`.
These address types will allow the caller to retrieve the last _unused_
address, rather than always rotating to the next address in the
keychain.
lnwallet: add LastUnusedAddress to WalletController interface
In this commit, we add a new `LastUnusedAddress` method to the
`WalletController` interface. Callers can use this new method to graph
the last unused address, which can be useful for UIs that want to
refresh the address, but not cause nearly unbounded address generation.

The implementation for `btcwallet` uses the existing `CurrentAddress`
method. We've also added a new integration tests to exercise the new
functionality.

@Roasbeef Roasbeef force-pushed the Roasbeef:last-unused-addr branch from 1fa8f9a to 65cdb12 Mar 5, 2019

@Roasbeef

This comment has been minimized.

Copy link
Member Author

commented Mar 5, 2019

Comments addressed, PTAL @cfromknecht!

@cfromknecht
Copy link
Collaborator

left a comment

LGTM 👏

@wpaulino
Copy link
Collaborator

left a comment

LGTM 🕹

@wpaulino wpaulino merged commit 63273e1 into lightningnetwork:master Mar 6, 2019

1 of 2 checks passed

coverage/coveralls Coverage decreased (-0.02%) to 60.17%
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.