diff --git a/p2p/protocols/accounting.go b/p2p/protocols/accounting.go index 37f58c13f5..bdc490e591 100644 --- a/p2p/protocols/accounting.go +++ b/p2p/protocols/accounting.go @@ -130,7 +130,6 @@ func SetupAccountingMetrics(reportInterval time.Duration, path string) *Accounti return NewAccountingMetrics(MetricsRegistry, reportInterval, path) } -// Implement Hook.Send // Send takes a peer, a size and a msg and // - calculates the cost for the local node sending a msg of size to peer using the Prices interface // - credits/debits local node using balance interface @@ -150,7 +149,6 @@ func (ah *Accounting) Send(peer *Peer, size uint32, msg interface{}) error { return err } -// Implement Hook.Receive // Receive takes a peer, a size and a msg and // - calculates the cost for the local node receiving a msg of size from peer using the Prices interface // - credits/debits local node using balance interface diff --git a/swarm/network/stream/stream.go b/swarm/network/stream/stream.go index bb9415cef9..d30d68dac8 100644 --- a/swarm/network/stream/stream.go +++ b/swarm/network/stream/stream.go @@ -110,7 +110,7 @@ func NewRegistry(localID enode.ID, delivery *Delivery, syncChunkStore storage.Sy if options.SyncUpdateDelay <= 0 { options.SyncUpdateDelay = 15 * time.Second } - // check if retriaval has been disabled + // check if retrieval has been disabled retrieval := options.Retrieval != RetrievalDisabled streamer := &Registry{ diff --git a/swarm/network/stream/streamer_test.go b/swarm/network/stream/streamer_test.go index 16c74d3b34..74b796b3dd 100644 --- a/swarm/network/stream/streamer_test.go +++ b/swarm/network/stream/streamer_test.go @@ -921,3 +921,31 @@ func TestMaxPeerServersWithoutUnsubscribe(t *testing.T) { } } } + +func TestRetrievalIsBilled(t *testing.T) { +} + +func TestHasPriceImplementation(t *testing.T) { + _, r, _, teardown, err := newStreamerTester(t, &RegistryOptions{ + Retrieval: RetrievalDisabled, + Syncing: SyncingDisabled, + }) + defer teardown() + if err != nil { + t.Fatal(err) + } + + if r.prices == nil { + t.Fatal("No prices implementation available for the stream protocol") + } + + price := r.prices.Price(&ChunkDeliveryMsgRetrieval{}) + if price == nil || price.Value == 0 { + t.Fatal("No prices set for chunk delivery msg") + } + + price = r.prices.Price(&RetrieveRequestMsg{}) + if price == nil || price.Value == 0 { + t.Fatal("No prices set for chunk delivery msg") + } +}