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
Collaborator

@wpaulino wpaulino commented May 17, 2019

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.

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 May 17, 2019
@wpaulino
Copy link
Collaborator Author

@wpaulino wpaulino commented May 17, 2019

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 May 18, 2019
@wpaulino wpaulino requested a review from Roasbeef May 18, 2019
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 May 22, 2019
sweep/sweeper.go Outdated Show resolved Hide resolved
@wpaulino wpaulino force-pushed the pendingsweeps-rpc branch from 9118e3c to 9fd0c47 May 23, 2019
Copy link
Member

@Roasbeef Roasbeef left a comment

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

@Roasbeef Roasbeef May 25, 2019

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 May 27, 2019
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

@joostjager joostjager May 28, 2019

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
Collaborator Author

@wpaulino wpaulino May 28, 2019

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 May 28, 2019
Copy link
Member

@Roasbeef Roasbeef left a comment

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 May 29, 2019
Copy link
Collaborator

@cfromknecht cfromknecht left a comment

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
Collaborator

@cfromknecht cfromknecht commented Jun 1, 2019

@wpaulino needs rebase

cmd/lncli/types.go Show resolved Hide resolved
@wpaulino wpaulino force-pushed the pendingsweeps-rpc branch from 0b6541a to 70b32d5 Jun 1, 2019
@wpaulino wpaulino force-pushed the pendingsweeps-rpc branch from 70b32d5 to 0c525ca Jun 3, 2019
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 Jun 4, 2019
@wpaulino
Copy link
Collaborator Author

@wpaulino wpaulino commented Jun 5, 2019

Copy link
Collaborator

@joostjager joostjager left a comment

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 Jun 5, 2019
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 Jun 5, 2019
@wpaulino
Copy link
Collaborator Author

@wpaulino 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 Jun 6, 2019
Copy link
Collaborator

@cfromknecht cfromknecht left a comment

LGTM

cmd/lncli/types.go Outdated Show resolved Hide resolved
@wpaulino wpaulino force-pushed the pendingsweeps-rpc branch from ab1491f to 71f3ee1 Jun 6, 2019
@wpaulino wpaulino force-pushed the pendingsweeps-rpc branch from 71f3ee1 to 1d8b70e Jun 6, 2019
@Roasbeef Roasbeef merged commit aa5156a into lightningnetwork:master Jun 6, 2019
2 checks passed
@wpaulino wpaulino deleted the pendingsweeps-rpc branch Jun 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

4 participants