aboutsummaryrefslogtreecommitdiffstats
path: root/xeth
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-12-23 20:48:44 +0800
committerobscuren <geffobscura@gmail.com>2014-12-23 20:48:44 +0800
commit4cd79d8ddd7608d60344b13fe4bda7315429d1d9 (patch)
tree0d1abaa9ef5c302c1ef51e8e8dbd94e9e696f28a /xeth
parent4b52cd512d3c54451e680fcc6c3d67d059065bec (diff)
downloadgo-tangerine-4cd79d8ddd7608d60344b13fe4bda7315429d1d9.tar.gz
go-tangerine-4cd79d8ddd7608d60344b13fe4bda7315429d1d9.tar.zst
go-tangerine-4cd79d8ddd7608d60344b13fe4bda7315429d1d9.zip
Refactored block & Transaction
* Includes new rlp decoder
Diffstat (limited to 'xeth')
-rw-r--r--xeth/js_types.go20
-rw-r--r--xeth/pipe.go2
-rw-r--r--xeth/vm_env.go12
3 files changed, 17 insertions, 17 deletions
diff --git a/xeth/js_types.go b/xeth/js_types.go
index 04018f6a5..4bb1f4e7d 100644
--- a/xeth/js_types.go
+++ b/xeth/js_types.go
@@ -42,21 +42,21 @@ func NewJSBlock(block *types.Block) *JSBlock {
}
txlist := ethutil.NewList(ptxs)
- puncles := make([]*JSBlock, len(block.Uncles))
- for i, uncle := range block.Uncles {
- puncles[i] = NewJSBlock(uncle)
+ puncles := make([]*JSBlock, len(block.Uncles()))
+ for i, uncle := range block.Uncles() {
+ puncles[i] = NewJSBlock(types.NewBlockWithHeader(uncle))
}
ulist := ethutil.NewList(puncles)
return &JSBlock{
ref: block, Size: block.Size().String(),
- Number: int(block.Number.Uint64()), GasUsed: block.GasUsed.String(),
- GasLimit: block.GasLimit.String(), Hash: ethutil.Bytes2Hex(block.Hash()),
+ Number: int(block.NumberU64()), GasUsed: block.GasUsed().String(),
+ GasLimit: block.GasLimit().String(), Hash: ethutil.Bytes2Hex(block.Hash()),
Transactions: txlist, Uncles: ulist,
- Time: block.Time,
- Coinbase: ethutil.Bytes2Hex(block.Coinbase),
- PrevHash: ethutil.Bytes2Hex(block.PrevHash),
- Bloom: ethutil.Bytes2Hex(block.LogsBloom),
+ Time: block.Time(),
+ Coinbase: ethutil.Bytes2Hex(block.Coinbase()),
+ PrevHash: ethutil.Bytes2Hex(block.ParentHash()),
+ Bloom: ethutil.Bytes2Hex(block.Bloom()),
Raw: block.String(),
}
}
@@ -70,7 +70,7 @@ func (self *JSBlock) ToString() string {
}
func (self *JSBlock) GetTransaction(hash string) *JSTransaction {
- tx := self.ref.GetTransaction(ethutil.Hex2Bytes(hash))
+ tx := self.ref.Transaction(ethutil.Hex2Bytes(hash))
if tx == nil {
return nil
}
diff --git a/xeth/pipe.go b/xeth/pipe.go
index 06820cc86..775d5cfc5 100644
--- a/xeth/pipe.go
+++ b/xeth/pipe.go
@@ -140,7 +140,7 @@ func (self *XEth) Transact(key *crypto.KeyPair, to []byte, value, gas, price *et
// Do some pre processing for our "pre" events and hooks
block := self.chainManager.NewBlock(key.Address())
coinbase := state.GetStateObject(key.Address())
- coinbase.SetGasPool(block.GasLimit)
+ coinbase.SetGasPool(block.GasLimit())
self.blockManager.ApplyTransactions(coinbase, state, block, types.Transactions{tx}, true)
err := self.obj.TxPool().Add(tx)
diff --git a/xeth/vm_env.go b/xeth/vm_env.go
index 7fb674a94..7633e0640 100644
--- a/xeth/vm_env.go
+++ b/xeth/vm_env.go
@@ -28,15 +28,15 @@ func NewEnv(state *state.StateDB, block *types.Block, value *big.Int, sender []b
}
func (self *VMEnv) Origin() []byte { return self.sender }
-func (self *VMEnv) BlockNumber() *big.Int { return self.block.Number }
-func (self *VMEnv) PrevHash() []byte { return self.block.PrevHash }
-func (self *VMEnv) Coinbase() []byte { return self.block.Coinbase }
-func (self *VMEnv) Time() int64 { return self.block.Time }
-func (self *VMEnv) Difficulty() *big.Int { return self.block.Difficulty }
+func (self *VMEnv) BlockNumber() *big.Int { return self.block.Number() }
+func (self *VMEnv) PrevHash() []byte { return self.block.ParentHash() }
+func (self *VMEnv) Coinbase() []byte { return self.block.Coinbase() }
+func (self *VMEnv) Time() int64 { return self.block.Time() }
+func (self *VMEnv) Difficulty() *big.Int { return self.block.Difficulty() }
func (self *VMEnv) BlockHash() []byte { return self.block.Hash() }
+func (self *VMEnv) GasLimit() *big.Int { return self.block.GasLimit() }
func (self *VMEnv) Value() *big.Int { return self.value }
func (self *VMEnv) State() *state.StateDB { return self.state }
-func (self *VMEnv) GasLimit() *big.Int { return self.block.GasLimit }
func (self *VMEnv) Depth() int { return self.depth }
func (self *VMEnv) SetDepth(i int) { self.depth = i }
func (self *VMEnv) AddLog(log state.Log) {