chanbackup: make sure onion addresses are covered in tests
This commit is contained in:
3 files changed
+9
-3
No files matched your search
@@ -156,6 +156,7 @@ func TestFetchStaticChanBackups(t *testing.T) {
|
|||||||
chanSource.chans[randomChan2.FundingOutpoint] = randomChan2
|
chanSource.chans[randomChan2.FundingOutpoint] = randomChan2
|
||||||
chanSource.addAddrsForNode(randomChan1.IdentityPub, []net.Addr{addr1})
|
chanSource.addAddrsForNode(randomChan1.IdentityPub, []net.Addr{addr1})
|
||||||
chanSource.addAddrsForNode(randomChan2.IdentityPub, []net.Addr{addr2})
|
chanSource.addAddrsForNode(randomChan2.IdentityPub, []net.Addr{addr2})
|
||||||
|
chanSource.addAddrsForNode(randomChan2.IdentityPub, []net.Addr{addr3})
|
||||||
|
|
||||||
// With the channel source populated, we'll now attempt to create a set
|
// With the channel source populated, we'll now attempt to create a set
|
||||||
// of backups for all the channels. This should succeed, as all items
|
// of backups for all the channels. This should succeed, as all items
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ func TestMultiPackUnpack(t *testing.T) {
|
|||||||
t.Fatalf("unable to gen channel: %v", err)
|
t.Fatalf("unable to gen channel: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
single := NewSingle(channel, []net.Addr{addr1, addr2})
|
single := NewSingle(channel, []net.Addr{addr1, addr2, addr3})
|
||||||
|
|
||||||
originalSingles = append(originalSingles, single)
|
originalSingles = append(originalSingles, single)
|
||||||
multi.StaticBackups = append(multi.StaticBackups, single)
|
multi.StaticBackups = append(multi.StaticBackups, single)
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ import (
|
|||||||
"github.com/lightningnetwork/lnd/lnencrypt"
|
"github.com/lightningnetwork/lnd/lnencrypt"
|
||||||
"github.com/lightningnetwork/lnd/lnwire"
|
"github.com/lightningnetwork/lnd/lnwire"
|
||||||
"github.com/lightningnetwork/lnd/shachain"
|
"github.com/lightningnetwork/lnd/shachain"
|
||||||
|
"github.com/lightningnetwork/lnd/tor"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -36,6 +37,10 @@ var (
|
|||||||
|
|
||||||
addr1, _ = net.ResolveTCPAddr("tcp", "10.0.0.2:9000")
|
addr1, _ = net.ResolveTCPAddr("tcp", "10.0.0.2:9000")
|
||||||
addr2, _ = net.ResolveTCPAddr("tcp", "10.0.0.3:9000")
|
addr2, _ = net.ResolveTCPAddr("tcp", "10.0.0.3:9000")
|
||||||
|
addr3 = &tor.OnionAddr{
|
||||||
|
OnionService: "3g2upl4pq6kufc4m.onion",
|
||||||
|
Port: 9735,
|
||||||
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
func assertSingleEqual(t *testing.T, a, b Single) {
|
func assertSingleEqual(t *testing.T, a, b Single) {
|
||||||
@@ -309,7 +314,7 @@ func TestSinglePackUnpack(t *testing.T) {
|
|||||||
channel, err := genRandomOpenChannelShell()
|
channel, err := genRandomOpenChannelShell()
|
||||||
require.NoError(t, err, "unable to gen open channel")
|
require.NoError(t, err, "unable to gen open channel")
|
||||||
|
|
||||||
singleChanBackup := NewSingle(channel, []net.Addr{addr1, addr2})
|
singleChanBackup := NewSingle(channel, []net.Addr{addr1, addr2, addr3})
|
||||||
|
|
||||||
keyRing := &lnencrypt.MockKeyRing{}
|
keyRing := &lnencrypt.MockKeyRing{}
|
||||||
|
|
||||||
@@ -634,7 +639,7 @@ func TestSingleUnconfirmedChannel(t *testing.T) {
|
|||||||
channel.ShortChannelID.BlockHeight = 0
|
channel.ShortChannelID.BlockHeight = 0
|
||||||
channel.FundingBroadcastHeight = fundingBroadcastHeight
|
channel.FundingBroadcastHeight = fundingBroadcastHeight
|
||||||
|
|
||||||
singleChanBackup := NewSingle(channel, []net.Addr{addr1, addr2})
|
singleChanBackup := NewSingle(channel, []net.Addr{addr1, addr2, addr3})
|
||||||
keyRing := &lnencrypt.MockKeyRing{}
|
keyRing := &lnencrypt.MockKeyRing{}
|
||||||
|
|
||||||
// Pack it and then unpack it again to make sure everything is written
|
// Pack it and then unpack it again to make sure everything is written
|
||||||
|
|||||||
Reference in new issue
Block a user