From ef0148d76a4e38dfb47b3103498870b5ddd290fe Mon Sep 17 00:00:00 2001 From: Victor Farazdagi Date: Mon, 3 Apr 2017 00:21:05 +0300 Subject: [PATCH] whisper: fix issue with PoW calculation --- .../github.com/ethereum/go-ethereum/whisper/whisperv5/api.go | 4 ++++ .../github.com/ethereum/go-ethereum/whisper/whisperv5/doc.go | 2 +- .../ethereum/go-ethereum/whisper/whisperv5/envelope.go | 3 +-- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/vendor/github.com/ethereum/go-ethereum/whisper/whisperv5/api.go b/vendor/github.com/ethereum/go-ethereum/whisper/whisperv5/api.go index 1ff490ec2..e55ecc9ca 100644 --- a/vendor/github.com/ethereum/go-ethereum/whisper/whisperv5/api.go +++ b/vendor/github.com/ethereum/go-ethereum/whisper/whisperv5/api.go @@ -406,6 +406,10 @@ func (args *PostArgs) UnmarshalJSON(data []byte) (err error) { args.Topic = BytesToTopic(x) } + if objJSON, err := json.Marshal(&obj); err == nil { + glog.V(logger.Info).Infoln("shh message posted: ", string(objJSON)) + } + return nil } diff --git a/vendor/github.com/ethereum/go-ethereum/whisper/whisperv5/doc.go b/vendor/github.com/ethereum/go-ethereum/whisper/whisperv5/doc.go index 70c7008a7..502bdb1c7 100644 --- a/vendor/github.com/ethereum/go-ethereum/whisper/whisperv5/doc.go +++ b/vendor/github.com/ethereum/go-ethereum/whisper/whisperv5/doc.go @@ -56,7 +56,7 @@ const ( AESNonceMaxLength = 12 MaxMessageLength = 0x0FFFFF // todo: remove this restriction after testing. this should be regulated by PoW. - MinimumPoW = 10.0 // todo: review after testing. + MinimumPoW = 0.001 // todo: review after testing. padSizeLimitLower = 128 // it can not be less - we don't want to reveal the absence of signature padSizeLimitUpper = 256 // just an arbitrary number, could be changed without losing compatibility diff --git a/vendor/github.com/ethereum/go-ethereum/whisper/whisperv5/envelope.go b/vendor/github.com/ethereum/go-ethereum/whisper/whisperv5/envelope.go index 8812ae207..77dc81069 100644 --- a/vendor/github.com/ethereum/go-ethereum/whisper/whisperv5/envelope.go +++ b/vendor/github.com/ethereum/go-ethereum/whisper/whisperv5/envelope.go @@ -21,7 +21,6 @@ package whisperv5 import ( "crypto/ecdsa" "encoding/binary" - "errors" "fmt" "math" "time" @@ -116,7 +115,7 @@ func (e *Envelope) Seal(options *MessageParams) error { } if target > 0 && bestBit < target { - return errors.New("Failed to reach the PoW target, insufficient work time") + return fmt.Errorf("Failed to reach the PoW target, insufficient work time. Expected: %v, got: %v", target, bestBit) } return nil