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 wpaulino force-pushed the pendingsweeps-rpc branch from dd7a59c to 394bd91 Compare May 17, 2019 23:28
@wpaulino
Copy link
Contributor Author

PTAL @joostjager.

@wpaulino wpaulino added this to the 0.7 milestone May 17, 2019
@wpaulino wpaulino force-pushed the pendingsweeps-rpc branch from 394bd91 to 6ec7bb9 Compare May 18, 2019 02:53
@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
@wpaulino wpaulino force-pushed the pendingsweeps-rpc branch from 6ec7bb9 to 9118e3c Compare May 22, 2019 03:13
sweep/sweeper.go Outdated Show resolved Hide resolved
@wpaulino wpaulino force-pushed the pendingsweeps-rpc branch from 9118e3c to 9fd0c47 Compare May 23, 2019 02:08
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
@wpaulino wpaulino force-pushed the pendingsweeps-rpc branch from 9fd0c47 to 22b401b Compare May 27, 2019 23:38
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
Contributor

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.

@wpaulino wpaulino force-pushed the pendingsweeps-rpc branch from 22b401b to 1c340b9 Compare May 28, 2019 23:05
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) 🌊

@wpaulino wpaulino force-pushed the pendingsweeps-rpc branch from 1c340b9 to cfcc0b9 Compare May 29, 2019 00:13
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

@wpaulino wpaulino force-pushed the pendingsweeps-rpc branch from 0b6541a to 70b32d5 Compare June 1, 2019 00:32
@wpaulino wpaulino force-pushed the pendingsweeps-rpc branch from 70b32d5 to 0c525ca Compare June 3, 2019 23:32
rpcserver.go Outdated Show resolved Hide resolved
sweep/sweeper.go Outdated Show resolved Hide resolved
@wpaulino wpaulino force-pushed the pendingsweeps-rpc branch from 0c525ca to fcb0467 Compare June 4, 2019 23:24
@wpaulino
Copy link
Contributor Author

wpaulino commented Jun 5, 2019

PTAL @Roasbeef @joostjager.

Copy link
Contributor

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

wpaulino added 3 commits June 5, 2019 12:10
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 wpaulino force-pushed the pendingsweeps-rpc branch from fcb0467 to 26230cd Compare June 5, 2019 19:11
@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
@wpaulino wpaulino force-pushed the pendingsweeps-rpc branch from ab1491f to 71f3ee1 Compare June 6, 2019 09:56
@wpaulino wpaulino force-pushed the pendingsweeps-rpc branch from 71f3ee1 to 1d8b70e Compare June 6, 2019 10:23
@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.

4 participants