aboutsummaryrefslogtreecommitdiffstats
path: root/core/types
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2015-02-18 20:14:21 +0800
committerobscuren <geffobscura@gmail.com>2015-02-18 20:14:21 +0800
commit655e94259765b02454df93205a30a271103de5a0 (patch)
tree818cd1e9156dda16d78257b2ad656edeb0058759 /core/types
parentbe90ad89a89502ef3d2c0375d267b667618f5e7c (diff)
downloaddexon-655e94259765b02454df93205a30a271103de5a0.tar
dexon-655e94259765b02454df93205a30a271103de5a0.tar.gz
dexon-655e94259765b02454df93205a30a271103de5a0.tar.bz2
dexon-655e94259765b02454df93205a30a271103de5a0.tar.lz
dexon-655e94259765b02454df93205a30a271103de5a0.tar.xz
dexon-655e94259765b02454df93205a30a271103de5a0.tar.zst
dexon-655e94259765b02454df93205a30a271103de5a0.zip
Added GetBlock GetUncle with OOB guard
Diffstat (limited to 'core/types')
-rw-r--r--core/types/block.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/core/types/block.go b/core/types/block.go
index fa28f5cc7..d57de1311 100644
--- a/core/types/block.go
+++ b/core/types/block.go
@@ -185,6 +185,18 @@ func (self *Block) GasUsed() *big.Int { return self.header.GasUsed }
func (self *Block) Root() []byte { return self.header.Root }
func (self *Block) SetRoot(root []byte) { self.header.Root = root }
func (self *Block) Size() ethutil.StorageSize { return ethutil.StorageSize(len(ethutil.Encode(self))) }
+func (self *Block) GetTransaction(i int) *Transaction {
+ if len(self.transactions) > i {
+ return self.transactions[i]
+ }
+ return nil
+}
+func (self *Block) GetUncle(i int) *Header {
+ if len(self.uncles) > i {
+ return self.uncles[i]
+ }
+ return nil
+}
// Implement pow.Block
func (self *Block) Difficulty() *big.Int { return self.header.Difficulty }