aboutsummaryrefslogtreecommitdiffstats
path: root/ethchain/state_object.go
diff options
context:
space:
mode:
authorJeffrey Wilcke <obscuren@users.noreply.github.com>2014-07-01 22:16:05 +0800
committerJeffrey Wilcke <obscuren@users.noreply.github.com>2014-07-01 22:16:05 +0800
commit29f613ef84ed39ccc1929dd1069f3576ade889f1 (patch)
tree0c12e6fe9e0214989401bb47a6d4503081fd47bc /ethchain/state_object.go
parent550407b0ec78b7026737d1abe28127da8c0c9063 (diff)
parentff5703fd9b089de67811af61de05637c62dc7a2c (diff)
downloadgo-tangerine-29f613ef84ed39ccc1929dd1069f3576ade889f1.tar
go-tangerine-29f613ef84ed39ccc1929dd1069f3576ade889f1.tar.gz
go-tangerine-29f613ef84ed39ccc1929dd1069f3576ade889f1.tar.bz2
go-tangerine-29f613ef84ed39ccc1929dd1069f3576ade889f1.tar.lz
go-tangerine-29f613ef84ed39ccc1929dd1069f3576ade889f1.tar.xz
go-tangerine-29f613ef84ed39ccc1929dd1069f3576ade889f1.tar.zst
go-tangerine-29f613ef84ed39ccc1929dd1069f3576ade889f1.zip
Merge pull request #28 from ethersphere/feature/keys
Feature/keys
Diffstat (limited to 'ethchain/state_object.go')
-rw-r--r--ethchain/state_object.go13
1 files changed, 8 insertions, 5 deletions
diff --git a/ethchain/state_object.go b/ethchain/state_object.go
index edac4f6dc..35928c899 100644
--- a/ethchain/state_object.go
+++ b/ethchain/state_object.go
@@ -2,6 +2,8 @@ package ethchain
import (
"fmt"
+ "github.com/ethereum/eth-go/ethcrypto"
+ "github.com/ethereum/eth-go/ethtrie"
"github.com/ethereum/eth-go/ethutil"
"math/big"
"strings"
@@ -39,7 +41,7 @@ func MakeContract(tx *Transaction, state *State) *StateObject {
contract := state.NewStateObject(addr)
contract.initScript = tx.Data
- contract.state = NewState(ethutil.NewTrie(ethutil.Config.Db, ""))
+ contract.state = NewState(ethtrie.NewTrie(ethutil.Config.Db, ""))
return contract
}
@@ -49,14 +51,14 @@ func MakeContract(tx *Transaction, state *State) *StateObject {
func NewStateObject(addr []byte) *StateObject {
object := &StateObject{address: addr, Amount: new(big.Int), gasPool: new(big.Int)}
- object.state = NewState(ethutil.NewTrie(ethutil.Config.Db, ""))
+ object.state = NewState(ethtrie.NewTrie(ethutil.Config.Db, ""))
return object
}
func NewContract(address []byte, Amount *big.Int, root []byte) *StateObject {
contract := &StateObject{address: address, Amount: Amount, Nonce: 0}
- contract.state = NewState(ethutil.NewTrie(ethutil.Config.Db, string(root)))
+ contract.state = NewState(ethtrie.NewTrie(ethutil.Config.Db, string(root)))
return contract
}
@@ -249,7 +251,7 @@ func (c *StateObject) RlpEncode() []byte {
root = ""
}
- return ethutil.Encode([]interface{}{c.Nonce, c.Amount, root, ethutil.Sha3Bin(c.script)})
+ return ethutil.Encode([]interface{}{c.Nonce, c.Amount, root, ethcrypto.Sha3Bin(c.script)})
}
func (c *StateObject) RlpDecode(data []byte) {
@@ -257,7 +259,8 @@ func (c *StateObject) RlpDecode(data []byte) {
c.Nonce = decoder.Get(0).Uint()
c.Amount = decoder.Get(1).BigInt()
- c.state = NewState(ethutil.NewTrie(ethutil.Config.Db, decoder.Get(2).Interface()))
+ c.state = NewState(ethtrie.NewTrie(ethutil.Config.Db, decoder.Get(2).Interface()))
+ c.state = NewState(ethtrie.NewTrie(ethutil.Config.Db, decoder.Get(2).Interface()))
c.ScriptHash = decoder.Get(3).Bytes()