aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/crypto.go
diff options
context:
space:
mode:
authorGustav Simonsson <gustav.simonsson@gmail.com>2015-04-03 03:14:25 +0800
committerGustav Simonsson <gustav.simonsson@gmail.com>2015-05-12 23:19:39 +0800
commitda9fe951da4005761a014316c46771d628dc058e (patch)
treed5344172ed915b4890d66c3cf3b4181e30589471 /crypto/crypto.go
parent6b23094cff77d7e485e0a2ae5698884f63c87ce7 (diff)
downloadgo-tangerine-da9fe951da4005761a014316c46771d628dc058e.tar
go-tangerine-da9fe951da4005761a014316c46771d628dc058e.tar.gz
go-tangerine-da9fe951da4005761a014316c46771d628dc058e.tar.bz2
go-tangerine-da9fe951da4005761a014316c46771d628dc058e.tar.lz
go-tangerine-da9fe951da4005761a014316c46771d628dc058e.tar.xz
go-tangerine-da9fe951da4005761a014316c46771d628dc058e.tar.zst
go-tangerine-da9fe951da4005761a014316c46771d628dc058e.zip
Use common.Address type for accounts.Address
Diffstat (limited to 'crypto/crypto.go')
-rw-r--r--crypto/crypto.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/crypto/crypto.go b/crypto/crypto.go
index 6fc5bfd36..2b1628124 100644
--- a/crypto/crypto.go
+++ b/crypto/crypto.go
@@ -231,13 +231,13 @@ func decryptPreSaleKey(fileContent []byte, password string) (key *Key, err error
ecKey := ToECDSA(ethPriv)
key = &Key{
Id: nil,
- Address: PubkeyToAddress(ecKey.PublicKey),
+ Address: common.BytesToAddress(PubkeyToAddress(ecKey.PublicKey)),
PrivateKey: ecKey,
}
- derivedAddr := common.Bytes2Hex(key.Address)
+ derivedAddr := hex.EncodeToString(key.Address.Bytes()) // needed because .Hex() gives leading "0x"
expectedAddr := preSaleKeyStruct.EthAddr
if derivedAddr != expectedAddr {
- err = errors.New("decrypted addr not equal to expected addr")
+ err = errors.New(fmt.Sprintf("decrypted addr not equal to expected addr ", derivedAddr, expectedAddr))
}
return key, err
}