mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-17 17:33:47 +00:00
swarm/network: fix light node code so that it compiles
This commit is contained in:
parent
00a4fdf503
commit
6098446d55
3 changed files with 9 additions and 4 deletions
|
|
@ -117,6 +117,8 @@ func (r *RemoteSectionReader) Read(b []byte) (n int64, err error) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (r *RemoteSectionReader) Close() {}
|
||||||
|
|
||||||
// RemoteSectionServer implements OutgoingStreamer
|
// RemoteSectionServer implements OutgoingStreamer
|
||||||
type RemoteSectionServer struct {
|
type RemoteSectionServer struct {
|
||||||
// quit chan struct{}
|
// quit chan struct{}
|
||||||
|
|
@ -134,12 +136,12 @@ func NewRemoteSectionServer(db *storage.DBAPI, r *storage.LazyChunkReader) *Remo
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetData retrieves the actual chunk from localstore
|
// 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))
|
chunk, err := s.db.Get(storage.Key(key))
|
||||||
if err != nil {
|
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
|
// 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
|
return batch, from, to, nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *RemoteSectionServer) Close() {}
|
||||||
|
|
||||||
// RegisterRemoteSectionReader registers RemoteSectionReader on light downstream node
|
// RegisterRemoteSectionReader registers RemoteSectionReader on light downstream node
|
||||||
func RegisterRemoteSectionReader(s *stream.Registry, db *storage.DBAPI) {
|
func RegisterRemoteSectionReader(s *stream.Registry, db *storage.DBAPI) {
|
||||||
s.RegisterClientFunc("REMOTE_SECTION", func(p *stream.Peer, t []byte) (stream.Client, error) {
|
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 (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue