rpcserver: add a min channel size for funding requests
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.
This commit is contained in:
parent
7d6d8187fb
commit
fb523ff5ac
13
rpcserver.go
13
rpcserver.go
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user