aboutsummaryrefslogtreecommitdiffstats
path: root/cmd
diff options
context:
space:
mode:
Diffstat (limited to 'cmd')
-rw-r--r--cmd/geth/chaincmd.go13
-rw-r--r--cmd/geth/main.go1
-rw-r--r--cmd/puppeth/module_wallet.go2
-rw-r--r--cmd/utils/flags.go9
-rw-r--r--cmd/wnode/main.go83
5 files changed, 69 insertions, 39 deletions
diff --git a/cmd/geth/chaincmd.go b/cmd/geth/chaincmd.go
index 85d0c3aca..c9ab72b6d 100644
--- a/cmd/geth/chaincmd.go
+++ b/cmd/geth/chaincmd.go
@@ -225,6 +225,13 @@ func importChain(ctx *cli.Context) error {
utils.Fatalf("Failed to read database stats: %v", err)
}
fmt.Println(stats)
+
+ ioStats, err := db.LDB().GetProperty("leveldb.iostats")
+ if err != nil {
+ utils.Fatalf("Failed to read database iostats: %v", err)
+ }
+ fmt.Println(ioStats)
+
fmt.Printf("Trie cache misses: %d\n", trie.CacheMisses())
fmt.Printf("Trie cache unloads: %d\n\n", trie.CacheUnloads())
@@ -255,6 +262,12 @@ func importChain(ctx *cli.Context) error {
}
fmt.Println(stats)
+ ioStats, err = db.LDB().GetProperty("leveldb.iostats")
+ if err != nil {
+ utils.Fatalf("Failed to read database iostats: %v", err)
+ }
+ fmt.Println(ioStats)
+
return nil
}
diff --git a/cmd/geth/main.go b/cmd/geth/main.go
index a82e5c89c..f5a3fa941 100644
--- a/cmd/geth/main.go
+++ b/cmd/geth/main.go
@@ -65,7 +65,6 @@ var (
utils.DashboardAddrFlag,
utils.DashboardPortFlag,
utils.DashboardRefreshFlag,
- utils.DashboardAssetsFlag,
utils.EthashCacheDirFlag,
utils.EthashCachesInMemoryFlag,
utils.EthashCachesOnDiskFlag,
diff --git a/cmd/puppeth/module_wallet.go b/cmd/puppeth/module_wallet.go
index 67f47c70e..5e5032bed 100644
--- a/cmd/puppeth/module_wallet.go
+++ b/cmd/puppeth/module_wallet.go
@@ -37,7 +37,7 @@ ADD genesis.json /genesis.json
RUN \
echo 'node server.js &' > wallet.sh && \
echo 'geth --cache 512 init /genesis.json' >> wallet.sh && \
- echo $'geth --networkid {{.NetworkID}} --port {{.NodePort}} --bootnodes {{.Bootnodes}} --ethstats \'{{.Ethstats}}\' --cache=512 --rpc --rpcaddr=0.0.0.0 --rpccorsdomain "*"' >> wallet.sh
+ echo $'geth --networkid {{.NetworkID}} --port {{.NodePort}} --bootnodes {{.Bootnodes}} --ethstats \'{{.Ethstats}}\' --cache=512 --rpc --rpcaddr=0.0.0.0 --rpccorsdomain "*" --rpcvhosts "*"' >> wallet.sh
RUN \
sed -i 's/PuppethNetworkID/{{.NetworkID}}/g' dist/js/etherwallet-master.js && \
diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go
index dbf26b8e0..ff78a0fcc 100644
--- a/cmd/utils/flags.go
+++ b/cmd/utils/flags.go
@@ -209,11 +209,6 @@ var (
Usage: "Dashboard metrics collection refresh rate",
Value: dashboard.DefaultConfig.Refresh,
}
- DashboardAssetsFlag = cli.StringFlag{
- Name: "dashboard.assets",
- Usage: "Developer flag to serve the dashboard from the local file system",
- Value: dashboard.DefaultConfig.Assets,
- }
// Ethash settings
EthashCacheDirFlag = DirectoryFlag{
Name: "ethash.cachedir",
@@ -819,6 +814,9 @@ func SetP2PConfig(ctx *cli.Context, cfg *p2p.Config) {
if ctx.GlobalIsSet(MaxPeersFlag.Name) {
cfg.MaxPeers = ctx.GlobalInt(MaxPeersFlag.Name)
+ if lightServer && !ctx.GlobalIsSet(LightPeersFlag.Name) {
+ cfg.MaxPeers += lightPeers
+ }
} else {
if lightServer {
cfg.MaxPeers += lightPeers
@@ -1120,7 +1118,6 @@ func SetDashboardConfig(ctx *cli.Context, cfg *dashboard.Config) {
cfg.Host = ctx.GlobalString(DashboardAddrFlag.Name)
cfg.Port = ctx.GlobalInt(DashboardPortFlag.Name)
cfg.Refresh = ctx.GlobalDuration(DashboardRefreshFlag.Name)
- cfg.Assets = ctx.GlobalString(DashboardAssetsFlag.Name)
}
// RegisterEthService adds an Ethereum client to the stack.
diff --git a/cmd/wnode/main.go b/cmd/wnode/main.go
index 84bdfa4c3..988c50ce3 100644
--- a/cmd/wnode/main.go
+++ b/cmd/wnode/main.go
@@ -197,6 +197,8 @@ func initialize() {
if len(*argIP) == 0 {
argIP = scanLineA("Please enter your IP and port (e.g. 127.0.0.1:30348): ")
}
+ } else if *fileReader {
+ *bootstrapMode = true
} else {
if len(*argEnode) == 0 {
argEnode = scanLineA("Please enter the peer's enode: ")
@@ -205,11 +207,22 @@ func initialize() {
peers = append(peers, peer)
}
+ if *mailServerMode {
+ if len(msPassword) == 0 {
+ msPassword, err = console.Stdin.PromptPassword("Please enter the Mail Server password: ")
+ if err != nil {
+ utils.Fatalf("Failed to read Mail Server password: %s", err)
+ }
+ }
+ }
+
cfg := &whisper.Config{
MaxMessageSize: uint32(*argMaxSize),
MinimumAcceptedPOW: *argPoW,
}
+ shh = whisper.New(cfg)
+
if *argPoW != whisper.DefaultMinimumPoW {
err := shh.SetMinimumPoW(*argPoW)
if err != nil {
@@ -257,18 +270,8 @@ func initialize() {
}
if *mailServerMode {
- if len(msPassword) == 0 {
- msPassword, err = console.Stdin.PromptPassword("Please enter the Mail Server password: ")
- if err != nil {
- utils.Fatalf("Failed to read Mail Server password: %s", err)
- }
- }
-
- shh = whisper.New(cfg)
shh.RegisterServer(&mailServer)
mailServer.Init(shh, *argDBPath, msPassword, *argServerPoW)
- } else {
- shh = whisper.New(cfg)
}
server = &p2p.Server{
@@ -306,7 +309,11 @@ func startServer() error {
configureNode()
}
- if !*forwarderMode {
+ if *fileExMode {
+ fmt.Printf("Please type the file name to be send. To quit type: '%s'\n", quitCommand)
+ } else if *fileReader {
+ fmt.Printf("Please type the file name to be decrypted. To quit type: '%s'\n", quitCommand)
+ } else if !*forwarderMode {
fmt.Printf("Please type the message. To quit type: '%s'\n", quitCommand)
}
return nil
@@ -566,6 +573,7 @@ func sendMsg(payload []byte) common.Hash {
if err != nil {
utils.Fatalf("failed to create new message: %s", err)
}
+
envelope, err := msg.Wrap(&params)
if err != nil {
fmt.Printf("failed to seal message: %v \n", err)
@@ -601,15 +609,17 @@ func messageLoop() {
m2 := af.Retrieve()
messages := append(m1, m2...)
for _, msg := range messages {
+ reportedOnce := false
+ if !*fileExMode && len(msg.Payload) <= 2048 {
+ printMessageInfo(msg)
+ reportedOnce = true
+ }
+
// All messages are saved upon specifying argSaveDir.
// fileExMode only specifies how messages are displayed on the console after they are saved.
// if fileExMode == true, only the hashes are displayed, since messages might be too big.
if len(*argSaveDir) > 0 {
- writeMessageToFile(*argSaveDir, msg)
- }
-
- if !*fileExMode && len(msg.Payload) <= 2048 {
- printMessageInfo(msg)
+ writeMessageToFile(*argSaveDir, msg, !reportedOnce)
}
}
case <-done:
@@ -634,7 +644,11 @@ func printMessageInfo(msg *whisper.ReceivedMessage) {
}
}
-func writeMessageToFile(dir string, msg *whisper.ReceivedMessage) {
+func writeMessageToFile(dir string, msg *whisper.ReceivedMessage, show bool) {
+ if len(dir) == 0 {
+ return
+ }
+
timestamp := fmt.Sprintf("%d", msg.Sent)
name := fmt.Sprintf("%x", msg.EnvelopeHash)
@@ -643,22 +657,24 @@ func writeMessageToFile(dir string, msg *whisper.ReceivedMessage) {
address = crypto.PubkeyToAddress(*msg.Src)
}
+ env := shh.GetEnvelope(msg.EnvelopeHash)
+ if env == nil {
+ fmt.Printf("\nUnexpected error: envelope not found: %x\n", msg.EnvelopeHash)
+ return
+ }
+
// this is a sample code; uncomment if you don't want to save your own messages.
//if whisper.IsPubKeyEqual(msg.Src, &asymKey.PublicKey) {
// fmt.Printf("\n%s <%x>: message from myself received, not saved: '%s'\n", timestamp, address, name)
// return
//}
- if len(dir) > 0 {
- fullpath := filepath.Join(dir, name)
- err := ioutil.WriteFile(fullpath, msg.Raw, 0644)
- if err != nil {
- fmt.Printf("\n%s {%x}: message received but not saved: %s\n", timestamp, address, err)
- } else {
- fmt.Printf("\n%s {%x}: message received and saved as '%s' (%d bytes)\n", timestamp, address, name, len(msg.Raw))
- }
- } else {
- fmt.Printf("\n%s {%x}: message received (%d bytes), but not saved: %s\n", timestamp, address, len(msg.Raw), name)
+ fullpath := filepath.Join(dir, name)
+ err := ioutil.WriteFile(fullpath, env.Data, 0644)
+ if err != nil {
+ fmt.Printf("\n%s {%x}: message received but not saved: %s\n", timestamp, address, err)
+ } else if show {
+ fmt.Printf("\n%s {%x}: message received and saved as '%s' (%d bytes)\n", timestamp, address, name, len(env.Data))
}
}
@@ -682,18 +698,23 @@ func requestExpiredMessagesLoop() {
for {
timeLow = scanUint("Please enter the lower limit of the time range (unix timestamp): ")
timeUpp = scanUint("Please enter the upper limit of the time range (unix timestamp): ")
- t = scanLine("Please enter the topic (hexadecimal): ")
- if len(t) >= whisper.TopicLength*2 {
+ t = scanLine("Enter the topic (hex). Press enter to request all messages, regardless of the topic: ")
+ if len(t) == whisper.TopicLength*2 {
x, err := hex.DecodeString(t)
if err != nil {
- utils.Fatalf("Failed to parse the topic: %s", err)
+ fmt.Printf("Failed to parse the topic: %s \n", err)
+ continue
}
xt = whisper.BytesToTopic(x)
bloom = whisper.TopicToBloom(xt)
obfuscateBloom(bloom)
- } else {
+ } else if len(t) == 0 {
bloom = whisper.MakeFullNodeBloom()
+ } else {
+ fmt.Println("Error: topic is invalid, request aborted")
+ continue
}
+
if timeUpp == 0 {
timeUpp = 0xFFFFFFFF
}