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

sweep+rpc+cmd/lncli: expose pending input sweeps over RPC + CLI #3089

Merged
merged 4 commits into from Jun 6, 2019

Conversation

wpaulino
Copy link
Contributor

In this PR, we expose the set of pending inputs that the UtxoSweeper is currently attempting to sweep. This will serve as preparatory work for allowing users to perform fee bumps. Due to the UtxoSweeper's asynchronous nature, we are not able to quickly report on whether a fee bump succeeded or not, so we resort towards exposing its internal fee rate bucketing system over RPC to give users an indication of what's currently being swept and with what fee rate.

I opted to only expose the sweeping fee rate for each bucket, along with all of the inputs within each bucket and their individual fee rates for now. Looking for feedback on whether we could be exposing this information better.

Depends on #3026.

@wpaulino wpaulino requested a review from joostjager May 17, 2019 03:02
@wpaulino wpaulino added utxo sweeping cli Related to the command line interface enhancement Improvements to existing features / behaviour fees Related to the fees paid for transactions (both LN and funding/commitment transactions) rpc Related to the RPC interface labels May 17, 2019
sweep/sweeper.go Show resolved Hide resolved
sweep/sweeper.go Outdated Show resolved Hide resolved
sweep/sweeper.go Outdated Show resolved Hide resolved
@wpaulino
Copy link
Contributor Author

PTAL @joostjager.

@wpaulino wpaulino added this to the 0.7 milestone May 17, 2019
@wpaulino wpaulino requested a review from Roasbeef May 18, 2019 02:53
lnrpc/invoicesrpc/invoices.pb.go Outdated Show resolved Hide resolved
lnrpc/rpc.proto Outdated Show resolved Hide resolved
rpcserver.go Outdated Show resolved Hide resolved
sweep/sweeper.go Outdated Show resolved Hide resolved
sweep/sweeper.go Outdated Show resolved Hide resolved
Copy link
Member

@Roasbeef Roasbeef left a comment

Choose a reason for hiding this comment

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

Looks pretty good, just a few cosmetics related comments

lnrpc/rpc.proto Outdated
sweep transaction of the output.
*/
uint32 next_broadcast_height = 6 [json_name = "next_broadcast_height"];
}
Copy link
Member

Choose a reason for hiding this comment

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

Once we circle back and add retargeting, it may be useful to expose what the next fee rate would be.

rpcserver.go Outdated Show resolved Hide resolved
cmd/lncli/types.go Outdated Show resolved Hide resolved
cmd/lncli/types.go Outdated Show resolved Hide resolved
sweep/sweeper.go Outdated Show resolved Hide resolved
sweep/sweeper.go Outdated Show resolved Hide resolved
sweep/sweeper.go Outdated
for _, pendingInput := range s.pendingInputs {
// Only the exported fields are set, as we expect the response
// to only be consumed externally.
pendingInputs = append(pendingInputs, &PendingInput{
Copy link
Collaborator

Choose a reason for hiding this comment

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

I had the same thing with creating a snapshot in mission control and introduced separate exported structs for the snapshot. I think it is cleaner. (non blocking)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah that was how the initial design of the PR approached it, but I opted for reusing the same struct to result in less code, though the difference is not much.

Copy link
Member

@Roasbeef Roasbeef left a comment

Choose a reason for hiding this comment

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

Tested locally, works as advertised!

LGTM contingent in unifying the byte reversal (in lncli as we do elsewhere) 🌊

Copy link
Contributor

@cfromknecht cfromknecht left a comment

Choose a reason for hiding this comment

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

straightforward diff, some high level comments

lnrpc/rpc.swagger.json Outdated Show resolved Hide resolved
rpcserver.go Outdated Show resolved Hide resolved
@cfromknecht
Copy link
Contributor

@wpaulino needs rebase

rpcserver.go Outdated Show resolved Hide resolved
sweep/sweeper.go Outdated Show resolved Hide resolved
@wpaulino
Copy link
Contributor Author

wpaulino commented Jun 5, 2019

PTAL @Roasbeef @joostjager.

Copy link
Collaborator

@joostjager joostjager left a comment

Choose a reason for hiding this comment

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

Tested and found that it works. Only minor comment is that the field name sat_per_byte remains a little vague without reading the comment. But don't know if last_sat_per_byte would be any better.

This will serve useful when exposing the pending inputs over RPC, since
we currently don't keep track of the last fee rate used for an input.
@wpaulino
Copy link
Contributor Author

wpaulino commented Jun 5, 2019

Only minor comment is that the field name sat_per_byte remains a little vague without reading the comment.

Agreed. This is why bitcoin-cli also includes a description of the command's response. Possibly something we can look into later down the road.

Rebased to address a cmd/lncli conflict.

@wpaulino wpaulino force-pushed the pendingsweeps-rpc branch 3 times, most recently from ebecc4f to ab1491f Compare June 6, 2019 00:57
Copy link
Contributor

@cfromknecht cfromknecht left a comment

Choose a reason for hiding this comment

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

LGTM ✅

cmd/lncli/types.go Outdated Show resolved Hide resolved
@Roasbeef Roasbeef merged commit aa5156a into lightningnetwork:master Jun 6, 2019
@wpaulino wpaulino deleted the pendingsweeps-rpc branch June 6, 2019 18:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cli Related to the command line interface enhancement Improvements to existing features / behaviour fees Related to the fees paid for transactions (both LN and funding/commitment transactions) rpc Related to the RPC interface utxo sweeping
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants