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
9226369b
Commit
9226369b
authored
Jun 30, 2015
by
Jeffrey Wilcke
Browse files
Options
Downloads
Plain Diff
Merge branch 'hotfix/0.9.34-1' into develop
parents
b047f05e
d8fe64ac
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
core/chain_manager.go
+18
-15
18 additions, 15 deletions
core/chain_manager.go
miner/worker.go
+1
-1
1 addition, 1 deletion
miner/worker.go
with
19 additions
and
16 deletions
core/chain_manager.go
+
18
−
15
View file @
9226369b
...
@@ -364,14 +364,12 @@ func (bc *ChainManager) insert(block *types.Block) {
...
@@ -364,14 +364,12 @@ func (bc *ChainManager) insert(block *types.Block) {
func
(
bc
*
ChainManager
)
write
(
block
*
types
.
Block
)
{
func
(
bc
*
ChainManager
)
write
(
block
*
types
.
Block
)
{
tstart
:=
time
.
Now
()
tstart
:=
time
.
Now
()
go
func
()
{
enc
,
_
:=
rlp
.
EncodeToBytes
((
*
types
.
StorageBlock
)(
block
))
enc
,
_
:=
rlp
.
EncodeToBytes
((
*
types
.
StorageBlock
)(
block
))
key
:=
append
(
blockHashPre
,
block
.
Hash
()
.
Bytes
()
...
)
key
:=
append
(
blockHashPre
,
block
.
Hash
()
.
Bytes
()
...
)
err
:=
bc
.
blockDb
.
Put
(
key
,
enc
)
err
:=
bc
.
blockDb
.
Put
(
key
,
enc
)
if
err
!=
nil
{
if
err
!=
nil
{
glog
.
Fatal
(
"db write fail:"
,
err
)
glog
.
Fatal
(
"db write fail:"
,
err
)
}
}
}()
if
glog
.
V
(
logger
.
Debug
)
{
if
glog
.
V
(
logger
.
Debug
)
{
glog
.
Infof
(
"wrote block #%v %s. Took %v
\n
"
,
block
.
Number
(),
common
.
PP
(
block
.
Hash
()
.
Bytes
()),
time
.
Since
(
tstart
))
glog
.
Infof
(
"wrote block #%v %s. Took %v
\n
"
,
block
.
Number
(),
common
.
PP
(
block
.
Hash
()
.
Bytes
()),
time
.
Since
(
tstart
))
...
@@ -555,7 +553,8 @@ const (
...
@@ -555,7 +553,8 @@ const (
sideStatTy
sideStatTy
)
)
func
(
self
*
ChainManager
)
WriteBlock
(
block
*
types
.
Block
)
(
status
writeStatus
,
err
error
)
{
// WriteBlock writes the block to the chain (or pending queue)
func
(
self
*
ChainManager
)
WriteBlock
(
block
*
types
.
Block
,
queued
bool
)
(
status
writeStatus
,
err
error
)
{
self
.
wg
.
Add
(
1
)
self
.
wg
.
Add
(
1
)
defer
self
.
wg
.
Done
()
defer
self
.
wg
.
Done
()
...
@@ -587,11 +586,15 @@ func (self *ChainManager) WriteBlock(block *types.Block) (status writeStatus, er
...
@@ -587,11 +586,15 @@ func (self *ChainManager) WriteBlock(block *types.Block) (status writeStatus, er
status
=
sideStatTy
status
=
sideStatTy
}
}
if
queued
{
// Write block to database. Eventually we'll have to improve on this and throw away blocks that are
// Write block to database. Eventually we'll have to improve on this and throw away blocks that are
// not in the canonical chain.
// not in the canonical chain.
self
.
mu
.
Lock
()
self
.
mu
.
Lock
()
self
.
enqueueForWrite
(
block
)
self
.
enqueueForWrite
(
block
)
self
.
mu
.
Unlock
()
self
.
mu
.
Unlock
()
}
else
{
self
.
write
(
block
)
}
// Delete from future blocks
// Delete from future blocks
self
.
futureBlocks
.
Remove
(
block
.
Hash
())
self
.
futureBlocks
.
Remove
(
block
.
Hash
())
...
@@ -693,7 +696,7 @@ func (self *ChainManager) InsertChain(chain types.Blocks) (int, error) {
...
@@ -693,7 +696,7 @@ func (self *ChainManager) InsertChain(chain types.Blocks) (int, error) {
txcount
+=
len
(
block
.
Transactions
())
txcount
+=
len
(
block
.
Transactions
())
// write the block to the chain and get the status
// write the block to the chain and get the status
status
,
err
:=
self
.
WriteBlock
(
block
)
status
,
err
:=
self
.
WriteBlock
(
block
,
true
)
if
err
!=
nil
{
if
err
!=
nil
{
return
i
,
err
return
i
,
err
}
}
...
...
This diff is collapsed.
Click to expand it.
miner/worker.go
+
1
−
1
View file @
9226369b
...
@@ -233,7 +233,7 @@ func (self *worker) wait() {
...
@@ -233,7 +233,7 @@ func (self *worker) wait() {
continue
continue
}
}
_
,
err
:=
self
.
chain
.
WriteBlock
(
block
)
_
,
err
:=
self
.
chain
.
WriteBlock
(
block
,
false
)
if
err
!=
nil
{
if
err
!=
nil
{
glog
.
V
(
logger
.
Error
)
.
Infoln
(
"error writing block to chain"
,
err
)
glog
.
V
(
logger
.
Error
)
.
Infoln
(
"error writing block to chain"
,
err
)
continue
continue
...
...
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