diff options
author | obscuren <geffobscura@gmail.com> | 2014-04-10 00:27:54 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2014-04-10 00:27:54 +0800 |
commit | e09f0a5f2c1e1b46226656dbac9a4ae10e0dcd14 (patch) | |
tree | 7b1ce2f5cd83e3a345cf26230afd41e48110e015 /ethchain/contract.go | |
parent | 4f2e9c2640eaa962d085db329221bfd6f1a1799e (diff) | |
download | go-tangerine-e09f0a5f2c1e1b46226656dbac9a4ae10e0dcd14.tar go-tangerine-e09f0a5f2c1e1b46226656dbac9a4ae10e0dcd14.tar.gz go-tangerine-e09f0a5f2c1e1b46226656dbac9a4ae10e0dcd14.tar.bz2 go-tangerine-e09f0a5f2c1e1b46226656dbac9a4ae10e0dcd14.tar.lz go-tangerine-e09f0a5f2c1e1b46226656dbac9a4ae10e0dcd14.tar.xz go-tangerine-e09f0a5f2c1e1b46226656dbac9a4ae10e0dcd14.tar.zst go-tangerine-e09f0a5f2c1e1b46226656dbac9a4ae10e0dcd14.zip |
Split code for contracts
Diffstat (limited to 'ethchain/contract.go')
-rw-r--r-- | ethchain/contract.go | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/ethchain/contract.go b/ethchain/contract.go index f68dcf367..113d067a4 100644 --- a/ethchain/contract.go +++ b/ethchain/contract.go @@ -9,9 +9,10 @@ type Contract struct { Amount *big.Int Nonce uint64 //state *ethutil.Trie - state *State - address []byte - script []byte + state *State + address []byte + script []byte + initScript []byte } func NewContract(address []byte, Amount *big.Int, root []byte) *Contract { @@ -88,12 +89,17 @@ func MakeContract(tx *Transaction, state *State) *Contract { value := tx.Value contract := NewContract(addr, value, []byte("")) state.trie.Update(string(addr), string(contract.RlpEncode())) - for i, val := range tx.Data { - if len(val) > 0 { - bytNum := ethutil.BigToBytes(big.NewInt(int64(i)), 256) - contract.state.trie.Update(string(bytNum), string(ethutil.Encode(val))) + contract.script = tx.Data + contract.initScript = tx.Init + + /* + for i, val := range tx.Data { + if len(val) > 0 { + bytNum := ethutil.BigToBytes(big.NewInt(int64(i)), 256) + contract.state.trie.Update(string(bytNum), string(ethutil.Encode(val))) + } } - } + */ state.trie.Update(string(addr), string(contract.RlpEncode())) return contract |