Commit c11cf9a0 authored by Brian Tiger Chow's avatar Brian Tiger Chow Committed by Juan Batiz-Benet

rm unused method

License: MIT
Signed-off-by: default avatarBrian Tiger Chow <brian@perfmode.com>
parent c8f74e55
...@@ -96,16 +96,6 @@ func (e *Engine) Peers() []peer.Peer { ...@@ -96,16 +96,6 @@ func (e *Engine) Peers() []peer.Peer {
return response return response
} }
// BlockIsWantedByPeer returns true if peer wants the block given by this
// key
func (e *Engine) BlockIsWantedByPeer(k u.Key, p peer.Peer) bool {
e.lock.RLock()
defer e.lock.RUnlock()
ledger := e.findOrCreate(p)
return ledger.WantListContains(k)
}
// MessageReceived performs book-keeping. Returns error if passed invalid // MessageReceived performs book-keeping. Returns error if passed invalid
// arguments. // arguments.
func (e *Engine) MessageReceived(p peer.Peer, m bsmsg.BitSwapMessage) error { func (e *Engine) MessageReceived(p peer.Peer, m bsmsg.BitSwapMessage) error {
......
...@@ -60,23 +60,6 @@ func TestConsistentAccounting(t *testing.T) { ...@@ -60,23 +60,6 @@ func TestConsistentAccounting(t *testing.T) {
} }
} }
func TestBlockRecordedAsWantedAfterMessageReceived(t *testing.T) {
beggar := newPeerAndLedgermanager("can't be chooser")
chooser := newPeerAndLedgermanager("chooses JIF")
block := blocks.NewBlock([]byte("data wanted by beggar"))
messageFromBeggarToChooser := message.New()
messageFromBeggarToChooser.AddEntry(block.Key(), 1)
chooser.Engine.MessageReceived(beggar.Peer, messageFromBeggarToChooser)
// for this test, doesn't matter if you record that beggar sent
if !chooser.Engine.BlockIsWantedByPeer(block.Key(), beggar.Peer) {
t.Fatal("chooser failed to record that beggar wants block")
}
}
func TestPeerIsAddedToPeersWhenMessageReceivedOrSent(t *testing.T) { func TestPeerIsAddedToPeersWhenMessageReceivedOrSent(t *testing.T) {
sanfrancisco := newPeerAndLedgermanager("sf") sanfrancisco := newPeerAndLedgermanager("sf")
......
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