diff options
author | obscuren <geffobscura@gmail.com> | 2014-05-22 23:56:33 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2014-05-22 23:56:33 +0800 |
commit | cc8464ce805279735f637ac710b25e2fb264f9aa (patch) | |
tree | 00a8f39f76da20eec6fe4016e2e7f32955486b57 /ethchain/block.go | |
parent | 230aafbf66ba747fb3796810adf3b1680f368e73 (diff) | |
download | go-tangerine-cc8464ce805279735f637ac710b25e2fb264f9aa.tar go-tangerine-cc8464ce805279735f637ac710b25e2fb264f9aa.tar.gz go-tangerine-cc8464ce805279735f637ac710b25e2fb264f9aa.tar.bz2 go-tangerine-cc8464ce805279735f637ac710b25e2fb264f9aa.tar.lz go-tangerine-cc8464ce805279735f637ac710b25e2fb264f9aa.tar.xz go-tangerine-cc8464ce805279735f637ac710b25e2fb264f9aa.tar.zst go-tangerine-cc8464ce805279735f637ac710b25e2fb264f9aa.zip |
Transaction querying
Diffstat (limited to 'ethchain/block.go')
-rw-r--r-- | ethchain/block.go | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/ethchain/block.go b/ethchain/block.go index c846516f4..73e29f878 100644 --- a/ethchain/block.go +++ b/ethchain/block.go @@ -1,6 +1,7 @@ package ethchain import ( + "bytes" "fmt" "github.com/ethereum/eth-go/ethutil" "math/big" @@ -161,6 +162,16 @@ func (block *Block) BlockInfo() BlockInfo { return bi } +func (self *Block) GetTransaction(hash []byte) *Transaction { + for _, receipt := range self.receipts { + if bytes.Compare(receipt.Tx.Hash(), hash) == 0 { + return receipt.Tx + } + } + + return nil +} + // Sync the block's state and contract respectively func (block *Block) Sync() { block.state.Sync() |