mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-24 05:36:46 +00:00
Update crypto.go
This commit is contained in:
parent
e67761ef35
commit
5a76aac828
1 changed files with 6 additions and 1 deletions
|
|
@ -144,7 +144,12 @@ func ToECDSA(d []byte) (*ecdsa.PrivateKey, error) {
|
|||
// never be used unless you are sure the input is valid and want to avoid hitting
|
||||
// errors due to bad origin encoding (0 prefixes cut off).
|
||||
func ToECDSAUnsafe(d []byte) *ecdsa.PrivateKey {
|
||||
priv, _ := toECDSA(d, false)
|
||||
priv, err := toECDSA(d, false)
|
||||
if err != nil {
|
||||
// In unsafe mode, we panic on error to maintain backward compatibility
|
||||
// but provide better error information for debugging
|
||||
panic(fmt.Sprintf("ToECDSAUnsafe failed: %v", err))
|
||||
}
|
||||
return priv
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue