server: Add max value in flight to server

This commit is contained in:
vctt94
2018-08-29 18:44:23 -03:00
parent 01ba4d0b59
commit 474ce4ae25
3 changed files with 17 additions and 10 deletions

View File

@@ -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)

View File

@@ -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
@@ -1822,6 +1823,7 @@ func (r *rpcServer) parseOpenChannelReq(in *lnrpc.OpenChannelRequest,
remoteCsvDelay: remoteCsvDelay,
minConfs: minConfs,
shutdownScript: script,
maxValueInFlight: maxValue,
}, nil
}

View File

@@ -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