Skip to content
This repository was archived by the owner on Mar 9, 2022. It is now read-only.

Commit a2a309d

Browse files
committed
Removed Peers from migration config
1 parent 852f7f8 commit a2a309d

File tree

2 files changed

+1
-42
lines changed

2 files changed

+1
-42
lines changed

migration.go

-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
package config
22

3-
import "github.com/libp2p/go-libp2p-core/peer"
4-
53
const DefaultMigrationKeep = "cache"
64

75
var DefaultMigrationDownloadSources = []string{"HTTPS", "IPFS"}
@@ -16,7 +14,4 @@ type Migration struct {
1614
// Whether or not to keep the migration after downloading it.
1715
// Options are "discard", "cache", "pin". Empty string for default.
1816
Keep string
19-
// Peers lists the nodes to attempt to connect with when downloading
20-
// migrations.
21-
Peers []peer.AddrInfo
2217
}

migration_test.go

+1-37
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,7 @@ func TestMigrationDecode(t *testing.T) {
99
str := `
1010
{
1111
"DownloadSources": ["IPFS", "HTTP", "127.0.0.1"],
12-
"Keep": "cache",
13-
"Peers": [
14-
{
15-
"ID": "12D3KooWGC6TvWhfapngX6wvJHMYvKpDMXPb3ZnCZ6dMoaMtimQ5",
16-
"Addrs": ["/ip4/127.0.0.1/tcp/4001", "/ip4/127.0.0.1/udp/4001/quic"]
17-
},
18-
{
19-
"ID": "12D3KooWGC6TvWhfajpgX6wvJHMYvKpDMXPb3ZnCZ6dMoaMtimQ7",
20-
"Addrs": ["/ip4/10.0.0.2/tcp/4001"]
21-
}
22-
]
12+
"Keep": "cache"
2313
}
2414
`
2515

@@ -41,30 +31,4 @@ func TestMigrationDecode(t *testing.T) {
4131
if cfg.Keep != "cache" {
4232
t.Error("wrong value for Keep")
4333
}
44-
45-
if len(cfg.Peers) != 2 {
46-
t.Fatal("wrong number of peers")
47-
}
48-
49-
peer := cfg.Peers[0]
50-
if peer.ID.String() != "12D3KooWGC6TvWhfapngX6wvJHMYvKpDMXPb3ZnCZ6dMoaMtimQ5" {
51-
t.Errorf("wrong ID for first peer")
52-
}
53-
if len(peer.Addrs) != 2 {
54-
t.Error("wrong number of addrs for first peer")
55-
}
56-
if peer.Addrs[0].String() != "/ip4/127.0.0.1/tcp/4001" {
57-
t.Error("wrong first addr for first peer")
58-
}
59-
if peer.Addrs[1].String() != "/ip4/127.0.0.1/udp/4001/quic" {
60-
t.Error("wrong second addr for first peer")
61-
}
62-
63-
peer = cfg.Peers[1]
64-
if len(peer.Addrs) != 1 {
65-
t.Fatal("wrong number of addrs for second peer")
66-
}
67-
if peer.Addrs[0].String() != "/ip4/10.0.0.2/tcp/4001" {
68-
t.Error("wrong first addr for second peer")
69-
}
7034
}

0 commit comments

Comments
 (0)