aboutsummaryrefslogtreecommitdiffstats
path: root/ethchain/block.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-05-22 23:56:33 +0800
committerobscuren <geffobscura@gmail.com>2014-05-22 23:56:33 +0800
commitcc8464ce805279735f637ac710b25e2fb264f9aa (patch)
tree00a8f39f76da20eec6fe4016e2e7f32955486b57 /ethchain/block.go
parent230aafbf66ba747fb3796810adf3b1680f368e73 (diff)
downloaddexon-cc8464ce805279735f637ac710b25e2fb264f9aa.tar.gz
dexon-cc8464ce805279735f637ac710b25e2fb264f9aa.tar.zst
dexon-cc8464ce805279735f637ac710b25e2fb264f9aa.zip
Transaction querying
Diffstat (limited to 'ethchain/block.go')
-rw-r--r--ethchain/block.go11
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()