dont put wantlist getter in exchange interface
Jeromy committed
Feb 23, 2015 at 11:47 UTC
3c8a391fe441ead322b865457947df2d2819e553
3 files changed
+6
-8
core/commands/bitswap.go
+6
-1
@@ -33,8 +33,13 @@ Print out all blocks currently on the bitswap wantlist for the local peer`,
33
res.SetError(err, cmds.ErrNormal)
34
return
35
}
36
+ bs, ok := nd.Exchange.(*bitswap.Bitswap)
37
+ if !ok {
38
+ res.SetError(u.ErrCast(), cmds.ErrNormal)
39
+ return
40
+ }
41
37
- res.SetOutput(&KeyList{nd.Exchange.GetWantlist()})
42
+ res.SetOutput(&KeyList{bs.GetWantlist()})
43
},
44
Marshalers: cmds.MarshalerMap{
45
cmds.Text: KeyListTextMarshaler,
exchange/interface.go
-2
@@ -21,7 +21,5 @@ type Interface interface {
21
// available on the network?
22
HasBlock(context.Context, *blocks.Block) error
23
24
- GetWantlist() []u.Key
25
-
24
io.Closer
25
}
exchange/offline/offline.go
-5
@@ -66,8 +66,3 @@ func (e *offlineExchange) GetBlocks(ctx context.Context, ks []u.Key) (<-chan *bl
66
}()
67
return out, nil
68
}
69
-
70
-// implement Exchange
71
-func (e *offlineExchange) GetWantlist() []u.Key {
72
- return nil
73
-}