diff --git a/pilot.go b/pilot.go index 64e5eff2..76303941 100644 --- a/pilot.go +++ b/pilot.go @@ -106,6 +106,7 @@ func (c *chanController) OpenChannel(target *btcec.PublicKey, private: c.private, remoteCsvDelay: 0, minConfs: c.minConfs, + maxValueInFlight: 0, } updateStream, errChan := c.server.OpenChannel(req) diff --git a/rpcserver.go b/rpcserver.go index bf0e2071..1342d743 100644 --- a/rpcserver.go +++ b/rpcserver.go @@ -1710,6 +1710,7 @@ func (r *rpcServer) parseOpenChannelReq(in *lnrpc.OpenChannelRequest, remoteInitialBalance := btcutil.Amount(in.PushSat) minHtlcIn := lnwire.MilliSatoshi(in.MinHtlcMsat) remoteCsvDelay := uint16(in.RemoteCsvDelay) + maxValue := lnwire.MilliSatoshi(in.MaxValueInFlight) // Ensure that the initial balance of the remote party (if pushing // 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 // be used to consume updates of the state of the pending channel. return &openChanReq{ - targetPubkey: nodePubKey, - chainHash: *activeNetParams.GenesisHash, - localFundingAmt: localFundingAmt, - pushAmt: lnwire.NewMSatFromSatoshis(remoteInitialBalance), - minHtlcIn: minHtlcIn, - fundingFeePerKw: feeRate, - private: in.Private, - remoteCsvDelay: remoteCsvDelay, - minConfs: minConfs, - shutdownScript: script, + targetPubkey: nodePubKey, + chainHash: *activeNetParams.GenesisHash, + localFundingAmt: localFundingAmt, + pushAmt: lnwire.NewMSatFromSatoshis(remoteInitialBalance), + minHtlcIn: minHtlcIn, + fundingFeePerKw: feeRate, + private: in.Private, + remoteCsvDelay: remoteCsvDelay, + minConfs: minConfs, + shutdownScript: script, + maxValueInFlight: maxValue, }, nil } diff --git a/server.go b/server.go index 3cd357a0..0b32012a 100644 --- a/server.go +++ b/server.go @@ -3179,6 +3179,10 @@ type openChanReq struct { // This value is optional, so may be nil. 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 // chanFunder is an optional channel funder that allows the caller to