From 3c8a391fe441ead322b865457947df2d2819e553 Mon Sep 17 00:00:00 2001 From: Jeromy Date: Mon, 23 Feb 2015 11:47:49 -0800 Subject: [PATCH] dont put wantlist getter in exchange interface --- core/commands/bitswap.go | 7 ++++++- exchange/interface.go | 2 -- exchange/offline/offline.go | 5 ----- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/core/commands/bitswap.go b/core/commands/bitswap.go index 32854a381..284e75e13 100644 --- a/core/commands/bitswap.go +++ b/core/commands/bitswap.go @@ -33,8 +33,13 @@ Print out all blocks currently on the bitswap wantlist for the local peer`, res.SetError(err, cmds.ErrNormal) return } + bs, ok := nd.Exchange.(*bitswap.Bitswap) + if !ok { + res.SetError(u.ErrCast(), cmds.ErrNormal) + return + } - res.SetOutput(&KeyList{nd.Exchange.GetWantlist()}) + res.SetOutput(&KeyList{bs.GetWantlist()}) }, Marshalers: cmds.MarshalerMap{ cmds.Text: KeyListTextMarshaler, diff --git a/exchange/interface.go b/exchange/interface.go index 8a4189ee8..c07d2a471 100644 --- a/exchange/interface.go +++ b/exchange/interface.go @@ -21,7 +21,5 @@ type Interface interface { // available on the network? HasBlock(context.Context, *blocks.Block) error - GetWantlist() []u.Key - io.Closer } diff --git a/exchange/offline/offline.go b/exchange/offline/offline.go index e3e50bbf4..fe8fa723c 100644 --- a/exchange/offline/offline.go +++ b/exchange/offline/offline.go @@ -66,8 +66,3 @@ func (e *offlineExchange) GetBlocks(ctx context.Context, ks []u.Key) (<-chan *bl }() return out, nil } - -// implement Exchange -func (e *offlineExchange) GetWantlist() []u.Key { - return nil -}