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

rpc: prevent spending unconfirmed funds within OpenChannel by default #2059

Merged

Conversation

wpaulino
Copy link
Contributor

In this commit, we address a slight regression in the defaults provided
by the OpenChannel RPC with regards to spending unconfirmed outputs to
fund funding transactions. We now add a new boolean parameter to
OpenChannelRequest: SpendUnconfirmed. If set, we'll use this to
indicate to the server that the funding transaction of the channel to be
created can spend the wallet's unconfirmed outputs to fund it. This
addition is needed because otherwise, if the caller doesn't specify a
MinConfs parameter to the request, then a default of 0 will be used,
which is not ideal.

rpcserver.go Outdated
@@ -761,6 +761,22 @@ func (r *rpcServer) OpenChannel(in *lnrpc.OpenChannelRequest,
"non-negative number")
}

var minConfs int32
Copy link
Contributor

Choose a reason for hiding this comment

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

Doesn't look like it is ever set in the case in.MinConfs > 0

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed!

@wpaulino wpaulino force-pushed the openchannel-unconfirmed-funds branch from 0736808 to cd802a6 Compare October 17, 2018 23:36
rpcserver.go Outdated Show resolved Hide resolved
rpcserver.go Outdated Show resolved Hide resolved
@Roasbeef Roasbeef added rpc Related to the RPC interface funding Related to the opening of new channels with funding transactions on the blockchain P2 should be fixed if one has time needs review PR needs review by regular contributors needs testing PR hasn't yet been actively tested on testnet/mainnet labels Oct 18, 2018
@Roasbeef Roasbeef added this to the 0.5.1 milestone Oct 18, 2018
In this commit, we address a slight regression in the defaults provided
by the OpenChannel RPC with regards to spending unconfirmed outputs to
fund funding transactions. We now add a new boolean parameter to
OpenChannelRequest: SpendUnconfirmed. If set, we'll use this to
indicate to the server that the funding transaction of the channel to be
created can spend the wallet's unconfirmed outputs to fund it. This
addition is needed because otherwise, if the caller doesn't specify a
MinConfs parameter to the request, then a default of 0 will be used,
which is not ideal.
@wpaulino wpaulino force-pushed the openchannel-unconfirmed-funds branch from cd802a6 to 16b5f70 Compare October 18, 2018 23:57
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.

LGTM 🚀

@Roasbeef Roasbeef merged commit 1b0d8e8 into lightningnetwork:master Oct 24, 2018
@wpaulino wpaulino deleted the openchannel-unconfirmed-funds branch October 24, 2018 15:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
funding Related to the opening of new channels with funding transactions on the blockchain needs review PR needs review by regular contributors needs testing PR hasn't yet been actively tested on testnet/mainnet P2 should be fixed if one has time rpc Related to the RPC interface
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants