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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
open
bor
Commits
c49aae98
Unverified
Commit
c49aae98
authored
4 years ago
by
Mr-Leshiy
Committed by
GitHub
4 years ago
Browse files
Options
Downloads
Patches
Plain Diff
consensus: refactor FinalizeAndAssemble to use Finalize (#21993)
parent
efe6dd29
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
consensus/clique/clique.go
+2
-3
2 additions, 3 deletions
consensus/clique/clique.go
consensus/ethash/consensus.go
+2
-3
2 additions, 3 deletions
consensus/ethash/consensus.go
with
4 additions
and
6 deletions
consensus/clique/clique.go
+
2
−
3
View file @
c49aae98
...
...
@@ -561,9 +561,8 @@ func (c *Clique) Finalize(chain consensus.ChainHeaderReader, header *types.Heade
// FinalizeAndAssemble implements consensus.Engine, ensuring no uncles are set,
// 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
)
{
// No block rewards in PoA, so the state remains as is and uncles are dropped
header
.
Root
=
state
.
IntermediateRoot
(
chain
.
Config
()
.
IsEIP158
(
header
.
Number
))
header
.
UncleHash
=
types
.
CalcUncleHash
(
nil
)
// Finalize block
c
.
Finalize
(
chain
,
header
,
state
,
txs
,
uncles
)
// Assemble and return the final block for sealing
return
types
.
NewBlock
(
header
,
txs
,
nil
,
receipts
,
new
(
trie
.
Trie
)),
nil
...
...
This diff is collapsed.
Click to expand it.
consensus/ethash/consensus.go
+
2
−
3
View file @
c49aae98
...
...
@@ -584,9 +584,8 @@ func (ethash *Ethash) Finalize(chain consensus.ChainHeaderReader, header *types.
// FinalizeAndAssemble implements consensus.Engine, accumulating the block and
// 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
)
{
// Accumulate any block and uncle rewards and commit the final state root
accumulateRewards
(
chain
.
Config
(),
state
,
header
,
uncles
)
header
.
Root
=
state
.
IntermediateRoot
(
chain
.
Config
()
.
IsEIP158
(
header
.
Number
))
// Finalize block
ethash
.
Finalize
(
chain
,
header
,
state
,
txs
,
uncles
)
// Header seems complete, assemble into a block and return
return
types
.
NewBlock
(
header
,
txs
,
uncles
,
receipts
,
new
(
trie
.
Trie
)),
nil
...
...
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