good morning!!!!
Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
bor
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Harbor Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
open
bor
Commits
7d3e99a2
Commit
7d3e99a2
authored
May 20, 2014
by
Jeffrey Wilcke
Browse files
Options
Downloads
Patches
Plain Diff
Fixed genesis and block data
parent
b4e156e1
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
ethchain/block.go
+62
-7
62 additions, 7 deletions
ethchain/block.go
ethchain/genesis.go
+12
-5
12 additions, 5 deletions
ethchain/genesis.go
with
74 additions
and
12 deletions
ethchain/block.go
+
62
−
7
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
+
12
−
5
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.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment