mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-03-28 18:51:47 +01:00
htlcswitch: make link forward eligibility flush aware
This commit is contained in:
parent
6955dc9f12
commit
70292253d1
@ -538,10 +538,19 @@ func (l *channelLink) WaitForShutdown() {
|
|||||||
|
|
||||||
// EligibleToForward returns a bool indicating if the channel is able to
|
// EligibleToForward returns a bool indicating if the channel is able to
|
||||||
// actively accept requests to forward HTLC's. We're able to forward HTLC's if
|
// actively accept requests to forward HTLC's. We're able to forward HTLC's if
|
||||||
// we know the remote party's next revocation point. Otherwise, we can't
|
// we are eligible to update AND the channel isn't currently flushing the
|
||||||
// initiate new channel state. We also require that the short channel ID not be
|
// outgoing half of the channel.
|
||||||
// the all-zero source ID, meaning that the channel has had its ID finalized.
|
|
||||||
func (l *channelLink) EligibleToForward() bool {
|
func (l *channelLink) EligibleToForward() bool {
|
||||||
|
return l.EligibleToUpdate() &&
|
||||||
|
!l.IsFlushing(Outgoing)
|
||||||
|
}
|
||||||
|
|
||||||
|
// EligibleToUpdate returns a bool indicating if the channel is able to update
|
||||||
|
// channel state. We're able to update channel state if we know the remote
|
||||||
|
// party's next revocation point. Otherwise, we can't initiate new channel
|
||||||
|
// state. We also require that the short channel ID not be the all-zero source
|
||||||
|
// ID, meaning that the channel has had its ID finalized.
|
||||||
|
func (l *channelLink) EligibleToUpdate() bool {
|
||||||
return l.channel.RemoteNextRevocation() != nil &&
|
return l.channel.RemoteNextRevocation() != nil &&
|
||||||
l.ShortChanID() != hop.Source &&
|
l.ShortChanID() != hop.Source &&
|
||||||
l.isReestablished()
|
l.isReestablished()
|
||||||
@ -2831,7 +2840,7 @@ func (l *channelLink) updateChannelFee(feePerKw chainfee.SatPerKWeight) error {
|
|||||||
|
|
||||||
// We skip sending the UpdateFee message if the channel is not
|
// We skip sending the UpdateFee message if the channel is not
|
||||||
// currently eligible to forward messages.
|
// currently eligible to forward messages.
|
||||||
if !l.EligibleToForward() {
|
if !l.EligibleToUpdate() {
|
||||||
l.log.Debugf("skipping fee update for inactive channel")
|
l.log.Debugf("skipping fee update for inactive channel")
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user