mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-17 17:33:47 +00:00
Merge pull request #234 from ethersphere/fixup-swarm-network-rewrite-syncer
swarm/network: fix light node code so that it compiles
This commit is contained in:
commit
dc0acb72a8
6 changed files with 14 additions and 7 deletions
|
|
@ -117,6 +117,8 @@ func (r *RemoteSectionReader) Read(b []byte) (n int64, err error) {
|
|||
}
|
||||
}
|
||||
|
||||
func (r *RemoteSectionReader) Close() {}
|
||||
|
||||
// RemoteSectionServer implements OutgoingStreamer
|
||||
type RemoteSectionServer struct {
|
||||
// quit chan struct{}
|
||||
|
|
@ -134,12 +136,12 @@ func NewRemoteSectionServer(db *storage.DBAPI, r *storage.LazyChunkReader) *Remo
|
|||
}
|
||||
|
||||
// GetData retrieves the actual chunk from localstore
|
||||
func (s *RemoteSectionServer) GetData(key []byte) []byte {
|
||||
func (s *RemoteSectionServer) GetData(key []byte) ([]byte, error) {
|
||||
chunk, err := s.db.Get(storage.Key(key))
|
||||
if err != nil {
|
||||
return nil
|
||||
return nil, err
|
||||
}
|
||||
return chunk.SData
|
||||
return chunk.SData, nil
|
||||
}
|
||||
|
||||
// GetBatch retrieves the next batch of hashes from the dbstore
|
||||
|
|
@ -152,6 +154,8 @@ func (s *RemoteSectionServer) SetNextBatch(from, to uint64) ([]byte, uint64, uin
|
|||
return batch, from, to, nil, nil
|
||||
}
|
||||
|
||||
func (s *RemoteSectionServer) Close() {}
|
||||
|
||||
// RegisterRemoteSectionReader registers RemoteSectionReader on light downstream node
|
||||
func RegisterRemoteSectionReader(s *stream.Registry, db *storage.DBAPI) {
|
||||
s.RegisterClientFunc("REMOTE_SECTION", func(p *stream.Peer, t []byte) (stream.Client, error) {
|
||||
|
|
|
|||
1
swarm/network/simulations/discovery/discovery.go
Normal file
1
swarm/network/simulations/discovery/discovery.go
Normal file
|
|
@ -0,0 +1 @@
|
|||
package discovery
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package discovery_test
|
||||
package discovery
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
|
@ -319,5 +319,5 @@ func newService(ctx *adapters.ServiceContext) (node.Service, error) {
|
|||
HiveParams: hp,
|
||||
}
|
||||
|
||||
return network.NewBzz(config, kad, nil, nil), nil
|
||||
return network.NewBzz(config, kad, nil), nil
|
||||
}
|
||||
|
|
|
|||
|
|
@ -77,6 +77,8 @@ func (self *testClient) BatchDone(string, uint64, []byte, []byte) func() (*Takeo
|
|||
return nil
|
||||
}
|
||||
|
||||
func (self *testClient) Close() {}
|
||||
|
||||
func (self *testServer) SetNextBatch(from uint64, to uint64) ([]byte, uint64, uint64, *HandoverProof, error) {
|
||||
return make([]byte, HashSize), from + 1, to + 1, nil, nil
|
||||
}
|
||||
|
|
|
|||
|
|
@ -260,7 +260,7 @@ func newServices() adapters.Services {
|
|||
UnderlayAddr: addr.Under(),
|
||||
HiveParams: hp,
|
||||
}
|
||||
return network.NewBzz(config, kademlia(ctx.Config.ID), stateStore, nil), nil
|
||||
return network.NewBzz(config, kademlia(ctx.Config.ID), stateStore), nil
|
||||
},
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1178,7 +1178,7 @@ func newServices() adapters.Services {
|
|||
UnderlayAddr: addr.Under(),
|
||||
HiveParams: hp,
|
||||
}
|
||||
return network.NewBzz(config, kademlia(ctx.Config.ID), stateStore, nil), nil
|
||||
return network.NewBzz(config, kademlia(ctx.Config.ID), stateStore), nil
|
||||
},
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue