Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张蕾
Geth-Modification
Commits
cc8464ce
Commit
cc8464ce
authored
May 22, 2014
by
obscuren
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Transaction querying
parent
230aafbf
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
4 deletions
+30
-4
block.go
ethchain/block.go
+11
-0
transaction.go
ethchain/transaction.go
+3
-3
types.go
ethpub/types.go
+16
-1
No files found.
ethchain/block.go
View file @
cc8464ce
package
ethchain
package
ethchain
import
(
import
(
"bytes"
"fmt"
"fmt"
"github.com/ethereum/eth-go/ethutil"
"github.com/ethereum/eth-go/ethutil"
"math/big"
"math/big"
...
@@ -161,6 +162,16 @@ func (block *Block) BlockInfo() BlockInfo {
...
@@ -161,6 +162,16 @@ func (block *Block) BlockInfo() BlockInfo {
return
bi
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
// Sync the block's state and contract respectively
func
(
block
*
Block
)
Sync
()
{
func
(
block
*
Block
)
Sync
()
{
block
.
state
.
Sync
()
block
.
state
.
Sync
()
...
...
ethchain/transaction.go
View file @
cc8464ce
...
@@ -167,10 +167,10 @@ func (tx *Transaction) String() string {
...
@@ -167,10 +167,10 @@ func (tx *Transaction) String() string {
TX(%x)
TX(%x)
Contract: %v
Contract: %v
From: %x
From: %x
To: %x
Nonce: %v
Nonce: %v
GasPrice: %v
GasPrice: %v
Gas: %v
Gas: %v
To: %x
Value: %v
Value: %v
Data: 0x%x
Data: 0x%x
V: 0x%x
V: 0x%x
...
@@ -178,12 +178,12 @@ func (tx *Transaction) String() string {
...
@@ -178,12 +178,12 @@ func (tx *Transaction) String() string {
S: 0x%x
S: 0x%x
`
,
`
,
tx
.
Hash
(),
tx
.
Hash
(),
len
(
tx
.
Recipient
)
>
1
,
len
(
tx
.
Recipient
)
==
1
,
tx
.
Sender
(),
tx
.
Sender
(),
tx
.
Recipient
,
tx
.
Nonce
,
tx
.
Nonce
,
tx
.
GasPrice
,
tx
.
GasPrice
,
tx
.
Gas
,
tx
.
Gas
,
tx
.
Recipient
,
tx
.
Value
,
tx
.
Value
,
tx
.
Data
,
tx
.
Data
,
tx
.
v
,
tx
.
v
,
...
...
ethpub/types.go
View file @
cc8464ce
...
@@ -31,7 +31,18 @@ func (self *PBlock) ToString() string {
...
@@ -31,7 +31,18 @@ func (self *PBlock) ToString() string {
return
""
return
""
}
}
func
(
self
*
PBlock
)
GetTransaction
(
hash
string
)
*
PTx
{
tx
:=
self
.
ref
.
GetTransaction
(
ethutil
.
FromHex
(
hash
))
if
tx
==
nil
{
return
nil
}
return
NewPTx
(
tx
)
}
type
PTx
struct
{
type
PTx
struct
{
ref
*
ethchain
.
Transaction
Value
,
Hash
,
Address
string
Value
,
Hash
,
Address
string
Contract
bool
Contract
bool
}
}
...
@@ -41,7 +52,11 @@ func NewPTx(tx *ethchain.Transaction) *PTx {
...
@@ -41,7 +52,11 @@ func NewPTx(tx *ethchain.Transaction) *PTx {
sender
:=
hex
.
EncodeToString
(
tx
.
Recipient
)
sender
:=
hex
.
EncodeToString
(
tx
.
Recipient
)
isContract
:=
len
(
tx
.
Data
)
>
0
isContract
:=
len
(
tx
.
Data
)
>
0
return
&
PTx
{
Hash
:
hash
,
Value
:
ethutil
.
CurrencyToString
(
tx
.
Value
),
Address
:
sender
,
Contract
:
isContract
}
return
&
PTx
{
ref
:
tx
,
Hash
:
hash
,
Value
:
ethutil
.
CurrencyToString
(
tx
.
Value
),
Address
:
sender
,
Contract
:
isContract
}
}
func
(
self
*
PTx
)
ToString
()
string
{
return
self
.
ref
.
String
()
}
}
type
PKey
struct
{
type
PKey
struct
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment