diff options
author | obscuren <geffobscura@gmail.com> | 2014-02-15 08:34:18 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2014-02-15 08:34:18 +0800 |
commit | 73fd358d940418b15dec850f50407bd2e504d88c (patch) | |
tree | a1202689cf2e715fef9c31fa17ca4ad241de1d0f /ethchain | |
parent | f247f0c518c6e848061462e3234f32cc7d854a46 (diff) | |
download | go-tangerine-73fd358d940418b15dec850f50407bd2e504d88c.tar go-tangerine-73fd358d940418b15dec850f50407bd2e504d88c.tar.gz go-tangerine-73fd358d940418b15dec850f50407bd2e504d88c.tar.bz2 go-tangerine-73fd358d940418b15dec850f50407bd2e504d88c.tar.lz go-tangerine-73fd358d940418b15dec850f50407bd2e504d88c.tar.xz go-tangerine-73fd358d940418b15dec850f50407bd2e504d88c.tar.zst go-tangerine-73fd358d940418b15dec850f50407bd2e504d88c.zip |
Removed RlpValue in favour of Value
Diffstat (limited to 'ethchain')
-rw-r--r-- | ethchain/block.go | 8 | ||||
-rw-r--r-- | ethchain/block_chain.go | 2 | ||||
-rw-r--r-- | ethchain/block_manager.go | 8 | ||||
-rw-r--r-- | ethchain/contract.go | 14 |
4 files changed, 16 insertions, 16 deletions
diff --git a/ethchain/block.go b/ethchain/block.go index a7a1f787b..0678f64e2 100644 --- a/ethchain/block.go +++ b/ethchain/block.go @@ -102,7 +102,7 @@ func CreateBlock(root interface{}, // Returns a hash of the block func (block *Block) Hash() []byte { - return ethutil.Sha3Bin(block.RlpValue().Encode()) + return ethutil.Sha3Bin(block.Value().Encode()) } func (block *Block) HashNoNonce() []byte { @@ -261,14 +261,14 @@ func (block *Block) SetTransactions(txs []*Transaction) { block.TxSha = ethutil.Sha3Bin(ethutil.Encode(block.rlpTxs())) } -func (block *Block) RlpValue() *ethutil.RlpValue { - return ethutil.NewRlpValue([]interface{}{block.header(), block.rlpTxs(), block.rlpUncles()}) +func (block *Block) Value() *ethutil.Value { + return ethutil.NewValue([]interface{}{block.header(), block.rlpTxs(), block.rlpUncles()}) } func (block *Block) RlpEncode() []byte { // Encode a slice interface which contains the header and the list of // transactions. - return block.RlpValue().Encode() + return block.Value().Encode() } func (block *Block) RlpDecode(data []byte) { diff --git a/ethchain/block_chain.go b/ethchain/block_chain.go index 56bc43a8e..54f48bc60 100644 --- a/ethchain/block_chain.go +++ b/ethchain/block_chain.go @@ -103,7 +103,7 @@ func (bc *BlockChain) GetChainFromHash(hash []byte, max uint64) []interface{} { block := bc.GetBlock(currentHash) currentHash = block.PrevHash - chain = append(chain, block.RlpValue().Value) + chain = append(chain, block.Value().Val) //chain = append([]interface{}{block.RlpValue().Value}, chain...) num-- diff --git a/ethchain/block_manager.go b/ethchain/block_manager.go index 92f20e253..7d8397790 100644 --- a/ethchain/block_manager.go +++ b/ethchain/block_manager.go @@ -553,9 +553,9 @@ out: // Load the value in storage and push it on the stack x := bm.stack.Pop() // decode the object as a big integer - decoder := ethutil.NewRlpValueFromBytes([]byte(contract.State().Get(x.String()))) + decoder := ethutil.NewValueFromBytes([]byte(contract.State().Get(x.String()))) if !decoder.IsNil() { - bm.stack.Push(decoder.AsBigInt()) + bm.stack.Push(decoder.BigInt()) } else { bm.stack.Push(ethutil.BigFalse) } @@ -618,10 +618,10 @@ func getContractMemory(block *Block, contractAddr []byte, memAddr *big.Int) *big val := contract.State().Get(memAddr.String()) // decode the object as a big integer - decoder := ethutil.NewRlpValueFromBytes([]byte(val)) + decoder := ethutil.NewValueFromBytes([]byte(val)) if decoder.IsNil() { return ethutil.BigFalse } - return decoder.AsBigInt() + return decoder.BigInt() } diff --git a/ethchain/contract.go b/ethchain/contract.go index d1fcec3b4..70189593b 100644 --- a/ethchain/contract.go +++ b/ethchain/contract.go @@ -23,11 +23,11 @@ func (c *Contract) RlpEncode() []byte { } func (c *Contract) RlpDecode(data []byte) { - decoder := ethutil.NewRlpValueFromBytes(data) + decoder := ethutil.NewValueFromBytes(data) - c.Amount = decoder.Get(0).AsBigInt() - c.Nonce = decoder.Get(1).AsUint() - c.state = ethutil.NewTrie(ethutil.Config.Db, decoder.Get(2).AsRaw()) + c.Amount = decoder.Get(0).BigInt() + c.Nonce = decoder.Get(1).Uint() + c.state = ethutil.NewTrie(ethutil.Config.Db, decoder.Get(2).Interface()) } func (c *Contract) State() *ethutil.Trie { @@ -59,8 +59,8 @@ func (a *Address) RlpEncode() []byte { } func (a *Address) RlpDecode(data []byte) { - decoder := ethutil.NewRlpValueFromBytes(data) + decoder := ethutil.NewValueFromBytes(data) - a.Amount = decoder.Get(0).AsBigInt() - a.Nonce = decoder.Get(1).AsUint() + a.Amount = decoder.Get(0).BigInt() + a.Nonce = decoder.Get(1).Uint() } |