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
7d3e99a2
Commit
7d3e99a2
authored
11 years ago
by
obscuren
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed genesis and block data
parent
b4e156e1
master
v1.10.12
v1.10.12-modified
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
74 additions
and
12 deletions
+74
-12
block.go
ethchain/block.go
+62
-7
genesis.go
ethchain/genesis.go
+12
-5
No files found.
ethchain/block.go
View file @
7d3e99a2
...
@@ -40,6 +40,14 @@ type Block struct {
...
@@ -40,6 +40,14 @@ type Block struct {
Difficulty
*
big
.
Int
Difficulty
*
big
.
Int
// Creation time
// Creation time
Time
int64
Time
int64
// The block number
Number
*
big
.
Int
// Minimum Gas Price
MinGasPrice
*
big
.
Int
// Gas limit
GasLimit
*
big
.
Int
// Gas used
GasUsed
*
big
.
Int
// Extra data
// Extra data
Extra
string
Extra
string
// Block Nonce for verification
// Block Nonce for verification
...
@@ -233,9 +241,13 @@ func (block *Block) RlpValueDecode(decoder *ethutil.Value) {
...
@@ -233,9 +241,13 @@ func (block *Block) RlpValueDecode(decoder *ethutil.Value) {
block
.
state
=
NewState
(
ethutil
.
NewTrie
(
ethutil
.
Config
.
Db
,
header
.
Get
(
3
)
.
Val
))
block
.
state
=
NewState
(
ethutil
.
NewTrie
(
ethutil
.
Config
.
Db
,
header
.
Get
(
3
)
.
Val
))
block
.
TxSha
=
header
.
Get
(
4
)
.
Bytes
()
block
.
TxSha
=
header
.
Get
(
4
)
.
Bytes
()
block
.
Difficulty
=
header
.
Get
(
5
)
.
BigInt
()
block
.
Difficulty
=
header
.
Get
(
5
)
.
BigInt
()
block
.
Time
=
int64
(
header
.
Get
(
6
)
.
BigInt
()
.
Uint64
())
block
.
Number
=
header
.
Get
(
6
)
.
BigInt
()
block
.
Extra
=
header
.
Get
(
7
)
.
Str
()
block
.
MinGasPrice
=
header
.
Get
(
7
)
.
BigInt
()
block
.
Nonce
=
header
.
Get
(
8
)
.
Bytes
()
block
.
GasLimit
=
header
.
Get
(
8
)
.
BigInt
()
block
.
GasUsed
=
header
.
Get
(
9
)
.
BigInt
()
block
.
Time
=
int64
(
header
.
Get
(
10
)
.
BigInt
()
.
Uint64
())
block
.
Extra
=
header
.
Get
(
11
)
.
Str
()
block
.
Nonce
=
header
.
Get
(
12
)
.
Bytes
()
block
.
contractStates
=
make
(
map
[
string
]
*
ethutil
.
Trie
)
block
.
contractStates
=
make
(
map
[
string
]
*
ethutil
.
Trie
)
// Tx list might be empty if this is an uncle. Uncles only have their
// Tx list might be empty if this is an uncle. Uncles only have their
...
@@ -270,16 +282,51 @@ func NewUncleBlockFromValue(header *ethutil.Value) *Block {
...
@@ -270,16 +282,51 @@ func NewUncleBlockFromValue(header *ethutil.Value) *Block {
block
.
state
=
NewState
(
ethutil
.
NewTrie
(
ethutil
.
Config
.
Db
,
header
.
Get
(
3
)
.
Val
))
block
.
state
=
NewState
(
ethutil
.
NewTrie
(
ethutil
.
Config
.
Db
,
header
.
Get
(
3
)
.
Val
))
block
.
TxSha
=
header
.
Get
(
4
)
.
Bytes
()
block
.
TxSha
=
header
.
Get
(
4
)
.
Bytes
()
block
.
Difficulty
=
header
.
Get
(
5
)
.
BigInt
()
block
.
Difficulty
=
header
.
Get
(
5
)
.
BigInt
()
block
.
Time
=
int64
(
header
.
Get
(
6
)
.
BigInt
()
.
Uint64
())
block
.
Number
=
header
.
Get
(
6
)
.
BigInt
()
block
.
Extra
=
header
.
Get
(
7
)
.
Str
()
block
.
MinGasPrice
=
header
.
Get
(
7
)
.
BigInt
()
block
.
Nonce
=
header
.
Get
(
8
)
.
Bytes
()
block
.
GasLimit
=
header
.
Get
(
8
)
.
BigInt
()
block
.
GasUsed
=
header
.
Get
(
9
)
.
BigInt
()
block
.
Time
=
int64
(
header
.
Get
(
10
)
.
BigInt
()
.
Uint64
())
block
.
Extra
=
header
.
Get
(
11
)
.
Str
()
block
.
Nonce
=
header
.
Get
(
12
)
.
Bytes
()
return
block
return
block
}
}
func
(
block
*
Block
)
String
()
string
{
func
(
block
*
Block
)
String
()
string
{
return
fmt
.
Sprintf
(
"Block(%x):
\n
PrevHash:%x
\n
UncleSha:%x
\n
Coinbase:%x
\n
Root:%x
\n
TxSha:%x
\n
Diff:%v
\n
Time:%d
\n
Nonce:%x
\n
Txs:%d
\n
"
,
block
.
Hash
(),
block
.
PrevHash
,
block
.
UncleSha
,
block
.
Coinbase
,
block
.
state
.
trie
.
Root
,
block
.
TxSha
,
block
.
Difficulty
,
block
.
Time
,
block
.
Nonce
,
len
(
block
.
transactions
))
//return fmt.Sprintf("Block(%x):\nPrevHash:%x\nUncleSha:%x\nCoinbase:%x\nRoot:%x\nTxSha:%x\nDiff:%v\nNonce:%x\nTxs:%d\n", block.Hash(), block.PrevHash, block.UncleSha, block.Coinbase, block.state.trie.Root, block.TxSha, block.Difficulty, block.Time, block.Nonce, len(block.transactions))
return
fmt
.
Sprintf
(
`
Block(%x):
PrevHash: %x
UncleSha: %x
Coinbase: %x
Root: %x
TxSha: %x
Difficulty: %v
Number: %v
MinGas: %v
MaxLimit: %v
GasUsed: %v
Time: %v
Extra: %v
Nonce: %x
`
,
block
.
Hash
(),
block
.
PrevHash
,
block
.
UncleSha
,
block
.
Coinbase
,
block
.
state
.
trie
.
Root
,
block
.
TxSha
,
block
.
Difficulty
,
block
.
Number
,
block
.
MinGasPrice
,
block
.
GasLimit
,
block
.
GasUsed
,
block
.
Time
,
block
.
Extra
,
block
.
Nonce
)
}
}
func
(
block
*
Block
)
GetRoot
()
interface
{}
{
func
(
block
*
Block
)
GetRoot
()
interface
{}
{
return
block
.
state
.
trie
.
Root
return
block
.
state
.
trie
.
Root
}
}
...
@@ -299,6 +346,14 @@ func (block *Block) header() []interface{} {
...
@@ -299,6 +346,14 @@ func (block *Block) header() []interface{} {
block
.
TxSha
,
block
.
TxSha
,
// Current block Difficulty
// Current block Difficulty
block
.
Difficulty
,
block
.
Difficulty
,
// The block number
block
.
Number
,
// Block minimum gas price
block
.
MinGasPrice
,
// Block upper gas bound
block
.
GasLimit
,
// Block gas used
block
.
GasUsed
,
// Time the block was found?
// Time the block was found?
block
.
Time
,
block
.
Time
,
// Extra data
// Extra data
...
...
This diff is collapsed.
Click to expand it.
ethchain/genesis.go
View file @
7d3e99a2
...
@@ -15,7 +15,6 @@ var EmptyShaList = ethutil.Sha3Bin(ethutil.Encode([]interface{}{}))
...
@@ -15,7 +15,6 @@ var EmptyShaList = ethutil.Sha3Bin(ethutil.Encode([]interface{}{}))
var
GenesisHeader
=
[]
interface
{}{
var
GenesisHeader
=
[]
interface
{}{
// Previous hash (none)
// Previous hash (none)
//"",
ZeroHash256
,
ZeroHash256
,
// Sha of uncles
// Sha of uncles
ethutil
.
Sha3Bin
(
ethutil
.
Encode
([]
interface
{}{})),
ethutil
.
Sha3Bin
(
ethutil
.
Encode
([]
interface
{}{})),
...
@@ -23,15 +22,23 @@ var GenesisHeader = []interface{}{
...
@@ -23,15 +22,23 @@ var GenesisHeader = []interface{}{
ZeroHash160
,
ZeroHash160
,
// Root state
// Root state
""
,
""
,
// Sha of transactions
//EmptyShaList,
//EmptyShaList,
ethutil
.
Sha3Bin
(
ethutil
.
Encode
([]
interface
{}{})),
ZeroHash256
,
//ethutil.Sha3Bin(ethutil.Encode(ZeroHash256)),
// Difficulty
// Difficulty
ethutil
.
BigPow
(
2
,
22
),
ethutil
.
BigPow
(
2
,
22
),
// Number
ethutil
.
Big0
,
// Block minimum gas price
ethutil
.
Big0
,
// Block upper gas bound
big
.
NewInt
(
1000000
),
// Block gas used
ethutil
.
Big0
,
// Time
// Time
int64
(
0
)
,
ethutil
.
Big0
,
// Extra
// Extra
""
,
nil
,
// Nonce
// Nonce
ethutil
.
Sha3Bin
(
big
.
NewInt
(
42
)
.
Bytes
()),
ethutil
.
Sha3Bin
(
big
.
NewInt
(
42
)
.
Bytes
()),
}
}
...
...
This diff is collapsed.
Click to expand it.
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