aboutsummaryrefslogtreecommitdiffstats
path: root/cmd/wnode
diff options
context:
space:
mode:
authorBas van Kervel <basvankervel@gmail.com>2017-06-13 17:49:07 +0800
committerBas van Kervel <basvankervel@gmail.com>2017-06-15 17:53:15 +0800
commitb58a5016738b92db19e08ec87ef34ce3250fae6b (patch)
treefa9485b3f711204b14edae5dcbc812e624490c68 /cmd/wnode
parent80f7c6c2996ad47f70a5070c400b1fd87a20c59c (diff)
downloadgo-tangerine-b58a5016738b92db19e08ec87ef34ce3250fae6b.tar.gz
go-tangerine-b58a5016738b92db19e08ec87ef34ce3250fae6b.tar.zst
go-tangerine-b58a5016738b92db19e08ec87ef34ce3250fae6b.zip
whisperv5: integrate whisper and add whisper RPC simulator
Diffstat (limited to 'cmd/wnode')
-rw-r--r--cmd/wnode/main.go16
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)
}