forked from cerc-io/plugeth
Renamed Sha3Bin to Sha3
This commit is contained in:
+4
-4
@@ -144,12 +144,12 @@ func CreateBlock(root interface{},
|
||||
|
||||
// Returns a hash of the block
|
||||
func (block *Block) Hash() ethutil.Bytes {
|
||||
return ethcrypto.Sha3Bin(ethutil.NewValue(block.header()).Encode())
|
||||
//return ethcrypto.Sha3Bin(block.Value().Encode())
|
||||
return ethcrypto.Sha3(ethutil.NewValue(block.header()).Encode())
|
||||
//return ethcrypto.Sha3(block.Value().Encode())
|
||||
}
|
||||
|
||||
func (block *Block) HashNoNonce() []byte {
|
||||
return ethcrypto.Sha3Bin(ethutil.Encode([]interface{}{block.PrevHash,
|
||||
return ethcrypto.Sha3(ethutil.Encode([]interface{}{block.PrevHash,
|
||||
block.UncleSha, block.Coinbase, block.state.Trie.Root,
|
||||
block.TxSha, block.Difficulty, block.Number, block.MinGasPrice,
|
||||
block.GasLimit, block.GasUsed, block.Time, block.Extra}))
|
||||
@@ -237,7 +237,7 @@ func (block *Block) SetUncles(uncles []*Block) {
|
||||
block.Uncles = uncles
|
||||
|
||||
// Sha of the concatenated uncles
|
||||
block.UncleSha = ethcrypto.Sha3Bin(ethutil.Encode(block.rlpUncles()))
|
||||
block.UncleSha = ethcrypto.Sha3(ethutil.Encode(block.rlpUncles()))
|
||||
}
|
||||
|
||||
func (self *Block) SetReceipts(receipts []*Receipt, txs []*Transaction) {
|
||||
|
||||
+1
-1
@@ -61,7 +61,7 @@ func (pow *EasyPow) Search(block *Block, reactChan chan ethreact.Event) []byte {
|
||||
t = time.Now()
|
||||
}
|
||||
|
||||
sha := ethcrypto.Sha3Bin(big.NewInt(r.Int63()).Bytes())
|
||||
sha := ethcrypto.Sha3(big.NewInt(r.Int63()).Bytes())
|
||||
if pow.Verify(hash, diff, sha) {
|
||||
return sha
|
||||
}
|
||||
|
||||
+3
-3
@@ -13,13 +13,13 @@ import (
|
||||
|
||||
var ZeroHash256 = make([]byte, 32)
|
||||
var ZeroHash160 = make([]byte, 20)
|
||||
var EmptyShaList = ethcrypto.Sha3Bin(ethutil.Encode([]interface{}{}))
|
||||
var EmptyShaList = ethcrypto.Sha3(ethutil.Encode([]interface{}{}))
|
||||
|
||||
var GenesisHeader = []interface{}{
|
||||
// Previous hash (none)
|
||||
ZeroHash256,
|
||||
// Sha of uncles
|
||||
ethcrypto.Sha3Bin(ethutil.Encode([]interface{}{})),
|
||||
ethcrypto.Sha3(ethutil.Encode([]interface{}{})),
|
||||
// Coinbase
|
||||
ZeroHash160,
|
||||
// Root state
|
||||
@@ -42,7 +42,7 @@ var GenesisHeader = []interface{}{
|
||||
// Extra
|
||||
nil,
|
||||
// Nonce
|
||||
ethcrypto.Sha3Bin(big.NewInt(42).Bytes()),
|
||||
ethcrypto.Sha3(big.NewInt(42).Bytes()),
|
||||
}
|
||||
|
||||
var Genesis = []interface{}{GenesisHeader, []interface{}{}, []interface{}{}}
|
||||
|
||||
@@ -66,7 +66,7 @@ func (self *Transaction) TotalValue() *big.Int {
|
||||
func (tx *Transaction) Hash() []byte {
|
||||
data := []interface{}{tx.Nonce, tx.GasPrice, tx.Gas, tx.Recipient, tx.Value, tx.Data}
|
||||
|
||||
return ethcrypto.Sha3Bin(ethutil.NewValue(data).Encode())
|
||||
return ethcrypto.Sha3(ethutil.NewValue(data).Encode())
|
||||
}
|
||||
|
||||
func (tx *Transaction) CreatesContract() bool {
|
||||
@@ -80,9 +80,9 @@ func (tx *Transaction) IsContract() bool {
|
||||
|
||||
func (tx *Transaction) CreationAddress(state *ethstate.State) []byte {
|
||||
// Generate a new address
|
||||
addr := ethcrypto.Sha3Bin(ethutil.NewValue([]interface{}{tx.Sender(), tx.Nonce}).Encode())[12:]
|
||||
addr := ethcrypto.Sha3(ethutil.NewValue([]interface{}{tx.Sender(), tx.Nonce}).Encode())[12:]
|
||||
//for i := uint64(0); state.GetStateObject(addr) != nil; i++ {
|
||||
// addr = ethcrypto.Sha3Bin(ethutil.NewValue([]interface{}{tx.Sender(), tx.Nonce + i}).Encode())[12:]
|
||||
// addr = ethcrypto.Sha3(ethutil.NewValue([]interface{}{tx.Sender(), tx.Nonce + i}).Encode())[12:]
|
||||
//}
|
||||
|
||||
return addr
|
||||
@@ -120,7 +120,7 @@ func (tx *Transaction) Sender() []byte {
|
||||
return nil
|
||||
}
|
||||
|
||||
return ethcrypto.Sha3Bin(pubkey[1:])[12:]
|
||||
return ethcrypto.Sha3(pubkey[1:])[12:]
|
||||
}
|
||||
|
||||
func (tx *Transaction) Sign(privk []byte) error {
|
||||
|
||||
Reference in New Issue
Block a user