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
0ec171cc
Commit
0ec171cc
authored
Mar 24, 2015
by
obscuren
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Copy fix
parent
eab8f735
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
3 deletions
+10
-3
chain_manager.go
core/chain_manager.go
+1
-1
block.go
core/types/block.go
+9
-2
No files found.
core/chain_manager.go
View file @
0ec171cc
...
...
@@ -399,7 +399,7 @@ func (self *ChainManager) GetAncestors(block *types.Block, length int) (blocks [
func
(
bc
*
ChainManager
)
setTotalDifficulty
(
td
*
big
.
Int
)
{
bc
.
blockDb
.
Put
([]
byte
(
"LTD"
),
td
.
Bytes
())
bc
.
td
=
td
bc
.
td
.
Set
(
td
)
}
func
(
self
*
ChainManager
)
CalcTotalDiff
(
block
*
types
.
Block
)
(
*
big
.
Int
,
error
)
{
...
...
core/types/block.go
View file @
0ec171cc
...
...
@@ -131,9 +131,12 @@ func NewBlock(parentHash common.Hash, coinbase common.Address, root common.Hash,
Extra
:
extra
,
GasUsed
:
new
(
big
.
Int
),
GasLimit
:
new
(
big
.
Int
),
Number
:
new
(
big
.
Int
),
}
header
.
SetNonce
(
nonce
)
block
:=
&
Block
{
header
:
header
}
block
.
Td
=
new
(
big
.
Int
)
return
block
}
...
...
@@ -302,7 +305,7 @@ func (self *Block) ParentHash() common.Hash {
}
func
(
self
*
Block
)
Copy
()
*
Block
{
block
:=
NewBlock
(
self
.
ParentHash
(),
self
.
Coinbase
(),
self
.
Root
(),
self
.
Difficulty
(
),
self
.
Nonce
(),
self
.
header
.
Extra
)
block
:=
NewBlock
(
self
.
header
.
ParentHash
,
self
.
Coinbase
(),
self
.
Root
(),
new
(
big
.
Int
),
self
.
Nonce
(),
self
.
header
.
Extra
)
block
.
header
.
Bloom
=
self
.
header
.
Bloom
block
.
header
.
TxHash
=
self
.
header
.
TxHash
block
.
transactions
=
self
.
transactions
...
...
@@ -312,9 +315,13 @@ func (self *Block) Copy() *Block {
block
.
header
.
GasUsed
.
Set
(
self
.
header
.
GasUsed
)
block
.
header
.
ReceiptHash
=
self
.
header
.
ReceiptHash
block
.
header
.
Difficulty
.
Set
(
self
.
header
.
Difficulty
)
block
.
header
.
Number
=
self
.
header
.
Number
block
.
header
.
Number
.
Set
(
self
.
header
.
Number
)
block
.
header
.
Time
=
self
.
header
.
Time
block
.
header
.
MixDigest
=
self
.
header
.
MixDigest
if
self
.
Td
!=
nil
{
block
.
Td
.
Set
(
self
.
Td
)
}
return
block
}
...
...
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