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
0730acc5
Unverified
Commit
0730acc5
authored
Jul 28, 2021
by
@edgararout
Committed by
GitHub
Jul 28, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
consensus/ethash: less allocation during mining (#23199)
parent
2faf796d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
3 deletions
+4
-3
sealer.go
consensus/ethash/sealer.go
+4
-3
No files found.
consensus/ethash/sealer.go
View file @
0730acc5
...
...
@@ -140,8 +140,9 @@ func (ethash *Ethash) mine(block *types.Block, id int, seed uint64, abort chan s
)
// Start generating random nonces until we abort or find a good one
var
(
attempts
=
int64
(
0
)
nonce
=
seed
attempts
=
int64
(
0
)
nonce
=
seed
powBuffer
=
new
(
big
.
Int
)
)
logger
:=
ethash
.
config
.
Log
.
New
(
"miner"
,
id
)
logger
.
Trace
(
"Started ethash search for new nonces"
,
"seed"
,
seed
)
...
...
@@ -163,7 +164,7 @@ search:
}
// Compute the PoW value of this nonce
digest
,
result
:=
hashimotoFull
(
dataset
.
dataset
,
hash
,
nonce
)
if
new
(
big
.
Int
)
.
SetBytes
(
result
)
.
Cmp
(
target
)
<=
0
{
if
powBuffer
.
SetBytes
(
result
)
.
Cmp
(
target
)
<=
0
{
// Correct nonce found, create a new header with it
header
=
types
.
CopyHeader
(
header
)
header
.
Nonce
=
types
.
EncodeNonce
(
nonce
)
...
...
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