mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-06-13 02:11:03 +02: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
|
remoteMaxValue lnwire.MilliSatoshi
|
||||||
remoteMaxHtlcs uint16
|
remoteMaxHtlcs uint16
|
||||||
|
|
||||||
|
// maxLocalCsv is the maximum csv we will accept from the remote.
|
||||||
|
maxLocalCsv uint16
|
||||||
|
|
||||||
updateMtx sync.RWMutex
|
updateMtx sync.RWMutex
|
||||||
lastUpdated time.Time
|
lastUpdated time.Time
|
||||||
|
|
||||||
@ -1404,6 +1407,7 @@ func (f *fundingManager) handleFundingOpen(peer lnpeer.Peer,
|
|||||||
remoteMinHtlc: minHtlc,
|
remoteMinHtlc: minHtlc,
|
||||||
remoteMaxValue: remoteMaxValue,
|
remoteMaxValue: remoteMaxValue,
|
||||||
remoteMaxHtlcs: maxHtlcs,
|
remoteMaxHtlcs: maxHtlcs,
|
||||||
|
maxLocalCsv: f.cfg.MaxLocalCSVDelay,
|
||||||
err: make(chan error, 1),
|
err: make(chan error, 1),
|
||||||
peer: peer,
|
peer: peer,
|
||||||
}
|
}
|
||||||
@ -1532,7 +1536,7 @@ func (f *fundingManager) handleFundingAccept(peer lnpeer.Peer,
|
|||||||
CsvDelay: msg.CsvDelay,
|
CsvDelay: msg.CsvDelay,
|
||||||
}
|
}
|
||||||
err = resCtx.reservation.CommitConstraints(
|
err = resCtx.reservation.CommitConstraints(
|
||||||
channelConstraints, f.cfg.MaxLocalCSVDelay,
|
channelConstraints, resCtx.maxLocalCsv,
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fndgLog.Warnf("Unacceptable channel constraints: %v", err)
|
fndgLog.Warnf("Unacceptable channel constraints: %v", err)
|
||||||
@ -3064,8 +3068,15 @@ func (f *fundingManager) handleInitFundingMsg(msg *initFundingMsg) {
|
|||||||
remoteCsvDelay = msg.remoteCsvDelay
|
remoteCsvDelay = msg.remoteCsvDelay
|
||||||
maxValue = msg.maxValueInFlight
|
maxValue = msg.maxValueInFlight
|
||||||
maxHtlcs = msg.maxHtlcs
|
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.
|
// We'll determine our dust limit depending on which chain is active.
|
||||||
var ourDustLimit btcutil.Amount
|
var ourDustLimit btcutil.Amount
|
||||||
switch f.cfg.RegisteredChains.PrimaryChain() {
|
switch f.cfg.RegisteredChains.PrimaryChain() {
|
||||||
@ -3221,6 +3232,7 @@ func (f *fundingManager) handleInitFundingMsg(msg *initFundingMsg) {
|
|||||||
remoteMinHtlc: minHtlcIn,
|
remoteMinHtlc: minHtlcIn,
|
||||||
remoteMaxValue: maxValue,
|
remoteMaxValue: maxValue,
|
||||||
remoteMaxHtlcs: maxHtlcs,
|
remoteMaxHtlcs: maxHtlcs,
|
||||||
|
maxLocalCsv: maxCSV,
|
||||||
reservation: reservation,
|
reservation: reservation,
|
||||||
peer: msg.peer,
|
peer: msg.peer,
|
||||||
updates: msg.updates,
|
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.
|
to the commitment transaction.
|
||||||
*/
|
*/
|
||||||
uint32 remote_max_htlcs = 16;
|
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 {
|
message OpenStatusUpdate {
|
||||||
oneof update {
|
oneof update {
|
||||||
|
@ -4617,6 +4617,11 @@
|
|||||||
"type": "integer",
|
"type": "integer",
|
||||||
"format": "int64",
|
"format": "int64",
|
||||||
"description": "The maximum number of concurrent HTLCs we will allow the remote party to add\nto the commitment transaction."
|
"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,
|
shutdownScript: script,
|
||||||
maxValueInFlight: maxValue,
|
maxValueInFlight: maxValue,
|
||||||
maxHtlcs: maxHtlcs,
|
maxHtlcs: maxHtlcs,
|
||||||
|
maxLocalCsv: uint16(in.MaxLocalCsv),
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3384,6 +3384,10 @@ type openChanReq struct {
|
|||||||
|
|
||||||
maxHtlcs uint16
|
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
|
// 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
|
||||||
|
Loading…
x
Reference in New Issue
Block a user