Skip to content

Commit 01dfee6

Browse files
authored
Merge pull request #10004 from ellemouton/ensureNewNodeAnnUpdateTime
multi: use "errors" pkg everywhere and ensure newer node announcement timestamp
2 parents e8213db + 0862ba3 commit 01dfee6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+141
-110
lines changed

channeldb/db.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"bytes"
55
"context"
66
"encoding/binary"
7+
"errors"
78
"fmt"
89
"net"
910
"os"
@@ -12,7 +13,6 @@ import (
1213
"github.com/btcsuite/btcd/btcec/v2"
1314
"github.com/btcsuite/btcd/wire"
1415
"github.com/btcsuite/btcwallet/walletdb"
15-
"github.com/go-errors/errors"
1616
mig "github.com/lightningnetwork/lnd/channeldb/migration"
1717
"github.com/lightningnetwork/lnd/channeldb/migration12"
1818
"github.com/lightningnetwork/lnd/channeldb/migration13"

channeldb/meta_test.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@ package channeldb
22

33
import (
44
"bytes"
5+
"errors"
6+
"fmt"
57
"testing"
68

79
"github.com/btcsuite/btcwallet/walletdb"
8-
"github.com/go-errors/errors"
910
"github.com/lightningnetwork/lnd/kvdb"
1011
"github.com/stretchr/testify/require"
1112
)
@@ -48,7 +49,7 @@ func applyMigration(t *testing.T, beforeMigration, afterMigration func(d *DB),
4849
if dryRun && r != ErrDryRunMigrationOK {
4950
t.Fatalf("expected dry run migration OK")
5051
}
51-
err = errors.New(r)
52+
err = fmt.Errorf("%v", r)
5253
}
5354

5455
if err == nil && shouldFail {

channeldb/migration/lnwire21/lnwire.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package lnwire
33
import (
44
"bytes"
55
"encoding/binary"
6+
"errors"
67
"fmt"
78
"image/color"
89
"io"
@@ -13,7 +14,6 @@ import (
1314
"github.com/btcsuite/btcd/btcutil"
1415
"github.com/btcsuite/btcd/chaincfg/chainhash"
1516
"github.com/btcsuite/btcd/wire"
16-
"github.com/go-errors/errors"
1717
"github.com/lightningnetwork/lnd/tor"
1818
)
1919

channeldb/migration/lnwire21/onion_error.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import (
99
"io"
1010

1111
"github.com/davecgh/go-spew/spew"
12-
"github.com/go-errors/errors"
1312
"github.com/lightningnetwork/lnd/tlv"
1413
)
1514

@@ -1451,7 +1450,7 @@ func makeEmptyOnionError(code FailCode) (FailureMessage, error) {
14511450
return &FailInvalidBlinding{}, nil
14521451

14531452
default:
1454-
return nil, errors.Errorf("unknown error code: %v", code)
1453+
return nil, fmt.Errorf("unknown error code: %v", code)
14551454
}
14561455
}
14571456

channeldb/migration_01_to_11/meta_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
package migration_01_to_11
22

33
import (
4+
"fmt"
45
"testing"
56

6-
"github.com/go-errors/errors"
77
"github.com/lightningnetwork/lnd/kvdb"
88
)
99

@@ -33,7 +33,7 @@ func applyMigration(t *testing.T, beforeMigration, afterMigration func(d *DB),
3333

3434
defer func() {
3535
if r := recover(); r != nil {
36-
err = errors.New(r)
36+
err = fmt.Errorf("%v", r)
3737
}
3838

3939
if err == nil && shouldFail {

channeldb/migration_01_to_11/migrations_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"bytes"
55
"crypto/sha256"
66
"encoding/binary"
7+
"errors"
78
"fmt"
89
"math/rand"
910
"reflect"
@@ -12,7 +13,6 @@ import (
1213

1314
"github.com/btcsuite/btcd/btcutil"
1415
"github.com/davecgh/go-spew/spew"
15-
"github.com/go-errors/errors"
1616
lnwire "github.com/lightningnetwork/lnd/channeldb/migration/lnwire21"
1717
"github.com/lightningnetwork/lnd/kvdb"
1818
"github.com/lightningnetwork/lnd/lntypes"

channeldb/waitingproof.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ package channeldb
33
import (
44
"bytes"
55
"encoding/binary"
6+
"errors"
67
"fmt"
78
"io"
89
"sync"
910

10-
"github.com/go-errors/errors"
1111
"github.com/lightningnetwork/lnd/kvdb"
1212
"github.com/lightningnetwork/lnd/lnwire"
1313
)

channeldb/waitingproof_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
package channeldb
22

33
import (
4+
"errors"
45
"reflect"
56
"testing"
67

78
"github.com/davecgh/go-spew/spew"
8-
"github.com/go-errors/errors"
99
"github.com/lightningnetwork/lnd/lnwire"
1010
"github.com/stretchr/testify/require"
1111
)

contractcourt/breach_arbitrator_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
crand "crypto/rand"
66
"crypto/sha256"
77
"encoding/binary"
8+
"errors"
89
"fmt"
910
"io"
1011
"math/rand"
@@ -19,7 +20,6 @@ import (
1920
"github.com/btcsuite/btcd/chaincfg/chainhash"
2021
"github.com/btcsuite/btcd/txscript"
2122
"github.com/btcsuite/btcd/wire"
22-
"github.com/go-errors/errors"
2323
"github.com/lightningnetwork/lnd/chainntnfs"
2424
"github.com/lightningnetwork/lnd/channeldb"
2525
"github.com/lightningnetwork/lnd/fn/v2"

discovery/gossiper_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"bytes"
55
"context"
66
"encoding/hex"
7+
"errors"
78
"fmt"
89
prand "math/rand"
910
"net"
@@ -20,7 +21,6 @@ import (
2021
"github.com/btcsuite/btcd/chaincfg/chainhash"
2122
"github.com/btcsuite/btcd/wire"
2223
"github.com/davecgh/go-spew/spew"
23-
"github.com/go-errors/errors"
2424
"github.com/lightninglabs/neutrino/cache"
2525
"github.com/lightningnetwork/lnd/batch"
2626
"github.com/lightningnetwork/lnd/chainntnfs"

0 commit comments

Comments
 (0)