diff --git a/htlcswitch/link.go b/htlcswitch/link.go index 9f801b997..4df5996fb 100644 --- a/htlcswitch/link.go +++ b/htlcswitch/link.go @@ -1807,7 +1807,7 @@ func (l *channelLink) HtlcSatifiesPolicy(payHash [32]byte, // to the current height. timeDelta := policy.TimeLockDelta if incomingTimeout-timeDelta <= heightNow { - log.Errorf("htlc(%x) has an expiry that's too soon: "+ + l.errorf("htlc(%x) has an expiry that's too soon: "+ "outgoing_expiry=%v, best_height=%v", payHash[:], incomingTimeout-timeDelta, heightNow) @@ -1829,7 +1829,7 @@ func (l *channelLink) HtlcSatifiesPolicy(payHash [32]byte, // delta should equal the outgoing time lock. Otherwise, whether the // sender messed up, or an intermediate node tampered with the HTLC. if incomingTimeout-timeDelta < outgoingTimeout { - log.Errorf("Incoming htlc(%x) has incorrect time-lock value: "+ + l.errorf("Incoming htlc(%x) has incorrect time-lock value: "+ "expected at least %v block delta, got %v block delta", payHash[:], timeDelta, incomingTimeout-outgoingTimeout) diff --git a/htlcswitch/switch.go b/htlcswitch/switch.go index 1d649d732..122402386 100644 --- a/htlcswitch/switch.go +++ b/htlcswitch/switch.go @@ -964,9 +964,11 @@ func (s *Switch) handlePacketForward(packet *htlcPacket) error { // Before we check the link's bandwidth, we'll ensure // that the HTLC satisfies the current forwarding // policy of this target link. + currentHeight := atomic.LoadUint32(&s.bestHeight) err := link.HtlcSatifiesPolicy( htlc.PaymentHash, packet.incomingAmount, - packet.amount, + packet.amount, packet.incomingTimeout, + packet.outgoingTimeout, currentHeight, ) if err != nil { linkErrs[link.ShortChanID()] = err @@ -1404,6 +1406,7 @@ out: } atomic.StoreUint32(&s.bestHeight, uint32(blockEpoch.Height)) + // A local close request has arrived, we'll forward this to the // relevant link (if it exists) so the channel can be // cooperatively closed (if possible).