mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-18 19:00:46 +00:00
Update passphrase.go
This commit is contained in:
parent
a76d90990c
commit
cfeee2f6fc
1 changed files with 4 additions and 0 deletions
|
|
@ -34,6 +34,7 @@ import (
|
|||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
"math"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
|
|
@ -385,6 +386,9 @@ func ensureInt(x interface{}) (int, error) {
|
|||
case int:
|
||||
return v, nil
|
||||
case float64:
|
||||
if math.IsNaN(v) || math.IsInf(v, 0) || v != math.Trunc(v) || v < 0 || v > math.MaxInt32 {
|
||||
return 0, fmt.Errorf("invalid KDF parameter: %v", v)
|
||||
}
|
||||
return int(v), nil
|
||||
default:
|
||||
return 0, fmt.Errorf("invalid KDF parameter: expected number, got %T", x)
|
||||
|
|
|
|||
Loading…
Reference in a new issue