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
b8160cc6
Commit
b8160cc6
authored
Apr 20, 2015
by
obscuren
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
core: shuffled some code
parent
f28b2bb6
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
7 deletions
+13
-7
chain_manager.go
core/chain_manager.go
+13
-7
No files found.
core/chain_manager.go
View file @
b8160cc6
...
@@ -26,11 +26,10 @@ var (
...
@@ -26,11 +26,10 @@ var (
blockNumPre
=
[]
byte
(
"block-num-"
)
blockNumPre
=
[]
byte
(
"block-num-"
)
)
)
const
blockCacheLimit
=
10000
const
(
blockCacheLimit
=
10000
type
StateQuery
interface
{
maxFutureBlocks
=
256
GetAccount
(
addr
[]
byte
)
*
state
.
StateObject
)
}
func
CalcDifficulty
(
block
,
parent
*
types
.
Header
)
*
big
.
Int
{
func
CalcDifficulty
(
block
,
parent
*
types
.
Header
)
*
big
.
Int
{
diff
:=
new
(
big
.
Int
)
diff
:=
new
(
big
.
Int
)
...
@@ -95,7 +94,14 @@ type ChainManager struct {
...
@@ -95,7 +94,14 @@ type ChainManager struct {
}
}
func
NewChainManager
(
blockDb
,
stateDb
common
.
Database
,
mux
*
event
.
TypeMux
)
*
ChainManager
{
func
NewChainManager
(
blockDb
,
stateDb
common
.
Database
,
mux
*
event
.
TypeMux
)
*
ChainManager
{
bc
:=
&
ChainManager
{
blockDb
:
blockDb
,
stateDb
:
stateDb
,
genesisBlock
:
GenesisBlock
(
stateDb
),
eventMux
:
mux
,
quit
:
make
(
chan
struct
{}),
cache
:
NewBlockCache
(
blockCacheLimit
)}
bc
:=
&
ChainManager
{
blockDb
:
blockDb
,
stateDb
:
stateDb
,
genesisBlock
:
GenesisBlock
(
stateDb
),
eventMux
:
mux
,
quit
:
make
(
chan
struct
{}),
cache
:
NewBlockCache
(
blockCacheLimit
),
}
bc
.
setLastBlock
()
bc
.
setLastBlock
()
// Check the current state of the block hashes and make sure that we do not have any of the bad blocks in our chain
// Check the current state of the block hashes and make sure that we do not have any of the bad blocks in our chain
...
@@ -116,7 +122,7 @@ func NewChainManager(blockDb, stateDb common.Database, mux *event.TypeMux) *Chai
...
@@ -116,7 +122,7 @@ func NewChainManager(blockDb, stateDb common.Database, mux *event.TypeMux) *Chai
// Take ownership of this particular state
// Take ownership of this particular state
bc
.
txState
=
state
.
ManageState
(
bc
.
State
()
.
Copy
())
bc
.
txState
=
state
.
ManageState
(
bc
.
State
()
.
Copy
())
bc
.
futureBlocks
=
NewBlockCache
(
254
)
bc
.
futureBlocks
=
NewBlockCache
(
maxFutureBlocks
)
bc
.
makeCache
()
bc
.
makeCache
()
go
bc
.
update
()
go
bc
.
update
()
...
...
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