htlcswitch/link: send FailFinalExpiryTooSoon from exit hop
This commit corrects our exit hop logic to return FailFinalExpiryTooSoon if the following check is true: pd.Timeout-expiryGraceDelta <= heightNow Previously we returned FailFinalIncorrectCltvExpiry, which should only be returned if the packet was misconstructed.
This commit is contained in:
parent
982a09ac60
commit
d76bacee0e
@ -9,6 +9,7 @@ import (
|
|||||||
"sync/atomic"
|
"sync/atomic"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
||||||
"github.com/davecgh/go-spew/spew"
|
"github.com/davecgh/go-spew/spew"
|
||||||
"github.com/go-errors/errors"
|
"github.com/go-errors/errors"
|
||||||
"github.com/lightningnetwork/lnd/channeldb"
|
"github.com/lightningnetwork/lnd/channeldb"
|
||||||
@ -17,7 +18,6 @@ import (
|
|||||||
"github.com/lightningnetwork/lnd/lnpeer"
|
"github.com/lightningnetwork/lnd/lnpeer"
|
||||||
"github.com/lightningnetwork/lnd/lnwallet"
|
"github.com/lightningnetwork/lnd/lnwallet"
|
||||||
"github.com/lightningnetwork/lnd/lnwire"
|
"github.com/lightningnetwork/lnd/lnwire"
|
||||||
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
@ -2155,7 +2155,7 @@ func (l *channelLink) processRemoteAdds(fwdPkg *channeldb.FwdPkg,
|
|||||||
"soon: expiry=%v, best_height=%v",
|
"soon: expiry=%v, best_height=%v",
|
||||||
pd.RHash[:], pd.Timeout, heightNow)
|
pd.RHash[:], pd.Timeout, heightNow)
|
||||||
|
|
||||||
failure := lnwire.FailFinalIncorrectCltvExpiry{}
|
failure := lnwire.FailFinalExpiryTooSoon{}
|
||||||
l.sendHTLCError(
|
l.sendHTLCError(
|
||||||
pd.HtlcIndex, &failure, obfuscator, pd.SourceRef,
|
pd.HtlcIndex, &failure, obfuscator, pd.SourceRef,
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user