funding: use remoteCsvDelay from openChanReq if specified
This commit is contained in:
parent
208d1199ef
commit
a848a58749
@ -1079,7 +1079,7 @@ func (f *fundingManager) handleFundingOpen(fmsg *fundingOpenMsg) {
|
|||||||
ChannelReserve: chanReserve,
|
ChannelReserve: chanReserve,
|
||||||
MinAcceptDepth: uint32(numConfsReq),
|
MinAcceptDepth: uint32(numConfsReq),
|
||||||
HtlcMinimum: ourContribution.MinHTLC,
|
HtlcMinimum: ourContribution.MinHTLC,
|
||||||
CsvDelay: uint16(remoteCsvDelay),
|
CsvDelay: remoteCsvDelay,
|
||||||
MaxAcceptedHTLCs: maxHtlcs,
|
MaxAcceptedHTLCs: maxHtlcs,
|
||||||
FundingKey: ourContribution.MultiSigKey.PubKey,
|
FundingKey: ourContribution.MultiSigKey.PubKey,
|
||||||
RevocationPoint: ourContribution.RevocationBasePoint.PubKey,
|
RevocationPoint: ourContribution.RevocationBasePoint.PubKey,
|
||||||
@ -2466,13 +2466,13 @@ func (f *fundingManager) initFundingWorkflow(peerAddress *lnwire.NetAddress,
|
|||||||
// funding workflow.
|
// funding workflow.
|
||||||
func (f *fundingManager) handleInitFundingMsg(msg *initFundingMsg) {
|
func (f *fundingManager) handleInitFundingMsg(msg *initFundingMsg) {
|
||||||
var (
|
var (
|
||||||
// TODO(roasbeef): add delay
|
peerKey = msg.peerAddress.IdentityKey
|
||||||
peerKey = msg.peerAddress.IdentityKey
|
localAmt = msg.localFundingAmt
|
||||||
localAmt = msg.localFundingAmt
|
remoteAmt = msg.remoteFundingAmt
|
||||||
remoteAmt = msg.remoteFundingAmt
|
capacity = localAmt + remoteAmt
|
||||||
capacity = localAmt + remoteAmt
|
ourDustLimit = lnwallet.DefaultDustLimit()
|
||||||
ourDustLimit = lnwallet.DefaultDustLimit()
|
minHtlc = msg.minHtlc
|
||||||
minHtlc = msg.minHtlc
|
remoteCsvDelay = msg.remoteCsvDelay
|
||||||
)
|
)
|
||||||
|
|
||||||
fndgLog.Infof("Initiating fundingRequest(localAmt=%v, remoteAmt=%v, "+
|
fndgLog.Infof("Initiating fundingRequest(localAmt=%v, remoteAmt=%v, "+
|
||||||
@ -2544,9 +2544,12 @@ func (f *fundingManager) handleInitFundingMsg(msg *initFundingMsg) {
|
|||||||
// Update the timestamp once the initFundingMsg has been handled.
|
// Update the timestamp once the initFundingMsg has been handled.
|
||||||
defer resCtx.updateTimestamp()
|
defer resCtx.updateTimestamp()
|
||||||
|
|
||||||
// Using the RequiredRemoteDelay closure, we'll compute the remote CSV
|
// If the remote CSV delay was not set in the open channel request,
|
||||||
// delay we require given the total amount of funds within the channel.
|
// we'll use the RequiredRemoteDelay closure to compute the delay we
|
||||||
remoteCsvDelay := f.cfg.RequiredRemoteDelay(capacity)
|
// require given the total amount of funds within the channel.
|
||||||
|
if remoteCsvDelay == 0 {
|
||||||
|
remoteCsvDelay = f.cfg.RequiredRemoteDelay(capacity)
|
||||||
|
}
|
||||||
|
|
||||||
// If no minimum HTLC value was specified, use the default one.
|
// If no minimum HTLC value was specified, use the default one.
|
||||||
if minHtlc == 0 {
|
if minHtlc == 0 {
|
||||||
@ -2578,7 +2581,7 @@ func (f *fundingManager) handleInitFundingMsg(msg *initFundingMsg) {
|
|||||||
ChannelReserve: chanReserve,
|
ChannelReserve: chanReserve,
|
||||||
HtlcMinimum: ourContribution.MinHTLC,
|
HtlcMinimum: ourContribution.MinHTLC,
|
||||||
FeePerKiloWeight: uint32(commitFeePerKw),
|
FeePerKiloWeight: uint32(commitFeePerKw),
|
||||||
CsvDelay: uint16(remoteCsvDelay),
|
CsvDelay: remoteCsvDelay,
|
||||||
MaxAcceptedHTLCs: maxHtlcs,
|
MaxAcceptedHTLCs: maxHtlcs,
|
||||||
FundingKey: ourContribution.MultiSigKey.PubKey,
|
FundingKey: ourContribution.MultiSigKey.PubKey,
|
||||||
RevocationPoint: ourContribution.RevocationBasePoint.PubKey,
|
RevocationPoint: ourContribution.RevocationBasePoint.PubKey,
|
||||||
|
Loading…
Reference in New Issue
Block a user