diff options
Diffstat (limited to 'swarm/network')
-rw-r--r-- | swarm/network/bitvector/bitvector.go | 4 | ||||
-rw-r--r-- | swarm/network/protocol.go | 7 | ||||
-rw-r--r-- | swarm/network/protocol_test.go | 25 | ||||
-rw-r--r-- | swarm/network/stream/intervals/store_test.go | 3 | ||||
-rw-r--r-- | swarm/network/stream/stream.go | 8 | ||||
-rw-r--r-- | swarm/network/stream/syncer.go | 56 |
6 files changed, 3 insertions, 100 deletions
diff --git a/swarm/network/bitvector/bitvector.go b/swarm/network/bitvector/bitvector.go index edc7c50cb..958328502 100644 --- a/swarm/network/bitvector/bitvector.go +++ b/swarm/network/bitvector/bitvector.go @@ -60,7 +60,3 @@ func (bv *BitVector) Set(i int, v bool) { func (bv *BitVector) Bytes() []byte { return bv.b } - -func (bv *BitVector) Length() int { - return bv.len -} diff --git a/swarm/network/protocol.go b/swarm/network/protocol.go index 4b9b28cdc..a4b29239c 100644 --- a/swarm/network/protocol.go +++ b/swarm/network/protocol.go @@ -35,8 +35,6 @@ import ( const ( DefaultNetworkID = 3 - // ProtocolMaxMsgSize maximum allowed message size - ProtocolMaxMsgSize = 10 * 1024 * 1024 // timeout for waiting bzzHandshakeTimeout = 3000 * time.Millisecond ) @@ -250,11 +248,6 @@ func NewBzzPeer(p *protocols.Peer) *BzzPeer { return &BzzPeer{Peer: p, BzzAddr: NewAddr(p.Node())} } -// LastActive returns the time the peer was last active -func (p *BzzPeer) LastActive() time.Time { - return p.lastActive -} - // ID returns the peer's underlay node identifier. func (p *BzzPeer) ID() enode.ID { // This is here to resolve a method tie: both protocols.Peer and BzzAddr are embedded diff --git a/swarm/network/protocol_test.go b/swarm/network/protocol_test.go index 53ceda744..58477a7b8 100644 --- a/swarm/network/protocol_test.go +++ b/swarm/network/protocol_test.go @@ -20,7 +20,6 @@ import ( "flag" "fmt" "os" - "sync" "testing" "github.com/ethereum/go-ethereum/log" @@ -44,31 +43,7 @@ func init() { log.Root().SetHandler(log.LvlFilterHandler(log.Lvl(*loglevel), log.StreamHandler(os.Stderr, log.TerminalFormat(true)))) } -type testStore struct { - sync.Mutex - - values map[string][]byte -} - -func (t *testStore) Load(key string) ([]byte, error) { - t.Lock() - defer t.Unlock() - v, ok := t.values[key] - if !ok { - return nil, fmt.Errorf("key not found: %s", key) - } - return v, nil -} - -func (t *testStore) Save(key string, v []byte) error { - t.Lock() - defer t.Unlock() - t.values[key] = v - return nil -} - func HandshakeMsgExchange(lhs, rhs *HandshakeMsg, id enode.ID) []p2ptest.Exchange { - return []p2ptest.Exchange{ { Expects: []p2ptest.Expect{ diff --git a/swarm/network/stream/intervals/store_test.go b/swarm/network/stream/intervals/store_test.go index 0ab14c065..a36814b71 100644 --- a/swarm/network/stream/intervals/store_test.go +++ b/swarm/network/stream/intervals/store_test.go @@ -17,14 +17,11 @@ package intervals import ( - "errors" "testing" "github.com/ethereum/go-ethereum/swarm/state" ) -var ErrNotFound = errors.New("not found") - // TestInmemoryStore tests basic functionality of InmemoryStore. func TestInmemoryStore(t *testing.T) { testStore(t, state.NewInmemoryStore()) diff --git a/swarm/network/stream/stream.go b/swarm/network/stream/stream.go index 32e107823..090bef8d1 100644 --- a/swarm/network/stream/stream.go +++ b/swarm/network/stream/stream.go @@ -388,14 +388,6 @@ func (r *Registry) Quit(peerId enode.ID, s Stream) error { return peer.Send(context.TODO(), msg) } -func (r *Registry) NodeInfo() interface{} { - return nil -} - -func (r *Registry) PeerInfo(id enode.ID) interface{} { - return nil -} - func (r *Registry) Close() error { return r.intervalsStore.Close() } diff --git a/swarm/network/stream/syncer.go b/swarm/network/stream/syncer.go index 4bfbac8b0..4fb8b9342 100644 --- a/swarm/network/stream/syncer.go +++ b/swarm/network/stream/syncer.go @@ -127,19 +127,9 @@ func (s *SwarmSyncerServer) SetNextBatch(from, to uint64) ([]byte, uint64, uint6 // SwarmSyncerClient type SwarmSyncerClient struct { - sessionAt uint64 - nextC chan struct{} - sessionRoot storage.Address - sessionReader storage.LazySectionReader - retrieveC chan *storage.Chunk - storeC chan *storage.Chunk - store storage.SyncChunkStore - // chunker storage.Chunker - currentRoot storage.Address - requestFunc func(chunk *storage.Chunk) - end, start uint64 - peer *Peer - stream Stream + store storage.SyncChunkStore + peer *Peer + stream Stream } // NewSwarmSyncerClient is a contructor for provable data exchange syncer @@ -209,46 +199,6 @@ func (s *SwarmSyncerClient) BatchDone(stream Stream, from uint64, hashes []byte, return nil } -func (s *SwarmSyncerClient) TakeoverProof(stream Stream, from uint64, hashes []byte, root storage.Address) (*TakeoverProof, error) { - // for provable syncer currentRoot is non-zero length - // TODO: reenable this with putter/getter - // if s.chunker != nil { - // if from > s.sessionAt { // for live syncing currentRoot is always updated - // //expRoot, err := s.chunker.Append(s.currentRoot, bytes.NewReader(hashes), s.retrieveC, s.storeC) - // expRoot, _, err := s.chunker.Append(s.currentRoot, bytes.NewReader(hashes), s.retrieveC) - // if err != nil { - // return nil, err - // } - // if !bytes.Equal(root, expRoot) { - // return nil, fmt.Errorf("HandoverProof mismatch") - // } - // s.currentRoot = root - // } else { - // expHashes := make([]byte, len(hashes)) - // _, err := s.sessionReader.ReadAt(expHashes, int64(s.end*HashSize)) - // if err != nil && err != io.EOF { - // return nil, err - // } - // if !bytes.Equal(expHashes, hashes) { - // return nil, errors.New("invalid proof") - // } - // } - // return nil, nil - // } - s.end += uint64(len(hashes)) / HashSize - takeover := &Takeover{ - Stream: stream, - Start: s.start, - End: s.end, - Root: root, - } - // serialise and sign - return &TakeoverProof{ - Takeover: takeover, - Sig: nil, - }, nil -} - func (s *SwarmSyncerClient) Close() {} // base for parsing and formating sync bin key |