whisper: fix issue with PoW calculation

This commit is contained in:
Victor Farazdagi 2017-04-03 00:21:05 +03:00
parent 4f89422567
commit ef0148d76a
3 changed files with 6 additions and 3 deletions

View File

@ -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
}

View File

@ -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

View File

@ -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