server: Add max value in flight to server
This commit is contained in:
1 parent
01ba4d0b59
commit
474ce4ae25
3 files changed
+17
-10
No files matched your search
@@ -106,6 +106,7 @@ func (c *chanController) OpenChannel(target *btcec.PublicKey,
|
|||||||
private: c.private,
|
private: c.private,
|
||||||
remoteCsvDelay: 0,
|
remoteCsvDelay: 0,
|
||||||
minConfs: c.minConfs,
|
minConfs: c.minConfs,
|
||||||
|
maxValueInFlight: 0,
|
||||||
}
|
}
|
||||||
|
|
||||||
updateStream, errChan := c.server.OpenChannel(req)
|
updateStream, errChan := c.server.OpenChannel(req)
|
||||||
|
|||||||
+12
-10
@@ -1710,6 +1710,7 @@ func (r *rpcServer) parseOpenChannelReq(in *lnrpc.OpenChannelRequest,
|
|||||||
remoteInitialBalance := btcutil.Amount(in.PushSat)
|
remoteInitialBalance := btcutil.Amount(in.PushSat)
|
||||||
minHtlcIn := lnwire.MilliSatoshi(in.MinHtlcMsat)
|
minHtlcIn := lnwire.MilliSatoshi(in.MinHtlcMsat)
|
||||||
remoteCsvDelay := uint16(in.RemoteCsvDelay)
|
remoteCsvDelay := uint16(in.RemoteCsvDelay)
|
||||||
|
maxValue := lnwire.MilliSatoshi(in.MaxValueInFlight)
|
||||||
|
|
||||||
// Ensure that the initial balance of the remote party (if pushing
|
// Ensure that the initial balance of the remote party (if pushing
|
||||||
// satoshis) does not exceed the amount the local party has requested
|
// satoshis) does not exceed the amount the local party has requested
|
||||||
@@ -1812,16 +1813,17 @@ func (r *rpcServer) parseOpenChannelReq(in *lnrpc.OpenChannelRequest,
|
|||||||
// open a new channel. A stream is returned in place, this stream will
|
// open a new channel. A stream is returned in place, this stream will
|
||||||
// be used to consume updates of the state of the pending channel.
|
// be used to consume updates of the state of the pending channel.
|
||||||
return &openChanReq{
|
return &openChanReq{
|
||||||
targetPubkey: nodePubKey,
|
targetPubkey: nodePubKey,
|
||||||
chainHash: *activeNetParams.GenesisHash,
|
chainHash: *activeNetParams.GenesisHash,
|
||||||
localFundingAmt: localFundingAmt,
|
localFundingAmt: localFundingAmt,
|
||||||
pushAmt: lnwire.NewMSatFromSatoshis(remoteInitialBalance),
|
pushAmt: lnwire.NewMSatFromSatoshis(remoteInitialBalance),
|
||||||
minHtlcIn: minHtlcIn,
|
minHtlcIn: minHtlcIn,
|
||||||
fundingFeePerKw: feeRate,
|
fundingFeePerKw: feeRate,
|
||||||
private: in.Private,
|
private: in.Private,
|
||||||
remoteCsvDelay: remoteCsvDelay,
|
remoteCsvDelay: remoteCsvDelay,
|
||||||
minConfs: minConfs,
|
minConfs: minConfs,
|
||||||
shutdownScript: script,
|
shutdownScript: script,
|
||||||
|
maxValueInFlight: maxValue,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3179,6 +3179,10 @@ type openChanReq struct {
|
|||||||
// This value is optional, so may be nil.
|
// This value is optional, so may be nil.
|
||||||
shutdownScript lnwire.DeliveryAddress
|
shutdownScript lnwire.DeliveryAddress
|
||||||
|
|
||||||
|
// maxValueInFlight is the maximum amount of coins in millisatoshi that can
|
||||||
|
// be pending within the channel. It only applies to the remote party.
|
||||||
|
maxValueInFlight lnwire.MilliSatoshi
|
||||||
|
|
||||||
// TODO(roasbeef): add ability to specify channel constraints as well
|
// TODO(roasbeef): add ability to specify channel constraints as well
|
||||||
|
|
||||||
// chanFunder is an optional channel funder that allows the caller to
|
// chanFunder is an optional channel funder that allows the caller to
|
||||||
|
|||||||
Reference in new issue
Block a user