Transaction querying

This commit is contained in:
obscuren
2014-05-22 17:56:33 +02:00
parent 230aafbf66
commit cc8464ce80
3 changed files with 30 additions and 4 deletions

View File

@@ -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()