fundingmanager: use minHtlc from initFundingMsg
This commit makes the fundingmanager read the minHtlc field of the initFundingMsg, and add it to the reservation as this node's htlc_minimum_msat for the open_channel message. If the field is not specified in the initFundingMsg, the default value found in the DefaultRoutingPolicy will be used.
This commit is contained in:
1 file changed
+9
-1
+9
-1
@@ -2101,6 +2101,8 @@ func (f *fundingManager) newChanAnnouncement(localPubKey, remotePubKey *btcec.Pu
|
|||||||
chanFlags = 1
|
chanFlags = 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// We announce the channel with the default values. Some of
|
||||||
|
// these values can later be changed by crafting a new ChannelUpdate.
|
||||||
chanUpdateAnn := &lnwire.ChannelUpdate{
|
chanUpdateAnn := &lnwire.ChannelUpdate{
|
||||||
ShortChannelID: shortChanID,
|
ShortChannelID: shortChanID,
|
||||||
ChainHash: chainHash,
|
ChainHash: chainHash,
|
||||||
@@ -2252,6 +2254,7 @@ func (f *fundingManager) handleInitFundingMsg(msg *initFundingMsg) {
|
|||||||
remoteAmt = msg.remoteFundingAmt
|
remoteAmt = msg.remoteFundingAmt
|
||||||
capacity = localAmt + remoteAmt
|
capacity = localAmt + remoteAmt
|
||||||
ourDustLimit = lnwallet.DefaultDustLimit()
|
ourDustLimit = lnwallet.DefaultDustLimit()
|
||||||
|
minHtlc = msg.minHtlc
|
||||||
)
|
)
|
||||||
|
|
||||||
fndgLog.Infof("Initiating fundingRequest(localAmt=%v, remoteAmt=%v, "+
|
fndgLog.Infof("Initiating fundingRequest(localAmt=%v, remoteAmt=%v, "+
|
||||||
@@ -2321,9 +2324,14 @@ func (f *fundingManager) handleInitFundingMsg(msg *initFundingMsg) {
|
|||||||
// delay we require given the total amount of funds within the channel.
|
// delay we require given the total amount of funds within the channel.
|
||||||
remoteCsvDelay := f.cfg.RequiredRemoteDelay(capacity)
|
remoteCsvDelay := f.cfg.RequiredRemoteDelay(capacity)
|
||||||
|
|
||||||
|
// If no minimum HTLC value was specified, use the default one.
|
||||||
|
if minHtlc == 0 {
|
||||||
|
minHtlc = f.cfg.DefaultRoutingPolicy.MinHTLC
|
||||||
|
}
|
||||||
|
|
||||||
// Once the reservation has been created, and indexed, queue a funding
|
// Once the reservation has been created, and indexed, queue a funding
|
||||||
// request to the remote peer, kicking off the funding workflow.
|
// request to the remote peer, kicking off the funding workflow.
|
||||||
reservation.RegisterMinHTLC(f.cfg.DefaultRoutingPolicy.MinHTLC)
|
reservation.RegisterMinHTLC(minHtlc)
|
||||||
ourContribution := reservation.OurContribution()
|
ourContribution := reservation.OurContribution()
|
||||||
|
|
||||||
// Finally, we'll use the current value of the channels and our default
|
// Finally, we'll use the current value of the channels and our default
|
||||||
|
|||||||
Reference in new issue
Block a user