aboutsummaryrefslogtreecommitdiffstats
path: root/ethchain
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
parent230aafbf66ba747fb3796810adf3b1680f368e73 (diff)
downloadgo-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')
-rw-r--r--ethchain/block.go11
-rw-r--r--ethchain/transaction.go6
2 files changed, 14 insertions, 3 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()
diff --git a/ethchain/transaction.go b/ethchain/transaction.go
index 16ea312c0..6ae7e77e1 100644
--- a/ethchain/transaction.go
+++ b/ethchain/transaction.go
@@ -167,10 +167,10 @@ func (tx *Transaction) String() string {
TX(%x)
Contract: %v
From: %x
+ To: %x
Nonce: %v
GasPrice: %v
Gas: %v
- To: %x
Value: %v
Data: 0x%x
V: 0x%x
@@ -178,12 +178,12 @@ func (tx *Transaction) String() string {
S: 0x%x
`,
tx.Hash(),
- len(tx.Recipient) > 1,
+ len(tx.Recipient) == 1,
tx.Sender(),
+ tx.Recipient,
tx.Nonce,
tx.GasPrice,
tx.Gas,
- tx.Recipient,
tx.Value,
tx.Data,
tx.v,