Using golang crypto instead of ethereum crypto

pull/434/head
ak 6 years ago
parent bcab7d3740
commit dd8d85e3c9
  1. 13
      test/chain/main.go

@ -8,7 +8,8 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/crypto/sha3"
//"github.com/ethereum/go-ethereum/crypto/sha3"
"github.com/ethereum/go-ethereum/ethdb"
"github.com/ethereum/go-ethereum/params"
"github.com/harmony-one/harmony/consensus"
@ -16,6 +17,7 @@ import (
"github.com/harmony-one/harmony/core/types"
"github.com/harmony-one/harmony/core/vm"
pkgworker "github.com/harmony-one/harmony/node/worker"
"golang.org/x/crypto/sha3"
)
const (
@ -166,7 +168,8 @@ func main() {
paddedAddress := common.LeftPadBytes(AllRandomUserAddress[0].Bytes(), 32)
transferFnSignature := []byte("request(address)")
hash := sha3.NewKeccak256()
//hash := sha3.NewKeccak256()
hash := sha3.NewLegacyKeccak256()
hash.Write(transferFnSignature)
callFuncHex := hash.Sum(nil)[:4]
@ -227,7 +230,8 @@ func main() {
fmt.Println(state.GetBalance(StakingAddress))
depositFnSignature := []byte("deposit()")
hash = sha3.NewKeccak256()
//hash = sha3.NewKeccak256()
hash = sha3.NewLegacyKeccak256()
hash.Write(depositFnSignature)
methodID := hash.Sum(nil)[:4]
@ -275,7 +279,8 @@ func main() {
fmt.Println("--------- Now Setting up Withdrawing Stakes ---------")
withdrawFnSignature := []byte("withdraw(uint256)")
hash = sha3.NewKeccak256()
//hash = sha3.NewKeccak256()
hash = sha3.NewLegacyKeccak256()
hash.Write(withdrawFnSignature)
methodID = hash.Sum(nil)[:4]

Loading…
Cancel
Save