Skip to content

Commit 6e9372a

Browse files
committed
chanbackup: make sure onion addresses are covered in tests
1 parent cbdd1c2 commit 6e9372a

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

chanbackup/backup_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ func TestFetchStaticChanBackups(t *testing.T) {
156156
chanSource.chans[randomChan2.FundingOutpoint] = randomChan2
157157
chanSource.addAddrsForNode(randomChan1.IdentityPub, []net.Addr{addr1})
158158
chanSource.addAddrsForNode(randomChan2.IdentityPub, []net.Addr{addr2})
159+
chanSource.addAddrsForNode(randomChan2.IdentityPub, []net.Addr{addr3})
159160

160161
// With the channel source populated, we'll now attempt to create a set
161162
// of backups for all the channels. This should succeed, as all items

chanbackup/multi_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ func TestMultiPackUnpack(t *testing.T) {
2222
t.Fatalf("unable to gen channel: %v", err)
2323
}
2424

25-
single := NewSingle(channel, []net.Addr{addr1, addr2})
25+
single := NewSingle(channel, []net.Addr{addr1, addr2, addr3})
2626

2727
originalSingles = append(originalSingles, single)
2828
multi.StaticBackups = append(multi.StaticBackups, single)

chanbackup/single_test.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import (
1818
"github.com/lightningnetwork/lnd/lnencrypt"
1919
"github.com/lightningnetwork/lnd/lnwire"
2020
"github.com/lightningnetwork/lnd/shachain"
21+
"github.com/lightningnetwork/lnd/tor"
2122
"github.com/stretchr/testify/require"
2223
)
2324

@@ -36,6 +37,10 @@ var (
3637

3738
addr1, _ = net.ResolveTCPAddr("tcp", "10.0.0.2:9000")
3839
addr2, _ = net.ResolveTCPAddr("tcp", "10.0.0.3:9000")
40+
addr3 = &tor.OnionAddr{
41+
OnionService: "3g2upl4pq6kufc4m.onion",
42+
Port: 9735,
43+
}
3944
)
4045

4146
func assertSingleEqual(t *testing.T, a, b Single) {
@@ -309,7 +314,7 @@ func TestSinglePackUnpack(t *testing.T) {
309314
channel, err := genRandomOpenChannelShell()
310315
require.NoError(t, err, "unable to gen open channel")
311316

312-
singleChanBackup := NewSingle(channel, []net.Addr{addr1, addr2})
317+
singleChanBackup := NewSingle(channel, []net.Addr{addr1, addr2, addr3})
313318

314319
keyRing := &lnencrypt.MockKeyRing{}
315320

@@ -634,7 +639,7 @@ func TestSingleUnconfirmedChannel(t *testing.T) {
634639
channel.ShortChannelID.BlockHeight = 0
635640
channel.FundingBroadcastHeight = fundingBroadcastHeight
636641

637-
singleChanBackup := NewSingle(channel, []net.Addr{addr1, addr2})
642+
singleChanBackup := NewSingle(channel, []net.Addr{addr1, addr2, addr3})
638643
keyRing := &lnencrypt.MockKeyRing{}
639644

640645
// Pack it and then unpack it again to make sure everything is written

0 commit comments

Comments
 (0)