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
07fe00c4
Commit
07fe00c4
authored
May 21, 2014
by
obscuren
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changed numbers
parent
cbf221f6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
6 deletions
+6
-6
block_chain.go
ethchain/block_chain.go
+6
-6
No files found.
ethchain/block_chain.go
View file @
07fe00c4
...
...
@@ -190,8 +190,8 @@ func (bc *BlockChain) ResetTillBlockHash(hash []byte) error {
returnTo
=
bc
.
GetBlock
(
hash
)
bc
.
CurrentBlock
=
returnTo
bc
.
LastBlockHash
=
returnTo
.
Hash
()
info
:=
bc
.
BlockInfo
(
returnTo
)
bc
.
LastBlockNumber
=
info
.
Number
//
info := bc.BlockInfo(returnTo)
bc
.
LastBlockNumber
=
returnTo
.
Number
.
Uint64
()
}
// XXX Why are we resetting? This is the block chain, it has nothing to do with states
...
...
@@ -228,9 +228,9 @@ func (bc *BlockChain) GetChainFromHash(hash []byte, max uint64) []interface{} {
// Get the current hash to start with
currentHash
:=
bc
.
CurrentBlock
.
Hash
()
// Get the last number on the block chain
lastNumber
:=
bc
.
BlockInfo
(
bc
.
CurrentBlock
)
.
Number
lastNumber
:=
bc
.
CurrentBlock
.
Number
.
Uint64
()
// Get the parents number
parentNumber
:=
bc
.
BlockInfoByHash
(
hash
)
.
Number
parentNumber
:=
bc
.
GetBlock
(
hash
)
.
Number
.
Uint64
()
// Get the min amount. We might not have max amount of blocks
count
:=
uint64
(
math
.
Min
(
float64
(
lastNumber
-
parentNumber
),
float64
(
max
)))
startNumber
:=
parentNumber
+
count
...
...
@@ -291,10 +291,10 @@ func (bc *BlockChain) setLastBlock() {
data
,
_
:=
ethutil
.
Config
.
Db
.
Get
([]
byte
(
"LastBlock"
))
if
len
(
data
)
!=
0
{
block
:=
NewBlockFromBytes
(
data
)
info
:=
bc
.
BlockInfo
(
block
)
//
info := bc.BlockInfo(block)
bc
.
CurrentBlock
=
block
bc
.
LastBlockHash
=
block
.
Hash
()
bc
.
LastBlockNumber
=
info
.
Number
bc
.
LastBlockNumber
=
block
.
Number
.
Uint64
()
ethutil
.
Config
.
Log
.
Infof
(
"[CHAIN] Last known block height #%d
\n
"
,
bc
.
LastBlockNumber
)
}
else
{
...
...
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