Skip to content

Commit

Permalink
funding+rpc: raise min channel size to 20k satoshis
Browse files Browse the repository at this point in the history
In this commit, we raise the min channel size to 20k satoshis. This
will be evaluated before we check for dusty commitments. The goal of
this is to ensure ample room for fees at current, and future fee
levels.
  • Loading branch information
Roasbeef committed Mar 19, 2018
1 parent ce85632 commit 8127685
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 10 deletions.
4 changes: 4 additions & 0 deletions fundingmanager.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ const (
// for the funding transaction to be confirmed before forgetting about
// the channel. 288 blocks is ~48 hrs
maxWaitNumBlocksFundingConf = 288

// minChanFundingSize is the smallest channel that we'll allow to be
// created over the RPC interface.
minChanFundingSize = btcutil.Amount(20000)
)

// reservationWithCtx encapsulates a pending channel reservation. This wrapper
Expand Down
23 changes: 13 additions & 10 deletions rpcserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -701,17 +701,12 @@ func (r *rpcServer) OpenChannel(in *lnrpc.OpenChannelRequest,
"channel size is: %v", maxFundingAmount)
}

const minChannelSize = btcutil.Amount(6000)

// Restrict the size of the channel we'll actually open. Atm, we
// require the amount to be above 6k satoshis we currently hard-coded
// a 5k satoshi fee in several areas. As a result 6k sat is the min
// channel 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 {
// Restrict the size of the channel we'll actually open. At a later
// level, we'll ensure that the output we create after accounting for
// fees that a dust output isn't created.
if localFundingAmt < minChanFundingSize {
return fmt.Errorf("channel is too small, the minimum channel "+
"size is: %v (6k sat)", minChannelSize)
"size is: %v SAT", int64(minChanFundingSize))
}

var (
Expand Down Expand Up @@ -864,6 +859,14 @@ func (r *rpcServer) OpenChannelSync(ctx context.Context,
"initial state must be below the local funding amount")
}

// Restrict the size of the channel we'll actually open. At a later
// level, we'll ensure that the output we create after accounting for
// fees that a dust output isn't created.
if localFundingAmt < minChanFundingSize {
return nil, fmt.Errorf("channel is too small, the minimum channel "+
"size is: %v SAT", int64(minChanFundingSize))
}

// Based on the passed fee related parameters, we'll determine an
// appropriate fee rate for the funding transaction.
feeRate, err := determineFeePerVSize(
Expand Down

0 comments on commit 8127685

Please sign in to comment.