diff options
author | Péter Szilágyi <peterke@gmail.com> | 2017-06-26 18:44:35 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-06-26 18:44:35 +0800 |
commit | feb29327066d6076d1802cdc1492d43a39cec276 (patch) | |
tree | 93f3231648b0f225c0c8d44bf81304282f93b605 /cmd/wnode/main.go | |
parent | f321ed23fbaad8a13cc672f601b15f5272b4b2bb (diff) | |
parent | ea1d1825a8509b3353c535c9444861e15471942a (diff) | |
download | dexon-feb29327066d6076d1802cdc1492d43a39cec276.tar dexon-feb29327066d6076d1802cdc1492d43a39cec276.tar.gz dexon-feb29327066d6076d1802cdc1492d43a39cec276.tar.bz2 dexon-feb29327066d6076d1802cdc1492d43a39cec276.tar.lz dexon-feb29327066d6076d1802cdc1492d43a39cec276.tar.xz dexon-feb29327066d6076d1802cdc1492d43a39cec276.tar.zst dexon-feb29327066d6076d1802cdc1492d43a39cec276.zip |
Merge pull request #14540 from bas-vk/whisper-api
whisperv5: integrate whisper and implement API
Diffstat (limited to 'cmd/wnode/main.go')
-rw-r--r-- | cmd/wnode/main.go | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/cmd/wnode/main.go b/cmd/wnode/main.go index f18025dff..05e6b2908 100644 --- a/cmd/wnode/main.go +++ b/cmd/wnode/main.go @@ -87,7 +87,7 @@ var ( argVerbosity = flag.Int("verbosity", int(log.LvlError), "log verbosity level") argTTL = flag.Uint("ttl", 30, "time-to-live for messages in seconds") argWorkTime = flag.Uint("work", 5, "work time in seconds") - argMaxSize = flag.Int("maxsize", whisper.DefaultMaxMessageLength, "max size of message") + argMaxSize = flag.Uint("maxsize", uint(whisper.DefaultMaxMessageSize), "max size of message") argPoW = flag.Float64("pow", whisper.DefaultMinimumPoW, "PoW for normal messages in float format (e.g. 2.7)") argServerPoW = flag.Float64("mspow", whisper.DefaultMinimumPoW, "PoW requirement for Mail Server request") @@ -198,6 +198,11 @@ func initialize() { peers = append(peers, peer) } + cfg := &whisper.Config{ + MaxMessageSize: uint32(*argMaxSize), + MinimumAcceptedPOW: *argPoW, + } + if *mailServerMode { if len(msPassword) == 0 { msPassword, err = console.Stdin.PromptPassword("Please enter the Mail Server password: ") @@ -205,11 +210,12 @@ func initialize() { utils.Fatalf("Failed to read Mail Server password: %s", err) } } - shh = whisper.New() + + shh = whisper.New(cfg) shh.RegisterServer(&mailServer) mailServer.Init(shh, *argDBPath, msPassword, *argServerPoW) } else { - shh = whisper.New() + shh = whisper.New(cfg) } if *argPoW != whisper.DefaultMinimumPoW { @@ -219,8 +225,8 @@ func initialize() { } } - if *argMaxSize != whisper.DefaultMaxMessageLength { - err := shh.SetMaxMessageLength(*argMaxSize) + if uint32(*argMaxSize) != whisper.DefaultMaxMessageSize { + err := shh.SetMaxMessageSize(uint32(*argMaxSize)) if err != nil { utils.Fatalf("Failed to set max message size: %s", err) } |