mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-02-23 14:40:30 +01:00
rpcserver: parse channel fees into InitFundingMsg
This commit is contained in:
parent
e87412bd63
commit
1e030c2d48
1 changed files with 12 additions and 1 deletions
13
rpcserver.go
13
rpcserver.go
|
@ -1922,12 +1922,21 @@ func (r *rpcServer) parseOpenChannelReq(in *lnrpc.OpenChannelRequest,
|
||||||
// satoshis) does not exceed the amount the local party has requested
|
// satoshis) does not exceed the amount the local party has requested
|
||||||
// for funding.
|
// for funding.
|
||||||
//
|
//
|
||||||
// TODO(roasbeef): incorporate base fee?
|
|
||||||
if remoteInitialBalance >= localFundingAmt {
|
if remoteInitialBalance >= localFundingAmt {
|
||||||
return nil, fmt.Errorf("amount pushed to remote peer for " +
|
return nil, fmt.Errorf("amount pushed to remote peer for " +
|
||||||
"initial state must be below the local funding amount")
|
"initial state must be below the local funding amount")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Determine if the user provided channel fees
|
||||||
|
// and if so pass them on to the funding workflow.
|
||||||
|
var channelBaseFee, channelFeeRate *uint64
|
||||||
|
if in.UseBaseFee {
|
||||||
|
channelBaseFee = &in.BaseFee
|
||||||
|
}
|
||||||
|
if in.UseFeeRate {
|
||||||
|
channelFeeRate = &in.FeeRate
|
||||||
|
}
|
||||||
|
|
||||||
// Ensure that the user doesn't exceed the current soft-limit for
|
// Ensure that the user doesn't exceed the current soft-limit for
|
||||||
// channel size. If the funding amount is above the soft-limit, then
|
// channel size. If the funding amount is above the soft-limit, then
|
||||||
// we'll reject the request.
|
// we'll reject the request.
|
||||||
|
@ -2086,6 +2095,8 @@ func (r *rpcServer) parseOpenChannelReq(in *lnrpc.OpenChannelRequest,
|
||||||
TargetPubkey: nodePubKey,
|
TargetPubkey: nodePubKey,
|
||||||
ChainHash: *r.cfg.ActiveNetParams.GenesisHash,
|
ChainHash: *r.cfg.ActiveNetParams.GenesisHash,
|
||||||
LocalFundingAmt: localFundingAmt,
|
LocalFundingAmt: localFundingAmt,
|
||||||
|
BaseFee: channelBaseFee,
|
||||||
|
FeeRate: channelFeeRate,
|
||||||
PushAmt: lnwire.NewMSatFromSatoshis(remoteInitialBalance),
|
PushAmt: lnwire.NewMSatFromSatoshis(remoteInitialBalance),
|
||||||
MinHtlcIn: minHtlcIn,
|
MinHtlcIn: minHtlcIn,
|
||||||
FundingFeePerKw: feeRate,
|
FundingFeePerKw: feeRate,
|
||||||
|
|
Loading…
Add table
Reference in a new issue