diff options
Diffstat (limited to 'xeth')
-rw-r--r-- | xeth/xeth.go | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/xeth/xeth.go b/xeth/xeth.go index 60262bf17..e73cd70c9 100644 --- a/xeth/xeth.go +++ b/xeth/xeth.go @@ -122,7 +122,14 @@ func (self *XEth) BlockByHash(strHash string) *Block { return NewBlock(block) } -func (self *XEth) BlockByNumber(num int32) *Block { +func (self *XEth) EthBlockByHash(strHash string) *types.Block { + hash := fromHex(strHash) + block := self.chainManager.GetBlock(hash) + + return block +} + +func (self *XEth) BlockByNumber(num int64) *Block { if num == -1 { return NewBlock(self.chainManager.CurrentBlock()) } @@ -130,13 +137,21 @@ func (self *XEth) BlockByNumber(num int32) *Block { return NewBlock(self.chainManager.GetBlockByNumber(uint64(num))) } +func (self *XEth) EthBlockByNumber(num int64) *types.Block { + if num == -1 { + return self.chainManager.CurrentBlock() + } + + return self.chainManager.GetBlockByNumber(uint64(num)) +} + func (self *XEth) Block(v interface{}) *Block { if n, ok := v.(int32); ok { - return self.BlockByNumber(n) + return self.BlockByNumber(int64(n)) } else if str, ok := v.(string); ok { return self.BlockByHash(str) } else if f, ok := v.(float64); ok { // Don't ask ... - return self.BlockByNumber(int32(f)) + return self.BlockByNumber(int64(f)) } return nil @@ -327,7 +342,7 @@ func (self *XEth) Transact(fromStr, toStr, valueStr, gasStr, gasPriceStr, codeSt tx = types.NewTransactionMessage(to, value.BigInt(), gas.BigInt(), price.BigInt(), data) } - state := self.chainManager.TransState() + state := self.chainManager.TxState() nonce := state.GetNonce(from) tx.SetNonce(nonce) |