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
aba901e1
Commit
aba901e1
authored
Jun 24, 2015
by
Jeffrey Wilcke
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
core: removed write's go routine
parent
07db098c
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
8 deletions
+3
-8
chain_makers_test.go
core/chain_makers_test.go
+1
-1
chain_manager.go
core/chain_manager.go
+2
-7
No files found.
core/chain_makers_test.go
View file @
aba901e1
...
...
@@ -60,7 +60,7 @@ func ExampleGenerateChain() {
evmux
:=
&
event
.
TypeMux
{}
chainman
,
_
:=
NewChainManager
(
genesis
,
db
,
db
,
FakePow
{},
evmux
)
chainman
.
SetProcessor
(
NewBlockProcessor
(
db
,
db
,
FakePow
{},
chainman
,
evmux
))
if
i
,
err
:=
chainman
.
InsertChain
(
chain
);
err
!=
nil
{
if
i
,
err
:=
chainman
.
InsertChain
(
chain
[
1
:
]
);
err
!=
nil
{
fmt
.
Printf
(
"insert error (block %d): %v
\n
"
,
i
,
err
)
return
}
...
...
core/chain_manager.go
View file @
aba901e1
...
...
@@ -22,6 +22,7 @@ import (
"github.com/ethereum/go-ethereum/pow"
"github.com/ethereum/go-ethereum/rlp"
"github.com/hashicorp/golang-lru"
"github.com/rcrowley/go-metrics"
"github.com/syndtr/goleveldb/leveldb"
)
...
...
@@ -263,9 +264,7 @@ func (bc *ChainManager) setLastState() {
func
(
bc
*
ChainManager
)
makeCache
()
{
bc
.
cache
,
_
=
lru
.
New
(
blockCacheLimit
)
// load in last `blockCacheLimit` - 1 blocks. Last block is the current.
ancestors
:=
bc
.
GetAncestors
(
bc
.
currentBlock
,
blockCacheLimit
-
1
)
ancestors
=
append
(
ancestors
,
bc
.
currentBlock
)
for
_
,
block
:=
range
ancestors
{
for
_
,
block
:=
range
bc
.
GetBlocksFromHash
(
bc
.
currentBlock
.
Hash
(),
blockCacheLimit
)
{
bc
.
cache
.
Add
(
block
.
Hash
(),
block
)
}
}
...
...
@@ -571,9 +570,6 @@ func (self *ChainManager) InsertChain(chain types.Blocks) (int, error) {
defer
close
(
nonceQuit
)
defer
self
.
flushQueuedBlocks
()
defer
func
()
{
}()
txcount
:=
0
for
i
,
block
:=
range
chain
{
if
atomic
.
LoadInt32
(
&
self
.
procInterrupt
)
==
1
{
...
...
@@ -683,7 +679,6 @@ func (self *ChainManager) InsertChain(chain types.Blocks) (int, error) {
queue
[
i
]
=
ChainSideEvent
{
block
,
logs
}
queueEvent
.
sideCount
++
}
// not in the canonical chain.
self
.
enqueueForWrite
(
block
)
// Delete from future blocks
self
.
futureBlocks
.
Delete
(
block
.
Hash
())
...
...
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