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
d2a4bc4d
Commit
d2a4bc4d
authored
Feb 16, 2015
by
Jeffrey Wilcke
Browse files
Options
Downloads
Patches
Plain Diff
Removed reference to lastBlockNumber & LastBlockNumber
parent
2c3a014f
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
core/chain_manager.go
+5
-21
5 additions, 21 deletions
core/chain_manager.go
with
5 additions
and
21 deletions
core/chain_manager.go
+
5
−
21
View file @
d2a4bc4d
...
@@ -80,7 +80,6 @@ type ChainManager struct {
...
@@ -80,7 +80,6 @@ type ChainManager struct {
// Last known total difficulty
// Last known total difficulty
mu
sync
.
RWMutex
mu
sync
.
RWMutex
td
*
big
.
Int
td
*
big
.
Int
lastBlockNumber
uint64
currentBlock
*
types
.
Block
currentBlock
*
types
.
Block
lastBlockHash
[]
byte
lastBlockHash
[]
byte
...
@@ -94,13 +93,6 @@ func (self *ChainManager) Td() *big.Int {
...
@@ -94,13 +93,6 @@ func (self *ChainManager) Td() *big.Int {
return
self
.
td
return
self
.
td
}
}
func
(
self
*
ChainManager
)
LastBlockNumber
()
uint64
{
self
.
mu
.
RLock
()
defer
self
.
mu
.
RUnlock
()
return
self
.
lastBlockNumber
}
func
(
self
*
ChainManager
)
LastBlockHash
()
[]
byte
{
func
(
self
*
ChainManager
)
LastBlockHash
()
[]
byte
{
self
.
mu
.
RLock
()
self
.
mu
.
RLock
()
defer
self
.
mu
.
RUnlock
()
defer
self
.
mu
.
RUnlock
()
...
@@ -149,7 +141,6 @@ func (bc *ChainManager) setLastBlock() {
...
@@ -149,7 +141,6 @@ func (bc *ChainManager) setLastBlock() {
rlp
.
Decode
(
bytes
.
NewReader
(
data
),
&
block
)
rlp
.
Decode
(
bytes
.
NewReader
(
data
),
&
block
)
bc
.
currentBlock
=
&
block
bc
.
currentBlock
=
&
block
bc
.
lastBlockHash
=
block
.
Hash
()
bc
.
lastBlockHash
=
block
.
Hash
()
bc
.
lastBlockNumber
=
block
.
Header
()
.
Number
.
Uint64
()
// Set the last know difficulty (might be 0x0 as initial value, Genesis)
// Set the last know difficulty (might be 0x0 as initial value, Genesis)
bc
.
td
=
ethutil
.
BigD
(
bc
.
db
.
LastKnownTD
())
bc
.
td
=
ethutil
.
BigD
(
bc
.
db
.
LastKnownTD
())
...
@@ -157,7 +148,7 @@ func (bc *ChainManager) setLastBlock() {
...
@@ -157,7 +148,7 @@ func (bc *ChainManager) setLastBlock() {
bc
.
Reset
()
bc
.
Reset
()
}
}
chainlogger
.
Infof
(
"Last block (#%
d
) %x TD=%v
\n
"
,
bc
.
las
tBlockNumber
,
bc
.
currentBlock
.
Hash
(),
bc
.
td
)
chainlogger
.
Infof
(
"Last block (#%
v
) %x TD=%v
\n
"
,
bc
.
curren
tBlock
.
Number
()
,
bc
.
currentBlock
.
Hash
(),
bc
.
td
)
}
}
// Block creation & chain handling
// Block creation & chain handling
...
@@ -234,8 +225,6 @@ func (bc *ChainManager) insert(block *types.Block) {
...
@@ -234,8 +225,6 @@ func (bc *ChainManager) insert(block *types.Block) {
}
}
func
(
bc
*
ChainManager
)
write
(
block
*
types
.
Block
)
{
func
(
bc
*
ChainManager
)
write
(
block
*
types
.
Block
)
{
bc
.
writeBlockInfo
(
block
)
encodedBlock
:=
ethutil
.
Encode
(
block
.
RlpDataForStorage
())
encodedBlock
:=
ethutil
.
Encode
(
block
.
RlpDataForStorage
())
bc
.
db
.
Put
(
block
.
Hash
(),
encodedBlock
)
bc
.
db
.
Put
(
block
.
Hash
(),
encodedBlock
)
}
}
...
@@ -354,11 +343,6 @@ func (self *ChainManager) CalcTotalDiff(block *types.Block) (*big.Int, error) {
...
@@ -354,11 +343,6 @@ func (self *ChainManager) CalcTotalDiff(block *types.Block) (*big.Int, error) {
return
td
,
nil
return
td
,
nil
}
}
// Unexported method for writing extra non-essential block info to the db
func
(
bc
*
ChainManager
)
writeBlockInfo
(
block
*
types
.
Block
)
{
bc
.
lastBlockNumber
++
}
func
(
bc
*
ChainManager
)
Stop
()
{
func
(
bc
*
ChainManager
)
Stop
()
{
if
bc
.
CurrentBlock
!=
nil
{
if
bc
.
CurrentBlock
!=
nil
{
chainlogger
.
Infoln
(
"Stopped"
)
chainlogger
.
Infoln
(
"Stopped"
)
...
...
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