mirror of
https://github.com/lightningnetwork/lnd.git
synced 2024-11-19 01:43:16 +01:00
multi: allow specifying max csv for locally initiated channels
This commit is contained in:
parent
f4136decae
commit
91bf59df17
@ -132,6 +132,9 @@ type reservationWithCtx struct {
|
||||
remoteMaxValue lnwire.MilliSatoshi
|
||||
remoteMaxHtlcs uint16
|
||||
|
||||
// maxLocalCsv is the maximum csv we will accept from the remote.
|
||||
maxLocalCsv uint16
|
||||
|
||||
updateMtx sync.RWMutex
|
||||
lastUpdated time.Time
|
||||
|
||||
@ -1404,6 +1407,7 @@ func (f *fundingManager) handleFundingOpen(peer lnpeer.Peer,
|
||||
remoteMinHtlc: minHtlc,
|
||||
remoteMaxValue: remoteMaxValue,
|
||||
remoteMaxHtlcs: maxHtlcs,
|
||||
maxLocalCsv: f.cfg.MaxLocalCSVDelay,
|
||||
err: make(chan error, 1),
|
||||
peer: peer,
|
||||
}
|
||||
@ -1532,7 +1536,7 @@ func (f *fundingManager) handleFundingAccept(peer lnpeer.Peer,
|
||||
CsvDelay: msg.CsvDelay,
|
||||
}
|
||||
err = resCtx.reservation.CommitConstraints(
|
||||
channelConstraints, f.cfg.MaxLocalCSVDelay,
|
||||
channelConstraints, resCtx.maxLocalCsv,
|
||||
)
|
||||
if err != nil {
|
||||
fndgLog.Warnf("Unacceptable channel constraints: %v", err)
|
||||
@ -3064,8 +3068,15 @@ func (f *fundingManager) handleInitFundingMsg(msg *initFundingMsg) {
|
||||
remoteCsvDelay = msg.remoteCsvDelay
|
||||
maxValue = msg.maxValueInFlight
|
||||
maxHtlcs = msg.maxHtlcs
|
||||
maxCSV = msg.maxLocalCsv
|
||||
)
|
||||
|
||||
// If no maximum CSV delay was set for this channel, we use our default
|
||||
// value.
|
||||
if maxCSV == 0 {
|
||||
maxCSV = f.cfg.MaxLocalCSVDelay
|
||||
}
|
||||
|
||||
// We'll determine our dust limit depending on which chain is active.
|
||||
var ourDustLimit btcutil.Amount
|
||||
switch f.cfg.RegisteredChains.PrimaryChain() {
|
||||
@ -3221,6 +3232,7 @@ func (f *fundingManager) handleInitFundingMsg(msg *initFundingMsg) {
|
||||
remoteMinHtlc: minHtlcIn,
|
||||
remoteMaxValue: maxValue,
|
||||
remoteMaxHtlcs: maxHtlcs,
|
||||
maxLocalCsv: maxCSV,
|
||||
reservation: reservation,
|
||||
peer: msg.peer,
|
||||
updates: msg.updates,
|
||||
|
1530
lnrpc/rpc.pb.go
1530
lnrpc/rpc.pb.go
File diff suppressed because it is too large
Load Diff
@ -1750,6 +1750,12 @@ message OpenChannelRequest {
|
||||
to the commitment transaction.
|
||||
*/
|
||||
uint32 remote_max_htlcs = 16;
|
||||
|
||||
/*
|
||||
Max local csv is the maximum csv delay we will allow for our own commitment
|
||||
transaction.
|
||||
*/
|
||||
uint32 max_local_csv = 17;
|
||||
}
|
||||
message OpenStatusUpdate {
|
||||
oneof update {
|
||||
|
@ -4617,6 +4617,11 @@
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"description": "The maximum number of concurrent HTLCs we will allow the remote party to add\nto the commitment transaction."
|
||||
},
|
||||
"max_local_csv": {
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"description": "Max local csv is the maximum csv delay we will allow for our own commitment\ntransaction."
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -1900,6 +1900,7 @@ func (r *rpcServer) parseOpenChannelReq(in *lnrpc.OpenChannelRequest,
|
||||
shutdownScript: script,
|
||||
maxValueInFlight: maxValue,
|
||||
maxHtlcs: maxHtlcs,
|
||||
maxLocalCsv: uint16(in.MaxLocalCsv),
|
||||
}, nil
|
||||
}
|
||||
|
||||
|
@ -3384,6 +3384,10 @@ type openChanReq struct {
|
||||
|
||||
maxHtlcs uint16
|
||||
|
||||
// maxLocalCsv is the maximum local csv delay we will accept from our
|
||||
// peer.
|
||||
maxLocalCsv uint16
|
||||
|
||||
// TODO(roasbeef): add ability to specify channel constraints as well
|
||||
|
||||
// chanFunder is an optional channel funder that allows the caller to
|
||||
|
Loading…
Reference in New Issue
Block a user