Merge pull request #1643 from cfromknecht/fail-expiry-too-soon

[htlcswitch/link] use FailFinalExpiryTooSoon as exit hop
This commit is contained in:
Olaoluwa Osuntokun 2018-07-29 23:05:35 -04:00 committed by GitHub
commit 804598057d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 7 deletions

@ -9,6 +9,7 @@ import (
"sync/atomic"
"time"
"github.com/btcsuite/btcd/chaincfg/chainhash"
"github.com/davecgh/go-spew/spew"
"github.com/go-errors/errors"
"github.com/lightningnetwork/lnd/channeldb"
@ -17,7 +18,6 @@ import (
"github.com/lightningnetwork/lnd/lnpeer"
"github.com/lightningnetwork/lnd/lnwallet"
"github.com/lightningnetwork/lnd/lnwire"
"github.com/btcsuite/btcd/chaincfg/chainhash"
)
func init() {
@ -2155,7 +2155,7 @@ func (l *channelLink) processRemoteAdds(fwdPkg *channeldb.FwdPkg,
"soon: expiry=%v, best_height=%v",
pd.RHash[:], pd.Timeout, heightNow)
failure := lnwire.FailFinalIncorrectCltvExpiry{}
failure := lnwire.FailFinalExpiryTooSoon{}
l.sendHTLCError(
pd.HtlcIndex, &failure, obfuscator, pd.SourceRef,
)

@ -15,6 +15,10 @@ import (
"testing"
"time"
"github.com/btcsuite/btcd/btcec"
"github.com/btcsuite/btcd/chaincfg/chainhash"
"github.com/btcsuite/btcd/wire"
"github.com/btcsuite/btcutil"
"github.com/coreos/bbolt"
"github.com/davecgh/go-spew/spew"
"github.com/go-errors/errors"
@ -24,10 +28,6 @@ import (
"github.com/lightningnetwork/lnd/lnpeer"
"github.com/lightningnetwork/lnd/lnwallet"
"github.com/lightningnetwork/lnd/lnwire"
"github.com/btcsuite/btcd/btcec"
"github.com/btcsuite/btcd/chaincfg/chainhash"
"github.com/btcsuite/btcd/wire"
"github.com/btcsuite/btcutil"
)
const (
@ -1247,7 +1247,7 @@ func TestChannelLinkExpiryTooSoonExitNode(t *testing.T) {
}
switch ferr.FailureMessage.(type) {
case *lnwire.FailFinalIncorrectCltvExpiry:
case *lnwire.FailFinalExpiryTooSoon:
default:
t.Fatalf("incorrect error, expected final time lock too "+
"early, instead have: %v", err)