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
119b7243
Commit
119b7243
authored
Mar 08, 2016
by
Péter Szilágyi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Godeps: pull in ethash future cache generator
parent
848e50d6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
9 deletions
+25
-9
Godeps.json
Godeps/Godeps.json
+2
-2
ethash.go
Godeps/_workspace/src/github.com/ethereum/ethash/ethash.go
+23
-7
No files found.
Godeps/Godeps.json
View file @
119b7243
...
...
@@ -20,8 +20,8 @@
},
{
"ImportPath"
:
"github.com/ethereum/ethash"
,
"Comment"
:
"v23.1-24
0-ga524c9f
"
,
"Rev"
:
"
a524c9f7d55cb8925567dc201b44ba555862056d
"
"Comment"
:
"v23.1-24
2-gbc9ba4d
"
,
"Rev"
:
"
bc9ba4d6a83a0fe308fefd8c6001b8ed1607137f
"
},
{
"ImportPath"
:
"github.com/fatih/color"
,
...
...
Godeps/_workspace/src/github.com/ethereum/ethash/ethash.go
View file @
119b7243
...
...
@@ -108,10 +108,13 @@ func freeCache(cache *cache) {
// Light implements the Verify half of the proof of work. It uses a few small
// in-memory caches to verify the nonces found by Full.
type
Light
struct
{
test
bool
// if set use a smaller cache size
mu
sync
.
Mutex
// protects the per-epoch map of DAGs
caches
map
[
uint64
]
*
cache
// currently cached verification DAGs
NumCaches
int
// Maximum number of DAGs to cache before eviction (only init, don't modify)
test
bool
// If set, use a smaller cache size
mu
sync
.
Mutex
// Protects the per-epoch map of verification caches
caches
map
[
uint64
]
*
cache
// Currently maintained verification caches
future
*
cache
// Pre-generated cache for the estimated future DAG
NumCaches
int
// Maximum number of caches to keep before eviction (only init, don't modify)
}
// Verify checks whether the block's nonce is valid.
...
...
@@ -192,12 +195,25 @@ func (l *Light) getCache(blockNum uint64) *cache {
evict
=
cache
}
}
glog
.
V
(
logger
.
Info
)
.
Infof
(
"Evicting DAG for epoch %d in favour of epoch %d"
,
evict
.
epoch
,
epoch
)
glog
.
V
(
logger
.
Debug
)
.
Infof
(
"Evicting DAG for epoch %d in favour of epoch %d"
,
evict
.
epoch
,
epoch
)
delete
(
l
.
caches
,
evict
.
epoch
)
}
// Create and return a new DAG for the epoch
c
=
&
cache
{
epoch
:
epoch
,
test
:
l
.
test
}
// If we have the new DAG pre-generated, use that, otherwise create a new one
if
l
.
future
!=
nil
&&
l
.
future
.
epoch
==
epoch
{
glog
.
V
(
logger
.
Debug
)
.
Infof
(
"Using pre-generated DAG for epoch %d"
,
epoch
)
c
,
l
.
future
=
l
.
future
,
nil
}
else
{
glog
.
V
(
logger
.
Debug
)
.
Infof
(
"No pre-generated DAG available, creating new for epoch %d"
,
epoch
)
c
=
&
cache
{
epoch
:
epoch
,
test
:
l
.
test
}
}
l
.
caches
[
epoch
]
=
c
// If we just used up the future cache, or need a refresh, regenerate
if
l
.
future
==
nil
||
l
.
future
.
epoch
<=
epoch
{
glog
.
V
(
logger
.
Debug
)
.
Infof
(
"Pre-generating DAG for epoch %d"
,
epoch
+
1
)
l
.
future
=
&
cache
{
epoch
:
epoch
+
1
,
test
:
l
.
test
}
go
l
.
future
.
generate
()
}
}
c
.
used
=
time
.
Now
()
l
.
mu
.
Unlock
()
...
...
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