aboutsummaryrefslogtreecommitdiffstats
path: root/crypto
diff options
context:
space:
mode:
authorgary rong <garyrong0905@gmail.com>2018-08-14 23:30:42 +0800
committerPéter Szilágyi <peterke@gmail.com>2018-08-14 23:30:42 +0800
commite0e0e53401e93733d921338b6d794162c40a7883 (patch)
tree99c25ef0e0a691c59aa3cfd2c85e81849a8af212 /crypto
parent97887d98da703a31040bceee13bce9ee77fca673 (diff)
downloaddexon-e0e0e53401e93733d921338b6d794162c40a7883.tar.gz
dexon-e0e0e53401e93733d921338b6d794162c40a7883.tar.zst
dexon-e0e0e53401e93733d921338b6d794162c40a7883.zip
crypto: change formula for create2 (#17393)
Diffstat (limited to 'crypto')
-rw-r--r--crypto/crypto.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/crypto/crypto.go b/crypto/crypto.go
index dec6e3c19..3211957e0 100644
--- a/crypto/crypto.go
+++ b/crypto/crypto.go
@@ -78,8 +78,8 @@ func CreateAddress(b common.Address, nonce uint64) common.Address {
// CreateAddress2 creates an ethereum address given the address bytes, initial
// contract code and a salt.
-func CreateAddress2(b common.Address, salt common.Hash, code []byte) common.Address {
- return common.BytesToAddress(Keccak256([]byte{0xff}, b.Bytes(), salt.Bytes(), code)[12:])
+func CreateAddress2(b common.Address, salt [32]byte, code []byte) common.Address {
+ return common.BytesToAddress(Keccak256([]byte{0xff}, b.Bytes(), salt[:], Keccak256(code))[12:])
}
// ToECDSA creates a private key with the given D value.