htlcswitch: ensure links are eligible to forward when selecting outgoing links
In this commit, when selecting a candidate link to forward a payment, we’ll ensure that it’s actually able to take on the HTLC. Otherwise, we’ll skip over the link itself. Currently, a link is only fully eligible for forwarding, *after* we’ve received and fully processed the FundingLocked message.
This commit is contained in:
parent
36956d390f
commit
be1a96b78a
@ -366,7 +366,9 @@ func (s *Switch) handleLocalDispatch(payment *pendingPayment, packet *htlcPacket
|
||||
)
|
||||
for _, link := range links {
|
||||
bandwidth := link.Bandwidth()
|
||||
if bandwidth > largestBandwidth {
|
||||
if link.EligibleToForward() &&
|
||||
bandwidth > largestBandwidth {
|
||||
|
||||
largestBandwidth = bandwidth
|
||||
}
|
||||
|
||||
@ -488,7 +490,9 @@ func (s *Switch) handlePacketForward(packet *htlcPacket) error {
|
||||
// bandwidth.
|
||||
var destination ChannelLink
|
||||
for _, link := range interfaceLinks {
|
||||
if link.Bandwidth() >= htlc.Amount {
|
||||
if link.EligibleToForward() &&
|
||||
link.Bandwidth() >= htlc.Amount {
|
||||
|
||||
destination = link
|
||||
break
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user