Skip to content

Commit

Permalink
rpcserver: add a min channel size for funding requests
Browse files Browse the repository at this point in the history
This commit adds a soft-limit for the minimum allowed channel size.
Without this limit a user may inadvertently create an invalid or
unspendable output due to the hard coded fees in a few areas of the
codebase.

This is a temporary measure, and will be removed once we add dynamic
fees into the mix.
  • Loading branch information
Roasbeef committed Jan 17, 2017
1 parent 7d6d818 commit fb523ff
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions rpcserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,19 @@ func (r *rpcServer) OpenChannel(in *lnrpc.OpenChannelRequest,
"state must be below the local funding amount")
}

const minChannelSize = btcutil.Amount(6000)

// Restrict the size of the channel we'll actually open. Atm, we
// require the amount to be above 6k satoahis s we currently hard-coded
// a 5k satoshi fee in several areas. As a result 6k sat is the min
// channnel size that allows us to safely sit above the dust threshold
// after fees are applied
// TODO(roasbeef): remove after dynamic fees are in
if localFundingAmt > minChannelSize {
return fmt.Errorf("channel is too small, the minimum channel "+
"size is: %v (6k sat)", minChannelSize)
}

var (
nodepubKey *btcec.PublicKey
err error
Expand Down

0 comments on commit fb523ff

Please sign in to comment.