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