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
c49aae98
Unverified
Commit
c49aae98
authored
Dec 11, 2020
by
Mr-Leshiy
Committed by
GitHub
Dec 11, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
consensus: refactor FinalizeAndAssemble to use Finalize (#21993)
parent
efe6dd29
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
6 deletions
+4
-6
clique.go
consensus/clique/clique.go
+2
-3
consensus.go
consensus/ethash/consensus.go
+2
-3
No files found.
consensus/clique/clique.go
View file @
c49aae98
...
@@ -561,9 +561,8 @@ func (c *Clique) Finalize(chain consensus.ChainHeaderReader, header *types.Heade
...
@@ -561,9 +561,8 @@ func (c *Clique) Finalize(chain consensus.ChainHeaderReader, header *types.Heade
// FinalizeAndAssemble implements consensus.Engine, ensuring no uncles are set,
// FinalizeAndAssemble implements consensus.Engine, ensuring no uncles are set,
// nor block rewards given, and returns the final block.
// nor block rewards given, and returns the final block.
func
(
c
*
Clique
)
FinalizeAndAssemble
(
chain
consensus
.
ChainHeaderReader
,
header
*
types
.
Header
,
state
*
state
.
StateDB
,
txs
[]
*
types
.
Transaction
,
uncles
[]
*
types
.
Header
,
receipts
[]
*
types
.
Receipt
)
(
*
types
.
Block
,
error
)
{
func
(
c
*
Clique
)
FinalizeAndAssemble
(
chain
consensus
.
ChainHeaderReader
,
header
*
types
.
Header
,
state
*
state
.
StateDB
,
txs
[]
*
types
.
Transaction
,
uncles
[]
*
types
.
Header
,
receipts
[]
*
types
.
Receipt
)
(
*
types
.
Block
,
error
)
{
// No block rewards in PoA, so the state remains as is and uncles are dropped
// Finalize block
header
.
Root
=
state
.
IntermediateRoot
(
chain
.
Config
()
.
IsEIP158
(
header
.
Number
))
c
.
Finalize
(
chain
,
header
,
state
,
txs
,
uncles
)
header
.
UncleHash
=
types
.
CalcUncleHash
(
nil
)
// Assemble and return the final block for sealing
// Assemble and return the final block for sealing
return
types
.
NewBlock
(
header
,
txs
,
nil
,
receipts
,
new
(
trie
.
Trie
)),
nil
return
types
.
NewBlock
(
header
,
txs
,
nil
,
receipts
,
new
(
trie
.
Trie
)),
nil
...
...
consensus/ethash/consensus.go
View file @
c49aae98
...
@@ -584,9 +584,8 @@ func (ethash *Ethash) Finalize(chain consensus.ChainHeaderReader, header *types.
...
@@ -584,9 +584,8 @@ func (ethash *Ethash) Finalize(chain consensus.ChainHeaderReader, header *types.
// FinalizeAndAssemble implements consensus.Engine, accumulating the block and
// FinalizeAndAssemble implements consensus.Engine, accumulating the block and
// uncle rewards, setting the final state and assembling the block.
// uncle rewards, setting the final state and assembling the block.
func
(
ethash
*
Ethash
)
FinalizeAndAssemble
(
chain
consensus
.
ChainHeaderReader
,
header
*
types
.
Header
,
state
*
state
.
StateDB
,
txs
[]
*
types
.
Transaction
,
uncles
[]
*
types
.
Header
,
receipts
[]
*
types
.
Receipt
)
(
*
types
.
Block
,
error
)
{
func
(
ethash
*
Ethash
)
FinalizeAndAssemble
(
chain
consensus
.
ChainHeaderReader
,
header
*
types
.
Header
,
state
*
state
.
StateDB
,
txs
[]
*
types
.
Transaction
,
uncles
[]
*
types
.
Header
,
receipts
[]
*
types
.
Receipt
)
(
*
types
.
Block
,
error
)
{
// Accumulate any block and uncle rewards and commit the final state root
// Finalize block
accumulateRewards
(
chain
.
Config
(),
state
,
header
,
uncles
)
ethash
.
Finalize
(
chain
,
header
,
state
,
txs
,
uncles
)
header
.
Root
=
state
.
IntermediateRoot
(
chain
.
Config
()
.
IsEIP158
(
header
.
Number
))
// Header seems complete, assemble into a block and return
// Header seems complete, assemble into a block and return
return
types
.
NewBlock
(
header
,
txs
,
uncles
,
receipts
,
new
(
trie
.
Trie
)),
nil
return
types
.
NewBlock
(
header
,
txs
,
uncles
,
receipts
,
new
(
trie
.
Trie
)),
nil
...
...
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