whisper: bugfix

This commit is contained in:
Vlad 2017-03-15 22:54:02 +01:00
parent f8815e0f92
commit 6eb6853d9e
2 changed files with 4 additions and 1 deletions

View file

@ -57,7 +57,7 @@ const (
keyIdSize = 32 keyIdSize = 32
DefaultMaxMessageLength = 1024 * 1024 DefaultMaxMessageLength = 1024 * 1024
DefaultMinimumPoW = 2.0 // todo: review after testing. DefaultMinimumPoW = 1.0 // todo: review after testing.
padSizeLimitLower = 128 // it can not be less - we don't want to reveal the absence of signature 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 padSizeLimitUpper = 256 // just an arbitrary number, could be changed without losing compatibility

View file

@ -95,6 +95,9 @@ func (e *Envelope) Seal(options *MessageParams) error {
e.Expiry += options.WorkTime e.Expiry += options.WorkTime
} else { } else {
target = e.powToFirstBit(options.PoW) target = e.powToFirstBit(options.PoW)
if target < 1 {
target = 1
}
} }
buf := make([]byte, 64) buf := make([]byte, 64)