funding: enforce the 2^24 satoshi funding limit in BOLT-0002
This commit is contained in:
2 files changed
+38
-4
No files matched your search
+9
-1
@@ -380,13 +380,21 @@ func (r *rpcServer) OpenChannel(in *lnrpc.OpenChannelRequest,
|
||||
remoteInitialBalance := btcutil.Amount(in.PushSat)
|
||||
|
||||
// Ensure that the initial balance of the remote party (if pushing
|
||||
// satoshis) does not execeed the amount the local party has requested
|
||||
// satoshis) does not exceed the amount the local party has requested
|
||||
// for funding.
|
||||
if remoteInitialBalance >= localFundingAmt {
|
||||
return fmt.Errorf("amount pushed to remote peer for initial " +
|
||||
"state must be below the local funding amount")
|
||||
}
|
||||
|
||||
// Ensure that the user doesn't exceed the current soft-limit for
|
||||
// channel size. If the funding amount is above the soft-limit, then
|
||||
// we'll reject the request.
|
||||
if localFundingAmt > maxFundingAmount {
|
||||
return fmt.Errorf("funding amount is too large, the max "+
|
||||
"channel size is: %v", maxFundingAmount)
|
||||
}
|
||||
|
||||
const minChannelSize = btcutil.Amount(6000)
|
||||
|
||||
// Restrict the size of the channel we'll actually open. Atm, we
|
||||
|
||||
Reference in new issue
Block a user