Skip to content

Commit 085cc53

Browse files
committed
fixup! feat(libp2p): add v1.0.0 network compatibility
1 parent c11befc commit 085cc53

2 files changed

Lines changed: 9 additions & 10 deletions

File tree

impl/graphsync_test.go

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ import (
4343
"github.com/ipfs/go-graphsync/donotsendfirstblocks"
4444
"github.com/ipfs/go-graphsync/ipldutil"
4545
gsmsg "github.com/ipfs/go-graphsync/message"
46-
"github.com/ipfs/go-graphsync/network"
4746
gsnet "github.com/ipfs/go-graphsync/network"
4847
"github.com/ipfs/go-graphsync/requestmanager/hooks"
4948
"github.com/ipfs/go-graphsync/storeutil"
@@ -62,9 +61,9 @@ var protocolsForTest = map[string]struct {
6261
host2Protocols []protocol.ID
6362
}{
6463
"(v1.1 -> v1.1)": {nil, nil},
65-
"(v1.0 -> v1.1)": {[]protocol.ID{network.ProtocolGraphsync_1_0_0}, nil},
66-
"(v1.1 -> v1.0)": {nil, []protocol.ID{network.ProtocolGraphsync_1_0_0}},
67-
"(v1.0 -> v1.0)": {[]protocol.ID{network.ProtocolGraphsync_1_0_0}, []protocol.ID{network.ProtocolGraphsync_1_0_0}},
64+
"(v1.0 -> v1.1)": {[]protocol.ID{gsnet.ProtocolGraphsync_1_0_0}, nil},
65+
"(v1.1 -> v1.0)": {nil, []protocol.ID{gsnet.ProtocolGraphsync_1_0_0}},
66+
"(v1.0 -> v1.0)": {[]protocol.ID{gsnet.ProtocolGraphsync_1_0_0}, []protocol.ID{gsnet.ProtocolGraphsync_1_0_0}},
6867
}
6968

7069
func TestMakeRequestToNetwork(t *testing.T) {
@@ -1723,14 +1722,14 @@ func newOptionalGsTestData(ctx context.Context, t *testing.T, network1Protocols
17231722
err = td.mn.LinkAll()
17241723
require.NoError(t, err, "error linking hosts")
17251724

1726-
opts := make([]network.Option, 0)
1725+
opts := make([]gsnet.Option, 0)
17271726
if network1Protocols != nil {
1728-
opts = append(opts, network.GraphsyncProtocols(network1Protocols))
1727+
opts = append(opts, gsnet.GraphsyncProtocols(network1Protocols))
17291728
}
17301729
td.gsnet1 = gsnet.NewFromLibp2pHost(td.host1, opts...)
1731-
opts = make([]network.Option, 0)
1730+
opts = make([]gsnet.Option, 0)
17321731
if network2Protocols != nil {
1733-
opts = append(opts, network.GraphsyncProtocols(network2Protocols))
1732+
opts = append(opts, gsnet.GraphsyncProtocols(network2Protocols))
17341733
}
17351734
td.gsnet2 = gsnet.NewFromLibp2pHost(td.host2, opts...)
17361735
td.blockStore1 = make(map[ipld.Link][]byte)

message/message.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ func (gsr GraphSyncRequest) String() string {
5959
var buf bytes.Buffer
6060
dagjson.Encode(gsr.selector, &buf)
6161
ext := make([]string, 0)
62-
for s, _ := range gsr.extensions {
62+
for s := range gsr.extensions {
6363
ext = append(ext, s)
6464
}
6565
return fmt.Sprintf("GraphSyncRequest<root=%s, selector=%s, priority=%d, id=%s, cancel=%v, update=%v, exts=%s>",
@@ -84,7 +84,7 @@ type GraphSyncResponse struct {
8484
// String returns a human-readable form of a GraphSyncResponse
8585
func (gsr GraphSyncResponse) String() string {
8686
ext := make([]string, 0)
87-
for s, _ := range gsr.extensions {
87+
for s := range gsr.extensions {
8888
ext = append(ext, s)
8989
}
9090
return fmt.Sprintf("GraphSyncResponse<id=%s, status=%d, exts=%s>",

0 commit comments

Comments
 (0)