diff options
author | Attila Gazso <attila.gazso@prezi.com> | 2018-10-18 01:22:37 +0800 |
---|---|---|
committer | Viktor TrĂ³n <viktor.tron@gmail.com> | 2018-10-18 01:22:37 +0800 |
commit | cdf5982cfca2cd7d5fea85c226af5e48fde837df (patch) | |
tree | adcd4a5b24d285ca72174c085bd17a898b628721 /swarm/swarm.go | |
parent | 4e693ad5a6f118dcf4f3586938c17fc8ef5822b5 (diff) | |
download | dexon-cdf5982cfca2cd7d5fea85c226af5e48fde837df.tar.gz dexon-cdf5982cfca2cd7d5fea85c226af5e48fde837df.tar.zst dexon-cdf5982cfca2cd7d5fea85c226af5e48fde837df.zip |
swarm: Lightnode mode: disable sync, retrieve, subscription (#17899)
* swarm: Lightnode mode: disable sync, retrieve, subscription
* swarm/network/stream: assign error and check in one line
* swarm: restructured RegistryOption initializing
* swarm: empty commit to retrigger CI build
* swarm/network/stream: Added comments explaining RegistryOptions
Diffstat (limited to 'swarm/swarm.go')
-rw-r--r-- | swarm/swarm.go | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/swarm/swarm.go b/swarm/swarm.go index aea0989a1..7214abbda 100644 --- a/swarm/swarm.go +++ b/swarm/swarm.go @@ -175,13 +175,19 @@ func NewSwarm(config *api.Config, mockStore *mock.NodeStore) (self *Swarm, err e if err := nodeID.UnmarshalText([]byte(config.NodeID)); err != nil { return nil, err } - self.streamer = stream.NewRegistry(nodeID, delivery, self.netStore, stateStore, &stream.RegistryOptions{ + registryOptions := &stream.RegistryOptions{ SkipCheck: config.DeliverySkipCheck, DoSync: config.SyncEnabled, DoRetrieve: true, + DoServeRetrieve: true, SyncUpdateDelay: config.SyncUpdateDelay, MaxPeerServers: config.MaxStreamPeerServers, - }) + } + if config.LightNodeEnabled { + registryOptions.DoSync = false + registryOptions.DoRetrieve = false + } + self.streamer = stream.NewRegistry(nodeID, delivery, self.netStore, stateStore, registryOptions) // Swarm Hash Merklised Chunking for Arbitrary-length Document/File storage self.fileStore = storage.NewFileStore(self.netStore, self.config.FileStoreParams) |