Commit 23c3ca51 authored by Juan Batiz-Benet's avatar Juan Batiz-Benet

bugfix: use consistent interface

We'll want a `type blocks.Block interface {}` later, but
for now, make sure Blockstore uses ptrs for both Get and Put.

+ fix NewBlock output compile error
parent e66cbaca
......@@ -134,7 +134,7 @@ func (bs *bitswap) ReceiveMessage(ctx context.Context, p *peer.Peer, incoming bs
for _, block := range incoming.Blocks() {
// TODO verify blocks?
if err := bs.blockstore.Put(block); err != nil {
if err := bs.blockstore.Put(&block); err != nil {
continue // FIXME(brian): err ignored
}
go bs.notifications.Publish(block)
......
......@@ -67,7 +67,7 @@ func TestGetBlockFromPeerAfterPeerAnnounces(t *testing.T) {
hasBlock := g.Next()
if err := hasBlock.blockstore.Put(*block); err != nil {
if err := hasBlock.blockstore.Put(block); err != nil {
t.Fatal(err)
}
if err := hasBlock.exchange.HasBlock(context.Background(), *block); err != nil {
......@@ -106,7 +106,7 @@ func TestSwarm(t *testing.T) {
first := instances[0]
for _, b := range blocks {
first.blockstore.Put(*b)
first.blockstore.Put(b)
first.exchange.HasBlock(context.Background(), *b)
rs.Announce(first.peer, b.Key())
}
......@@ -177,7 +177,7 @@ func TestSendToWantingPeer(t *testing.T) {
beta := bg.Next()
t.Logf("Peer %v announes availability of %v\n", w.peer, beta.Key())
ctx, _ = context.WithTimeout(context.Background(), timeout)
if err := w.blockstore.Put(beta); err != nil {
if err := w.blockstore.Put(&beta); err != nil {
t.Fatal(err)
}
w.exchange.HasBlock(ctx, beta)
......@@ -190,7 +190,7 @@ func TestSendToWantingPeer(t *testing.T) {
t.Logf("%v announces availability of %v\n", o.peer, alpha.Key())
ctx, _ = context.WithTimeout(context.Background(), timeout)
if err := o.blockstore.Put(alpha); err != nil {
if err := o.blockstore.Put(&alpha); err != nil {
t.Fatal(err)
}
o.exchange.HasBlock(ctx, alpha)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment