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
b7d93500
Commit
b7d93500
authored
Mar 06, 2017
by
Péter Szilágyi
Committed by
Felix Lange
Mar 09, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
all: finish integrating Go ethash, delete C++ vendor
parent
df72e20c
Changes
20
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
230 additions
and
800 deletions
+230
-800
main.go
cmd/geth/main.go
+1
-1
misccmd.go
cmd/geth/misccmd.go
+2
-2
usage.go
cmd/geth/usage.go
+1
-1
flags.go
cmd/utils/flags.go
+8
-7
api.go
eth/api.go
+3
-22
backend.go
eth/backend.go
+3
-84
web3ext.go
internal/web3ext/web3ext.go
+2
-14
miner.go
miner/miner.go
+3
-1
geth.go
mobile/geth.go
+3
-0
ethash.go
pow/ethash.go
+204
-15
CMakeLists.txt
vendor/github.com/ethereum/ethash/CMakeLists.txt
+0
-14
MANIFEST.in
vendor/github.com/ethereum/ethash/MANIFEST.in
+0
-17
Makefile
vendor/github.com/ethereum/ethash/Makefile
+0
-6
README.md
vendor/github.com/ethereum/ethash/README.md
+0
-22
Vagrantfile
vendor/github.com/ethereum/ethash/Vagrantfile
+0
-7
appveyor.yml
vendor/github.com/ethereum/ethash/appveyor.yml
+0
-43
ethash.go
vendor/github.com/ethereum/ethash/ethash.go
+0
-440
ethashc.go
vendor/github.com/ethereum/ethash/ethashc.go
+0
-51
setup.py
vendor/github.com/ethereum/ethash/setup.py
+0
-47
vendor.json
vendor/vendor.json
+0
-6
No files found.
cmd/geth/main.go
View file @
b7d93500
...
@@ -95,6 +95,7 @@ func init() {
...
@@ -95,6 +95,7 @@ func init() {
utils
.
EthashCachesInMemoryFlag
,
utils
.
EthashCachesInMemoryFlag
,
utils
.
EthashCachesOnDiskFlag
,
utils
.
EthashCachesOnDiskFlag
,
utils
.
EthashDatasetDirFlag
,
utils
.
EthashDatasetDirFlag
,
utils
.
EthashDatasetsInMemoryFlag
,
utils
.
EthashDatasetsOnDiskFlag
,
utils
.
EthashDatasetsOnDiskFlag
,
utils
.
FastSyncFlag
,
utils
.
FastSyncFlag
,
utils
.
LightModeFlag
,
utils
.
LightModeFlag
,
...
@@ -111,7 +112,6 @@ func init() {
...
@@ -111,7 +112,6 @@ func init() {
utils
.
GasPriceFlag
,
utils
.
GasPriceFlag
,
utils
.
MinerThreadsFlag
,
utils
.
MinerThreadsFlag
,
utils
.
MiningEnabledFlag
,
utils
.
MiningEnabledFlag
,
utils
.
AutoDAGFlag
,
utils
.
TargetGasLimitFlag
,
utils
.
TargetGasLimitFlag
,
utils
.
NATFlag
,
utils
.
NATFlag
,
utils
.
NoDiscoverFlag
,
utils
.
NoDiscoverFlag
,
...
...
cmd/geth/misccmd.go
View file @
b7d93500
...
@@ -25,10 +25,10 @@ import (
...
@@ -25,10 +25,10 @@ import (
"strconv"
"strconv"
"strings"
"strings"
"github.com/ethereum/ethash"
"github.com/ethereum/go-ethereum/cmd/utils"
"github.com/ethereum/go-ethereum/cmd/utils"
"github.com/ethereum/go-ethereum/eth"
"github.com/ethereum/go-ethereum/eth"
"github.com/ethereum/go-ethereum/params"
"github.com/ethereum/go-ethereum/params"
"github.com/ethereum/go-ethereum/pow"
"gopkg.in/urfave/cli.v1"
"gopkg.in/urfave/cli.v1"
)
)
...
@@ -87,7 +87,7 @@ func makedag(ctx *cli.Context) error {
...
@@ -87,7 +87,7 @@ func makedag(ctx *cli.Context) error {
utils
.
Fatalf
(
"Can't find dir"
)
utils
.
Fatalf
(
"Can't find dir"
)
}
}
fmt
.
Println
(
"making DAG, this could take awhile..."
)
fmt
.
Println
(
"making DAG, this could take awhile..."
)
ethash
.
MakeDAG
(
blockNum
,
dir
)
pow
.
MakeDataset
(
blockNum
,
dir
)
}
}
default
:
default
:
wrongArgs
()
wrongArgs
()
...
...
cmd/geth/usage.go
View file @
b7d93500
...
@@ -84,6 +84,7 @@ var AppHelpFlagGroups = []flagGroup{
...
@@ -84,6 +84,7 @@ var AppHelpFlagGroups = []flagGroup{
utils
.
EthashCachesInMemoryFlag
,
utils
.
EthashCachesInMemoryFlag
,
utils
.
EthashCachesOnDiskFlag
,
utils
.
EthashCachesOnDiskFlag
,
utils
.
EthashDatasetDirFlag
,
utils
.
EthashDatasetDirFlag
,
utils
.
EthashDatasetsInMemoryFlag
,
utils
.
EthashDatasetsOnDiskFlag
,
utils
.
EthashDatasetsOnDiskFlag
,
},
},
},
},
...
@@ -141,7 +142,6 @@ var AppHelpFlagGroups = []flagGroup{
...
@@ -141,7 +142,6 @@ var AppHelpFlagGroups = []flagGroup{
Flags
:
[]
cli
.
Flag
{
Flags
:
[]
cli
.
Flag
{
utils
.
MiningEnabledFlag
,
utils
.
MiningEnabledFlag
,
utils
.
MinerThreadsFlag
,
utils
.
MinerThreadsFlag
,
utils
.
AutoDAGFlag
,
utils
.
EtherbaseFlag
,
utils
.
EtherbaseFlag
,
utils
.
TargetGasLimitFlag
,
utils
.
TargetGasLimitFlag
,
utils
.
GasPriceFlag
,
utils
.
GasPriceFlag
,
...
...
cmd/utils/flags.go
View file @
b7d93500
...
@@ -132,9 +132,14 @@ var (
...
@@ -132,9 +132,14 @@ var (
Name
:
"ethash.dagdir"
,
Name
:
"ethash.dagdir"
,
Usage
:
"Directory to store the ethash mining DAGs (default = inside home folder)"
,
Usage
:
"Directory to store the ethash mining DAGs (default = inside home folder)"
,
}
}
EthashDatasetsInMemoryFlag
=
cli
.
IntFlag
{
Name
:
"ethash.dagsinmem"
,
Usage
:
"Number of recent ethash mining DAGs to keep in memory (1+GB each)"
,
Value
:
1
,
}
EthashDatasetsOnDiskFlag
=
cli
.
IntFlag
{
EthashDatasetsOnDiskFlag
=
cli
.
IntFlag
{
Name
:
"ethash.dagsondisk"
,
Name
:
"ethash.dagsondisk"
,
Usage
:
"Number of ethash mining DAGs to keep on disk (1+GB each)"
,
Usage
:
"Number of
recent
ethash mining DAGs to keep on disk (1+GB each)"
,
Value
:
2
,
Value
:
2
,
}
}
NetworkIdFlag
=
cli
.
IntFlag
{
NetworkIdFlag
=
cli
.
IntFlag
{
...
@@ -207,10 +212,6 @@ var (
...
@@ -207,10 +212,6 @@ var (
Usage
:
"Target gas limit sets the artificial target gas floor for the blocks to mine"
,
Usage
:
"Target gas limit sets the artificial target gas floor for the blocks to mine"
,
Value
:
params
.
GenesisGasLimit
.
Uint64
(),
Value
:
params
.
GenesisGasLimit
.
Uint64
(),
}
}
AutoDAGFlag
=
cli
.
BoolFlag
{
Name
:
"autodag"
,
Usage
:
"Enable automatic DAG pregeneration"
,
}
EtherbaseFlag
=
cli
.
StringFlag
{
EtherbaseFlag
=
cli
.
StringFlag
{
Name
:
"etherbase"
,
Name
:
"etherbase"
,
Usage
:
"Public address for block mining rewards (default = first account created)"
,
Usage
:
"Public address for block mining rewards (default = first account created)"
,
...
@@ -809,8 +810,8 @@ func RegisterEthService(ctx *cli.Context, stack *node.Node, extra []byte) {
...
@@ -809,8 +810,8 @@ func RegisterEthService(ctx *cli.Context, stack *node.Node, extra []byte) {
EthashCachesInMem
:
ctx
.
GlobalInt
(
EthashCachesInMemoryFlag
.
Name
),
EthashCachesInMem
:
ctx
.
GlobalInt
(
EthashCachesInMemoryFlag
.
Name
),
EthashCachesOnDisk
:
ctx
.
GlobalInt
(
EthashCachesOnDiskFlag
.
Name
),
EthashCachesOnDisk
:
ctx
.
GlobalInt
(
EthashCachesOnDiskFlag
.
Name
),
EthashDatasetDir
:
MakeEthashDatasetDir
(
ctx
),
EthashDatasetDir
:
MakeEthashDatasetDir
(
ctx
),
EthashDatasetsInMem
:
ctx
.
GlobalInt
(
EthashDatasetsInMemoryFlag
.
Name
),
EthashDatasetsOnDisk
:
ctx
.
GlobalInt
(
EthashDatasetsOnDiskFlag
.
Name
),
EthashDatasetsOnDisk
:
ctx
.
GlobalInt
(
EthashDatasetsOnDiskFlag
.
Name
),
AutoDAG
:
ctx
.
GlobalBool
(
AutoDAGFlag
.
Name
)
||
ctx
.
GlobalBool
(
MiningEnabledFlag
.
Name
),
EnablePreimageRecording
:
ctx
.
GlobalBool
(
VMEnableDebugFlag
.
Name
),
EnablePreimageRecording
:
ctx
.
GlobalBool
(
VMEnableDebugFlag
.
Name
),
}
}
...
@@ -982,7 +983,7 @@ func MakeChain(ctx *cli.Context, stack *node.Node) (chain *core.BlockChain, chai
...
@@ -982,7 +983,7 @@ func MakeChain(ctx *cli.Context, stack *node.Node) (chain *core.BlockChain, chai
seal
:=
pow
.
PoW
(
pow
.
FakePow
{})
seal
:=
pow
.
PoW
(
pow
.
FakePow
{})
if
!
ctx
.
GlobalBool
(
FakePoWFlag
.
Name
)
{
if
!
ctx
.
GlobalBool
(
FakePoWFlag
.
Name
)
{
seal
=
pow
.
NewFullEthash
(
""
,
1
,
0
,
""
,
0
)
seal
=
pow
.
NewFullEthash
(
""
,
1
,
0
,
""
,
1
,
0
)
}
}
chain
,
err
=
core
.
NewBlockChain
(
chainDb
,
chainConfig
,
seal
,
new
(
event
.
TypeMux
),
vm
.
Config
{
EnablePreimageRecording
:
ctx
.
GlobalBool
(
VMEnableDebugFlag
.
Name
)})
chain
,
err
=
core
.
NewBlockChain
(
chainDb
,
chainConfig
,
seal
,
new
(
event
.
TypeMux
),
vm
.
Config
{
EnablePreimageRecording
:
ctx
.
GlobalBool
(
VMEnableDebugFlag
.
Name
)})
if
err
!=
nil
{
if
err
!=
nil
{
...
...
eth/api.go
View file @
b7d93500
...
@@ -29,7 +29,6 @@ import (
...
@@ -29,7 +29,6 @@ import (
"strings"
"strings"
"time"
"time"
"github.com/ethereum/ethash"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core"
...
@@ -40,7 +39,6 @@ import (
...
@@ -40,7 +39,6 @@ import (
"github.com/ethereum/go-ethereum/miner"
"github.com/ethereum/go-ethereum/miner"
"github.com/ethereum/go-ethereum/params"
"github.com/ethereum/go-ethereum/params"
"github.com/ethereum/go-ethereum/rlp"
"github.com/ethereum/go-ethereum/rlp"
"github.com/ethereum/go-ethereum/rpc"
"golang.org/x/net/context"
"golang.org/x/net/context"
)
)
...
@@ -137,7 +135,6 @@ func NewPrivateMinerAPI(e *Ethereum) *PrivateMinerAPI {
...
@@ -137,7 +135,6 @@ func NewPrivateMinerAPI(e *Ethereum) *PrivateMinerAPI {
// Start the miner with the given number of threads. If threads is nil the number of
// Start the miner with the given number of threads. If threads is nil the number of
// workers started is equal to the number of logical CPU's that are usable by this process.
// workers started is equal to the number of logical CPU's that are usable by this process.
func
(
s
*
PrivateMinerAPI
)
Start
(
threads
*
int
)
(
bool
,
error
)
{
func
(
s
*
PrivateMinerAPI
)
Start
(
threads
*
int
)
(
bool
,
error
)
{
s
.
e
.
StartAutoDAG
()
var
err
error
var
err
error
if
threads
==
nil
{
if
threads
==
nil
{
err
=
s
.
e
.
StartMining
(
runtime
.
NumCPU
())
err
=
s
.
e
.
StartMining
(
runtime
.
NumCPU
())
...
@@ -173,25 +170,9 @@ func (s *PrivateMinerAPI) SetEtherbase(etherbase common.Address) bool {
...
@@ -173,25 +170,9 @@ func (s *PrivateMinerAPI) SetEtherbase(etherbase common.Address) bool {
return
true
return
true
}
}
// StartAutoDAG starts auto DAG generation. This will prevent the DAG generating on epoch change
// GetHashrate returns the current hashrate of the miner.
// which will cause the node to stop mining during the generation process.
func
(
s
*
PrivateMinerAPI
)
GetHashrate
()
uint64
{
func
(
s
*
PrivateMinerAPI
)
StartAutoDAG
()
bool
{
return
uint64
(
s
.
e
.
miner
.
HashRate
())
s
.
e
.
StartAutoDAG
()
return
true
}
// StopAutoDAG stops auto DAG generation
func
(
s
*
PrivateMinerAPI
)
StopAutoDAG
()
bool
{
s
.
e
.
StopAutoDAG
()
return
true
}
// MakeDAG creates the new DAG for the given block number
func
(
s
*
PrivateMinerAPI
)
MakeDAG
(
blockNr
rpc
.
BlockNumber
)
(
bool
,
error
)
{
if
err
:=
ethash
.
MakeDAG
(
uint64
(
blockNr
.
Int64
()),
""
);
err
!=
nil
{
return
false
,
err
}
return
true
,
nil
}
}
// PrivateAdminAPI is the collection of Etheruem full node-related APIs
// PrivateAdminAPI is the collection of Etheruem full node-related APIs
...
...
eth/backend.go
View file @
b7d93500
...
@@ -21,14 +21,11 @@ import (
...
@@ -21,14 +21,11 @@ import (
"errors"
"errors"
"fmt"
"fmt"
"math/big"
"math/big"
"os"
"path/filepath"
"regexp"
"regexp"
"strings"
"strings"
"sync"
"sync"
"time"
"time"
"github.com/ethereum/ethash"
"github.com/ethereum/go-ethereum/accounts"
"github.com/ethereum/go-ethereum/accounts"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core"
...
@@ -78,7 +75,6 @@ type Config struct {
...
@@ -78,7 +75,6 @@ type Config struct {
DatabaseHandles
int
DatabaseHandles
int
DocRoot
string
DocRoot
string
AutoDAG
bool
PowFake
bool
PowFake
bool
PowTest
bool
PowTest
bool
PowShared
bool
PowShared
bool
...
@@ -88,6 +84,7 @@ type Config struct {
...
@@ -88,6 +84,7 @@ type Config struct {
EthashCachesInMem
int
EthashCachesInMem
int
EthashCachesOnDisk
int
EthashCachesOnDisk
int
EthashDatasetDir
string
EthashDatasetDir
string
EthashDatasetsInMem
int
EthashDatasetsOnDisk
int
EthashDatasetsOnDisk
int
Etherbase
common
.
Address
Etherbase
common
.
Address
...
@@ -138,8 +135,6 @@ type Ethereum struct {
...
@@ -138,8 +135,6 @@ type Ethereum struct {
miner
*
miner
.
Miner
miner
*
miner
.
Miner
Mining
bool
Mining
bool
MinerThreads
int
MinerThreads
int
AutoDAG
bool
autodagquit
chan
bool
etherbase
common
.
Address
etherbase
common
.
Address
solcPath
string
solcPath
string
...
@@ -173,7 +168,6 @@ func New(ctx *node.ServiceContext, config *Config) (*Ethereum, error) {
...
@@ -173,7 +168,6 @@ func New(ctx *node.ServiceContext, config *Config) (*Ethereum, error) {
netVersionId
:
config
.
NetworkId
,
netVersionId
:
config
.
NetworkId
,
etherbase
:
config
.
Etherbase
,
etherbase
:
config
.
Etherbase
,
MinerThreads
:
config
.
MinerThreads
,
MinerThreads
:
config
.
MinerThreads
,
AutoDAG
:
config
.
AutoDAG
,
solcPath
:
config
.
SolcPath
,
solcPath
:
config
.
SolcPath
,
}
}
...
@@ -298,7 +292,7 @@ func CreatePoW(ctx *node.ServiceContext, config *Config) pow.PoW {
...
@@ -298,7 +292,7 @@ func CreatePoW(ctx *node.ServiceContext, config *Config) pow.PoW {
return
pow
.
NewSharedEthash
()
return
pow
.
NewSharedEthash
()
default
:
default
:
return
pow
.
NewFullEthash
(
ctx
.
ResolvePath
(
config
.
EthashCacheDir
),
config
.
EthashCachesInMem
,
config
.
EthashCachesOnDisk
,
return
pow
.
NewFullEthash
(
ctx
.
ResolvePath
(
config
.
EthashCacheDir
),
config
.
EthashCachesInMem
,
config
.
EthashCachesOnDisk
,
config
.
EthashDatasetDir
,
config
.
EthashDatasetsOnDisk
)
config
.
EthashDatasetDir
,
config
.
EthashDatasets
InMem
,
config
.
EthashDatasets
OnDisk
)
}
}
}
}
...
@@ -414,9 +408,7 @@ func (s *Ethereum) Protocols() []p2p.Protocol {
...
@@ -414,9 +408,7 @@ func (s *Ethereum) Protocols() []p2p.Protocol {
// Ethereum protocol implementation.
// Ethereum protocol implementation.
func
(
s
*
Ethereum
)
Start
(
srvr
*
p2p
.
Server
)
error
{
func
(
s
*
Ethereum
)
Start
(
srvr
*
p2p
.
Server
)
error
{
s
.
netRPCService
=
ethapi
.
NewPublicNetAPI
(
srvr
,
s
.
NetVersion
())
s
.
netRPCService
=
ethapi
.
NewPublicNetAPI
(
srvr
,
s
.
NetVersion
())
if
s
.
AutoDAG
{
s
.
StartAutoDAG
()
}
s
.
protocolManager
.
Start
()
s
.
protocolManager
.
Start
()
if
s
.
lesServer
!=
nil
{
if
s
.
lesServer
!=
nil
{
s
.
lesServer
.
Start
(
srvr
)
s
.
lesServer
.
Start
(
srvr
)
...
@@ -439,8 +431,6 @@ func (s *Ethereum) Stop() error {
...
@@ -439,8 +431,6 @@ func (s *Ethereum) Stop() error {
s
.
miner
.
Stop
()
s
.
miner
.
Stop
()
s
.
eventMux
.
Stop
()
s
.
eventMux
.
Stop
()
s
.
StopAutoDAG
()
s
.
chainDb
.
Close
()
s
.
chainDb
.
Close
()
close
(
s
.
shutdownChan
)
close
(
s
.
shutdownChan
)
...
@@ -451,74 +441,3 @@ func (s *Ethereum) Stop() error {
...
@@ -451,74 +441,3 @@ func (s *Ethereum) Stop() error {
func
(
s
*
Ethereum
)
WaitForShutdown
()
{
func
(
s
*
Ethereum
)
WaitForShutdown
()
{
<-
s
.
shutdownChan
<-
s
.
shutdownChan
}
}
// StartAutoDAG() spawns a go routine that checks the DAG every autoDAGcheckInterval
// by default that is 10 times per epoch
// in epoch n, if we past autoDAGepochHeight within-epoch blocks,
// it calls ethash.MakeDAG to pregenerate the DAG for the next epoch n+1
// if it does not exist yet as well as remove the DAG for epoch n-1
// the loop quits if autodagquit channel is closed, it can safely restart and
// stop any number of times.
// For any more sophisticated pattern of DAG generation, use CLI subcommand
// makedag
func
(
self
*
Ethereum
)
StartAutoDAG
()
{
if
self
.
autodagquit
!=
nil
{
return
// already started
}
go
func
()
{
log
.
Info
(
"Pre-generation of ethash DAG on"
,
"dir"
,
ethash
.
DefaultDir
)
var
nextEpoch
uint64
timer
:=
time
.
After
(
0
)
self
.
autodagquit
=
make
(
chan
bool
)
for
{
select
{
case
<-
timer
:
log
.
Info
(
"Checking DAG availability"
,
"dir"
,
ethash
.
DefaultDir
)
currentBlock
:=
self
.
BlockChain
()
.
CurrentBlock
()
.
NumberU64
()
thisEpoch
:=
currentBlock
/
epochLength
if
nextEpoch
<=
thisEpoch
{
if
currentBlock
%
epochLength
>
autoDAGepochHeight
{
if
thisEpoch
>
0
{
previousDag
,
previousDagFull
:=
dagFiles
(
thisEpoch
-
1
)
os
.
Remove
(
filepath
.
Join
(
ethash
.
DefaultDir
,
previousDag
))
os
.
Remove
(
filepath
.
Join
(
ethash
.
DefaultDir
,
previousDagFull
))
log
.
Info
(
"Removed previous DAG"
,
"epoch"
,
thisEpoch
-
1
,
"dag"
,
previousDag
)
}
nextEpoch
=
thisEpoch
+
1
dag
,
_
:=
dagFiles
(
nextEpoch
)
if
_
,
err
:=
os
.
Stat
(
dag
);
os
.
IsNotExist
(
err
)
{
log
.
Info
(
"Pre-generating next DAG"
,
"epoch"
,
nextEpoch
,
"dag"
,
dag
)
err
:=
ethash
.
MakeDAG
(
nextEpoch
*
epochLength
,
""
)
// "" -> ethash.DefaultDir
if
err
!=
nil
{
log
.
Error
(
"Error generating DAG"
,
"epoch"
,
nextEpoch
,
"dag"
,
dag
,
"err"
,
err
)
return
}
}
else
{
log
.
Warn
(
"DAG already exists"
,
"epoch"
,
nextEpoch
,
"dag"
,
dag
)
}
}
}
timer
=
time
.
After
(
autoDAGcheckInterval
)
case
<-
self
.
autodagquit
:
return
}
}
}()
}
// stopAutoDAG stops automatic DAG pregeneration by quitting the loop
func
(
self
*
Ethereum
)
StopAutoDAG
()
{
if
self
.
autodagquit
!=
nil
{
close
(
self
.
autodagquit
)
self
.
autodagquit
=
nil
}
log
.
Info
(
"Pre-generation of ethash DAG off"
,
"dir"
,
ethash
.
DefaultDir
)
}
// dagFiles(epoch) returns the two alternative DAG filenames (not a path)
// 1) <revision>-<hex(seedhash[8])> 2) full-R<revision>-<hex(seedhash[8])>
func
dagFiles
(
epoch
uint64
)
(
string
,
string
)
{
seedHash
,
_
:=
ethash
.
GetSeedHash
(
epoch
*
epochLength
)
dag
:=
fmt
.
Sprintf
(
"full-R%d-%x"
,
ethashRevision
,
seedHash
[
:
8
])
return
dag
,
"full-R"
+
dag
}
internal/web3ext/web3ext.go
View file @
b7d93500
...
@@ -399,20 +399,8 @@ web3._extend({
...
@@ -399,20 +399,8 @@ web3._extend({
inputFormatter: [web3._extend.utils.fromDecimal]
inputFormatter: [web3._extend.utils.fromDecimal]
}),
}),
new web3._extend.Method({
new web3._extend.Method({
name: 'startAutoDAG',
name: 'getHashrate',
call: 'miner_startAutoDAG',
call: 'miner_getHashrate'
params: 0
}),
new web3._extend.Method({
name: 'stopAutoDAG',
call: 'miner_stopAutoDAG',
params: 0
}),
new web3._extend.Method({
name: 'makeDAG',
call: 'miner_makeDAG',
params: 1,
inputFormatter: [web3._extend.formatters.inputDefaultBlockNumberFormatter]
})
})
],
],
properties: []
properties: []
...
...
miner/miner.go
View file @
b7d93500
...
@@ -164,7 +164,9 @@ func (self *Miner) HashRate() (tot int64) {
...
@@ -164,7 +164,9 @@ func (self *Miner) HashRate() (tot int64) {
// aspects of the worker/locking up agents so we can get an accurate
// aspects of the worker/locking up agents so we can get an accurate
// hashrate?
// hashrate?
for
agent
:=
range
self
.
worker
.
agents
{
for
agent
:=
range
self
.
worker
.
agents
{
tot
+=
agent
.
GetHashRate
()
if
_
,
ok
:=
agent
.
(
*
CpuAgent
);
!
ok
{
tot
+=
agent
.
GetHashRate
()
}
}
}
return
return
}
}
...
...
mobile/geth.go
View file @
b7d93500
...
@@ -151,6 +151,9 @@ func NewNode(datadir string, config *NodeConfig) (stack *Node, _ error) {
...
@@ -151,6 +151,9 @@ func NewNode(datadir string, config *NodeConfig) (stack *Node, _ error) {
GpobaseStepDown
:
10
,
GpobaseStepDown
:
10
,
GpobaseStepUp
:
100
,
GpobaseStepUp
:
100
,
GpobaseCorrectionFactor
:
110
,
GpobaseCorrectionFactor
:
110
,
EthashCacheDir
:
"ethash"
,
EthashCachesInMem
:
2
,
EthashCachesOnDisk
:
3
,
}
}
if
err
:=
rawStack
.
Register
(
func
(
ctx
*
node
.
ServiceContext
)
(
node
.
Service
,
error
)
{
if
err
:=
rawStack
.
Register
(
func
(
ctx
*
node
.
ServiceContext
)
(
node
.
Service
,
error
)
{
return
les
.
New
(
ctx
,
ethConf
)
return
les
.
New
(
ctx
,
ethConf
)
...
...
pow/ethash.go
View file @
b7d93500
This diff is collapsed.
Click to expand it.
vendor/github.com/ethereum/ethash/CMakeLists.txt
deleted
100644 → 0
View file @
df72e20c
cmake_minimum_required
(
VERSION 2.8.7
)
project
(
ethash
)
set
(
CMAKE_MODULE_PATH
${
CMAKE_MODULE_PATH
}
"
${
CMAKE_SOURCE_DIR
}
/cmake/modules/"
)
set
(
ETHHASH_LIBS ethash
)
if
(
WIN32 AND WANT_CRYPTOPP
)
add_subdirectory
(
cryptopp
)
endif
()
add_subdirectory
(
src/libethash
)
add_subdirectory
(
src/benchmark EXCLUDE_FROM_ALL
)
add_subdirectory
(
test/c
)
vendor/github.com/ethereum/ethash/MANIFEST.in
deleted
100644 → 0
View file @
df72e20c
include setup.py
# C sources
include src/libethash/internal.c
include src/libethash/sha3.c
include src/libethash/util.c
include src/python/core.c
# Headers
include src/libethash/compiler.h
include src/libethash/data_sizes.h
include src/libethash/endian.h
include src/libethash/ethash.h
include src/libethash/fnv.h
include src/libethash/internal.h
include src/libethash/sha3.h
include src/libethash/util.h
vendor/github.com/ethereum/ethash/Makefile
deleted
100644 → 0
View file @
df72e20c
.PHONY
:
clean test
test
:
./test/test.sh
clean
:
rm
-rf
*
.so pyethash.egg-info/ build/
test
/python/python-virtual-env/
test
/c/build/ pyethash.so
test
/python/
*
.pyc dist/ MANIFEST
vendor/github.com/ethereum/ethash/README.md
deleted
100644 → 0
View file @
df72e20c
[

](https://travis-ci.org/ethereum/ethash)
[

](https://ci.appveyor.com/project/debris/ethash-nr37r/branch/master)
# Ethash
For details on this project, please see the Ethereum wiki:
https://github.com/ethereum/wiki/wiki/Ethash
### Coding Style for C++ code:
Follow the same exact style as in
[
cpp-ethereum
](
https://github.com/ethereum/cpp-ethereum/blob/develop/CodingStandards.txt
)
### Coding Style for C code:
The main thing above all is code consistency.
-
Tabs for indentation. A tab is 4 spaces
-
Try to stick to the
[
K&R
](
http://en.wikipedia.org/wiki/Indent_style#K.26R_style
)
,
especially for the C code.
-
Keep the line lengths reasonable. No hard limit on 80 characters but don't go further
than 110. Some people work with multiple buffers next to each other.
Make them like you :)
vendor/github.com/ethereum/ethash/Vagrantfile
deleted
100644 → 0
View file @
df72e20c
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant
.
configure
(
2
)
do
|
config
|
config
.
vm
.
box
=
"Ubuntu 12.04"
config
.
vm
.
box_url
=
"https://cloud-images.ubuntu.com/vagrant/precise/current/precise-server-cloudimg-amd64-vagrant-disk1.box"
end
vendor/github.com/ethereum/ethash/appveyor.yml
deleted
100644 → 0
View file @
df72e20c
version
:
1.0.0.{build}
environment
:
BOOST_ROOT
:
"
c:/projects/ethash/deps/boost"
branches
:
only
:
-
master
-
develop
os
:
Windows Server 2012 R2
clone_folder
:
c:\projects\ethash
#platform: Any CPU
#configuration: Debug
install
:
# by default, all script lines are interpreted as batch
# scripts to run before build
before_build
:
-
echo "Downloading boost..."
-
mkdir c:\projects\ethash\deps
-
cd c:\projects\ethash\deps
-
curl -O https://build.ethdev.com/builds/windows-precompiled/boost.tar.gz
-
echo "Unzipping boost..."
-
7z x boost.tar.gz > nul
-
7z x boost.tar > nul
-
ls
-
echo "Running cmake..."
-
cd c:\projects\ethash
-
cmake .
build
:
project
:
ALL_BUILD.vcxproj
# path to Visual Studio solution or project
after_build
:
-
echo "Running tests..."
-
cd c:\projects\ethash\test\c\Debug
-
Test.exe
-
echo "Finished!"
vendor/github.com/ethereum/ethash/ethash.go
deleted
100644 → 0
View file @
df72e20c
This diff is collapsed.
Click to expand it.
vendor/github.com/ethereum/ethash/ethashc.go
deleted
100644 → 0
View file @
df72e20c
// Copyright 2015 The go-ethereum Authors
// This file is part of the go-ethereum library.
//
// The go-ethereum library is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// The go-ethereum library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
package
ethash
/*
-mno-stack-arg-probe disables stack probing which avoids the function
__chkstk_ms being linked. this avoids a clash of this symbol as we also
separately link the secp256k1 lib which ends up defining this symbol
1. https://gcc.gnu.org/onlinedocs/gccint/Stack-Checking.html
2. https://groups.google.com/forum/#!msg/golang-dev/v1bziURSQ4k/88fXuJ24e-gJ
3. https://groups.google.com/forum/#!topic/golang-nuts/VNP6Mwz_B6o
*/
/*
#cgo CFLAGS: -std=gnu99 -Wall
#cgo windows CFLAGS: -mno-stack-arg-probe
#cgo LDFLAGS: -lm
#include "src/libethash/internal.c"
#include "src/libethash/sha3.c"
#include "src/libethash/io.c"
#ifdef _WIN32
# include "src/libethash/io_win32.c"
# include "src/libethash/mmap_win32.c"
#else
# include "src/libethash/io_posix.c"
#endif
// 'gateway function' for calling back into go.
extern int ethashGoCallback(unsigned);
int ethashGoCallback_cgo(unsigned percent) { return ethashGoCallback(percent); }
*/
import
"C"
vendor/github.com/ethereum/ethash/setup.py
deleted
100755 → 0
View file @
df72e20c
#!/usr/bin/env python
import
os
from
distutils.core
import
setup
,
Extension
sources
=
[
'src/python/core.c'
,
'src/libethash/io.c'
,
'src/libethash/internal.c'
,
'src/libethash/sha3.c'
]
if
os
.
name
==
'nt'
:
sources
+=
[
'src/libethash/util_win32.c'
,
'src/libethash/io_win32.c'
,
'src/libethash/mmap_win32.c'
,
]
else
:
sources
+=
[
'src/libethash/io_posix.c'
]
depends
=
[
'src/libethash/ethash.h'
,
'src/libethash/compiler.h'
,
'src/libethash/data_sizes.h'
,
'src/libethash/endian.h'
,
'src/libethash/ethash.h'
,
'src/libethash/io.h'
,
'src/libethash/fnv.h'
,
'src/libethash/internal.h'
,
'src/libethash/sha3.h'
,
'src/libethash/util.h'
,
]
pyethash
=
Extension
(
'pyethash'
,
sources
=
sources
,
depends
=
depends
,
extra_compile_args
=
[
"-Isrc/"
,
"-std=gnu99"
,
"-Wall"
])
setup
(
name
=
'pyethash'
,
author
=
"Matthew Wampler-Doty"
,
author_email
=
"matthew.wampler.doty@gmail.com"
,
license
=
'GPL'
,
version
=
'0.1.23'
,
url
=
'https://github.com/ethereum/ethash'
,
download_url
=
'https://github.com/ethereum/ethash/tarball/v23'
,
description
=
(
'Python wrappers for ethash, the ethereum proof of work'
'hashing function'
),
ext_modules
=
[
pyethash
],
)
vendor/vendor.json
View file @
b7d93500
...
@@ -34,12 +34,6 @@
...
@@ -34,12 +34,6 @@
"revision"
:
"346938d642f2ec3594ed81d874461961cd0faa76"
,
"revision"
:
"346938d642f2ec3594ed81d874461961cd0faa76"
,
"revisionTime"
:
"2016-10-29T20:57:26Z"
"revisionTime"
:
"2016-10-29T20:57:26Z"
},
},
{
"checksumSHA1"
:
"HdOu+ISNyVWMyBao7vDI21uZH6U="
,
"path"
:
"github.com/ethereum/ethash"
,
"revision"
:
"214d4c008e101d4f7b18318389fb8c2e00323f24"
,
"revisionTime"
:
"2016-10-25T09:19:48Z"
},
{
{
"checksumSHA1"
:
"7oFpbmDfGobwKsFLIf6wMUvVoKw="
,
"checksumSHA1"
:
"7oFpbmDfGobwKsFLIf6wMUvVoKw="
,
"path"
:
"github.com/fatih/color"
,
"path"
:
"github.com/fatih/color"
,
...
...
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