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
94298060
Commit
94298060
authored
Mar 18, 2015
by
obscuren
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
conversions
parent
cd52ef31
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
30 additions
and
27 deletions
+30
-27
common.go
core/types/common.go
+4
-0
blocktest.go
tests/blocktest.go
+4
-5
state.go
xeth/state.go
+3
-3
types.go
xeth/types.go
+19
-19
No files found.
core/types/common.go
View file @
94298060
...
...
@@ -35,3 +35,7 @@ func (b *Bloom) SetBytes(d []byte) {
func
(
b
Bloom
)
Big
()
*
big
.
Int
{
return
common
.
Bytes2Big
(
b
[
:
])
}
func
(
b
Bloom
)
Bytes
()
[]
byte
{
return
b
[
:
]
}
tests/blocktest.go
View file @
94298060
...
...
@@ -13,7 +13,6 @@ import (
"strings"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/rlp"
"github.com/ethereum/go-ethereum/state"
...
...
@@ -99,7 +98,7 @@ func LoadBlockTests(file string) (map[string]*BlockTest, error) {
// InsertPreState populates the given database with the genesis
// accounts defined by the test.
func
(
t
*
BlockTest
)
InsertPreState
(
db
common
.
Database
)
error
{
statedb
:=
state
.
New
(
nil
,
db
)
statedb
:=
state
.
New
(
common
.
Hash
{}
,
db
)
for
addrString
,
acct
:=
range
t
.
preAccounts
{
// XXX: is is worth it checking for errors here?
//addr, _ := hex.DecodeString(addrString)
...
...
@@ -120,7 +119,7 @@ func (t *BlockTest) InsertPreState(db common.Database) error {
// sync trie to disk
statedb
.
Sync
()
if
!
bytes
.
Equal
(
t
.
Genesis
.
Root
()
.
Bytes
(),
statedb
.
Root
()
)
{
if
t
.
Genesis
.
Root
()
!=
statedb
.
Root
(
)
{
return
errors
.
New
(
"computed state root does not match genesis block"
)
}
return
nil
...
...
@@ -212,12 +211,12 @@ func mustConvertAddress(in string) common.Address {
return
common
.
BytesToAddress
(
out
)
}
func
mustConvertBloom
(
in
string
)
core
.
Bloom
{
func
mustConvertBloom
(
in
string
)
types
.
Bloom
{
out
,
err
:=
hex
.
DecodeString
(
strings
.
TrimPrefix
(
in
,
"0x"
))
if
err
!=
nil
{
panic
(
fmt
.
Errorf
(
"invalid hex: %q"
,
in
))
}
return
core
.
BytesToBloom
(
out
)
return
types
.
BytesToBloom
(
out
)
}
func
mustConvertBigInt10
(
in
string
)
*
big
.
Int
{
...
...
xeth/state.go
View file @
94298060
...
...
@@ -19,7 +19,7 @@ func (self *State) State() *state.StateDB {
}
func
(
self
*
State
)
Get
(
addr
string
)
*
Object
{
return
&
Object
{
self
.
state
.
GetStateObject
(
common
.
FromHex
(
addr
))}
return
&
Object
{
self
.
state
.
GetStateObject
(
common
.
HexToAddress
(
addr
))}
}
func
(
self
*
State
)
SafeGet
(
addr
string
)
*
Object
{
...
...
@@ -27,9 +27,9 @@ func (self *State) SafeGet(addr string) *Object {
}
func
(
self
*
State
)
safeGet
(
addr
string
)
*
state
.
StateObject
{
object
:=
self
.
state
.
GetStateObject
(
common
.
FromHex
(
addr
))
object
:=
self
.
state
.
GetStateObject
(
common
.
HexToAddress
(
addr
))
if
object
==
nil
{
object
=
state
.
NewStateObject
(
common
.
FromHex
(
addr
),
self
.
xeth
.
eth
.
StateDb
())
object
=
state
.
NewStateObject
(
common
.
HexToAddress
(
addr
),
self
.
xeth
.
eth
.
StateDb
())
}
return
object
...
...
xeth/types.go
View file @
94298060
...
...
@@ -5,10 +5,10 @@ import (
"fmt"
"strings"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/p2p"
"github.com/ethereum/go-ethereum/rlp"
"github.com/ethereum/go-ethereum/state"
...
...
@@ -59,19 +59,19 @@ func (self *Object) Storage() (storage map[string]string) {
type
Block
struct
{
//Transactions string `json:"transactions"`
ref
*
types
.
Block
Size
string
`json:"size"`
Number
int
`json:"number"`
Hash
string
`json:"hash"`
Size
string
`json:"size"`
Number
int
`json:"number"`
Hash
string
`json:"hash"`
Transactions
*
common
.
List
`json:"transactions"`
Uncles
*
common
.
List
`json:"uncles"`
Time
int64
`json:"time"`
Coinbase
string
`json:"coinbase"`
Name
string
`json:"name"`
GasLimit
string
`json:"gasLimit"`
GasUsed
string
`json:"gasUsed"`
PrevHash
string
`json:"prevHash"`
Bloom
string
`json:"bloom"`
Raw
string
`json:"raw"`
Time
int64
`json:"time"`
Coinbase
string
`json:"coinbase"`
Name
string
`json:"name"`
GasLimit
string
`json:"gasLimit"`
GasUsed
string
`json:"gasUsed"`
PrevHash
string
`json:"prevHash"`
Bloom
string
`json:"bloom"`
Raw
string
`json:"raw"`
}
// Creates a new QML Block from a chain block
...
...
@@ -95,12 +95,12 @@ func NewBlock(block *types.Block) *Block {
return
&
Block
{
ref
:
block
,
Size
:
block
.
Size
()
.
String
(),
Number
:
int
(
block
.
NumberU64
()),
GasUsed
:
block
.
GasUsed
()
.
String
(),
GasLimit
:
block
.
GasLimit
()
.
String
(),
Hash
:
toHex
(
block
.
Hash
()),
GasLimit
:
block
.
GasLimit
()
.
String
(),
Hash
:
toHex
(
block
.
Hash
()
.
Bytes
()
),
Transactions
:
txlist
,
Uncles
:
ulist
,
Time
:
block
.
Time
(),
Coinbase
:
toHex
(
block
.
Coinbase
()),
PrevHash
:
toHex
(
block
.
ParentHash
()),
Bloom
:
toHex
(
block
.
Bloom
()),
Coinbase
:
toHex
(
block
.
Coinbase
()
.
Bytes
()
),
PrevHash
:
toHex
(
block
.
ParentHash
()
.
Bytes
()
),
Bloom
:
toHex
(
block
.
Bloom
()
.
Bytes
()
),
Raw
:
block
.
String
(),
}
}
...
...
@@ -114,7 +114,7 @@ func (self *Block) ToString() string {
}
func
(
self
*
Block
)
GetTransaction
(
hash
string
)
*
Transaction
{
tx
:=
self
.
ref
.
Transaction
(
common
.
FromHex
(
hash
))
tx
:=
self
.
ref
.
Transaction
(
common
.
HexToHash
(
hash
))
if
tx
==
nil
{
return
nil
}
...
...
@@ -139,8 +139,8 @@ type Transaction struct {
}
func
NewTx
(
tx
*
types
.
Transaction
)
*
Transaction
{
hash
:=
t
oHex
(
tx
.
Hash
()
)
receiver
:=
t
oHex
(
tx
.
To
()
)
hash
:=
t
x
.
Hash
()
.
Hex
(
)
receiver
:=
t
x
.
To
()
.
Hex
(
)
if
len
(
receiver
)
==
0
{
receiver
=
toHex
(
core
.
AddressFromMessage
(
tx
))
}
...
...
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