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
0fac8cba
Commit
0fac8cba
authored
Jan 04, 2017
by
Péter Szilágyi
Committed by
GitHub
Jan 04, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3511 from karalabe/live-fakepow
cmd/utils, eth, les: bubble --fakepow flag into eth/les too
parents
1ca74aba
2ce30382
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
10 deletions
+11
-10
flags.go
cmd/utils/flags.go
+1
-0
backend.go
eth/backend.go
+8
-6
backend.go
les/backend.go
+2
-4
No files found.
cmd/utils/flags.go
View file @
0fac8cba
...
@@ -749,6 +749,7 @@ func RegisterEthService(ctx *cli.Context, stack *node.Node, extra []byte) {
...
@@ -749,6 +749,7 @@ func RegisterEthService(ctx *cli.Context, stack *node.Node, extra []byte) {
GpobaseCorrectionFactor
:
ctx
.
GlobalInt
(
GpobaseCorrectionFactorFlag
.
Name
),
GpobaseCorrectionFactor
:
ctx
.
GlobalInt
(
GpobaseCorrectionFactorFlag
.
Name
),
SolcPath
:
ctx
.
GlobalString
(
SolcPathFlag
.
Name
),
SolcPath
:
ctx
.
GlobalString
(
SolcPathFlag
.
Name
),
AutoDAG
:
ctx
.
GlobalBool
(
AutoDAGFlag
.
Name
)
||
ctx
.
GlobalBool
(
MiningEnabledFlag
.
Name
),
AutoDAG
:
ctx
.
GlobalBool
(
AutoDAGFlag
.
Name
)
||
ctx
.
GlobalBool
(
MiningEnabledFlag
.
Name
),
PowFake
:
ctx
.
GlobalBool
(
FakePoWFlag
.
Name
),
}
}
// Override any default configs in dev mode or the test net
// Override any default configs in dev mode or the test net
...
...
eth/backend.go
View file @
0fac8cba
...
@@ -45,6 +45,7 @@ import (
...
@@ -45,6 +45,7 @@ import (
"github.com/ethereum/go-ethereum/node"
"github.com/ethereum/go-ethereum/node"
"github.com/ethereum/go-ethereum/p2p"
"github.com/ethereum/go-ethereum/p2p"
"github.com/ethereum/go-ethereum/params"
"github.com/ethereum/go-ethereum/params"
"github.com/ethereum/go-ethereum/pow"
"github.com/ethereum/go-ethereum/rpc"
"github.com/ethereum/go-ethereum/rpc"
)
)
...
@@ -79,6 +80,7 @@ type Config struct {
...
@@ -79,6 +80,7 @@ type Config struct {
NatSpec
bool
NatSpec
bool
DocRoot
string
DocRoot
string
AutoDAG
bool
AutoDAG
bool
PowFake
bool
PowTest
bool
PowTest
bool
PowShared
bool
PowShared
bool
ExtraData
[]
byte
ExtraData
[]
byte
...
@@ -125,7 +127,7 @@ type Ethereum struct {
...
@@ -125,7 +127,7 @@ type Ethereum struct {
chainDb
ethdb
.
Database
// Block chain database
chainDb
ethdb
.
Database
// Block chain database
eventMux
*
event
.
TypeMux
eventMux
*
event
.
TypeMux
pow
*
ethash
.
Ethash
pow
pow
.
PoW
accountManager
*
accounts
.
Manager
accountManager
*
accounts
.
Manager
ApiBackend
*
EthApiBackend
ApiBackend
*
EthApiBackend
...
@@ -139,7 +141,6 @@ type Ethereum struct {
...
@@ -139,7 +141,6 @@ type Ethereum struct {
solcPath
string
solcPath
string
NatSpec
bool
NatSpec
bool
PowTest
bool
netVersionId
int
netVersionId
int
netRPCService
*
ethapi
.
PublicNetAPI
netRPCService
*
ethapi
.
PublicNetAPI
}
}
...
@@ -174,7 +175,6 @@ func New(ctx *node.ServiceContext, config *Config) (*Ethereum, error) {
...
@@ -174,7 +175,6 @@ func New(ctx *node.ServiceContext, config *Config) (*Ethereum, error) {
stopDbUpgrade
:
stopDbUpgrade
,
stopDbUpgrade
:
stopDbUpgrade
,
netVersionId
:
config
.
NetworkId
,
netVersionId
:
config
.
NetworkId
,
NatSpec
:
config
.
NatSpec
,
NatSpec
:
config
.
NatSpec
,
PowTest
:
config
.
PowTest
,
etherbase
:
config
.
Etherbase
,
etherbase
:
config
.
Etherbase
,
MinerThreads
:
config
.
MinerThreads
,
MinerThreads
:
config
.
MinerThreads
,
AutoDAG
:
config
.
AutoDAG
,
AutoDAG
:
config
.
AutoDAG
,
...
@@ -293,15 +293,17 @@ func SetupGenesisBlock(chainDb *ethdb.Database, config *Config) error {
...
@@ -293,15 +293,17 @@ func SetupGenesisBlock(chainDb *ethdb.Database, config *Config) error {
}
}
// CreatePoW creates the required type of PoW instance for an Ethereum service
// CreatePoW creates the required type of PoW instance for an Ethereum service
func
CreatePoW
(
config
*
Config
)
(
*
ethash
.
Ethash
,
error
)
{
func
CreatePoW
(
config
*
Config
)
(
pow
.
PoW
,
error
)
{
switch
{
switch
{
case
config
.
PowFake
:
glog
.
V
(
logger
.
Info
)
.
Infof
(
"ethash used in fake mode"
)
return
pow
.
PoW
(
core
.
FakePow
{}),
nil
case
config
.
PowTest
:
case
config
.
PowTest
:
glog
.
V
(
logger
.
Info
)
.
Infof
(
"ethash used in test mode"
)
glog
.
V
(
logger
.
Info
)
.
Infof
(
"ethash used in test mode"
)
return
ethash
.
NewForTesting
()
return
ethash
.
NewForTesting
()
case
config
.
PowShared
:
case
config
.
PowShared
:
glog
.
V
(
logger
.
Info
)
.
Infof
(
"ethash used in shared mode"
)
glog
.
V
(
logger
.
Info
)
.
Infof
(
"ethash used in shared mode"
)
return
ethash
.
NewShared
(),
nil
return
ethash
.
NewShared
(),
nil
default
:
default
:
return
ethash
.
New
(),
nil
return
ethash
.
New
(),
nil
}
}
...
@@ -399,7 +401,7 @@ func (s *Ethereum) AccountManager() *accounts.Manager { return s.accountManager
...
@@ -399,7 +401,7 @@ func (s *Ethereum) AccountManager() *accounts.Manager { return s.accountManager
func
(
s
*
Ethereum
)
BlockChain
()
*
core
.
BlockChain
{
return
s
.
blockchain
}
func
(
s
*
Ethereum
)
BlockChain
()
*
core
.
BlockChain
{
return
s
.
blockchain
}
func
(
s
*
Ethereum
)
TxPool
()
*
core
.
TxPool
{
return
s
.
txPool
}
func
(
s
*
Ethereum
)
TxPool
()
*
core
.
TxPool
{
return
s
.
txPool
}
func
(
s
*
Ethereum
)
EventMux
()
*
event
.
TypeMux
{
return
s
.
eventMux
}
func
(
s
*
Ethereum
)
EventMux
()
*
event
.
TypeMux
{
return
s
.
eventMux
}
func
(
s
*
Ethereum
)
Pow
()
*
ethash
.
Ethash
{
return
s
.
pow
}
func
(
s
*
Ethereum
)
Pow
()
pow
.
PoW
{
return
s
.
pow
}
func
(
s
*
Ethereum
)
ChainDb
()
ethdb
.
Database
{
return
s
.
chainDb
}
func
(
s
*
Ethereum
)
ChainDb
()
ethdb
.
Database
{
return
s
.
chainDb
}
func
(
s
*
Ethereum
)
IsListening
()
bool
{
return
true
}
// Always listening
func
(
s
*
Ethereum
)
IsListening
()
bool
{
return
true
}
// Always listening
func
(
s
*
Ethereum
)
EthVersion
()
int
{
return
int
(
s
.
protocolManager
.
SubProtocols
[
0
]
.
Version
)
}
func
(
s
*
Ethereum
)
EthVersion
()
int
{
return
int
(
s
.
protocolManager
.
SubProtocols
[
0
]
.
Version
)
}
...
...
les/backend.go
View file @
0fac8cba
...
@@ -22,7 +22,6 @@ import (
...
@@ -22,7 +22,6 @@ import (
"fmt"
"fmt"
"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/common/compiler"
"github.com/ethereum/go-ethereum/common/compiler"
...
@@ -42,6 +41,7 @@ import (
...
@@ -42,6 +41,7 @@ import (
"github.com/ethereum/go-ethereum/node"
"github.com/ethereum/go-ethereum/node"
"github.com/ethereum/go-ethereum/p2p"
"github.com/ethereum/go-ethereum/p2p"
"github.com/ethereum/go-ethereum/params"
"github.com/ethereum/go-ethereum/params"
"github.com/ethereum/go-ethereum/pow"
rpc
"github.com/ethereum/go-ethereum/rpc"
rpc
"github.com/ethereum/go-ethereum/rpc"
)
)
...
@@ -61,13 +61,12 @@ type LightEthereum struct {
...
@@ -61,13 +61,12 @@ type LightEthereum struct {
ApiBackend
*
LesApiBackend
ApiBackend
*
LesApiBackend
eventMux
*
event
.
TypeMux
eventMux
*
event
.
TypeMux
pow
*
ethash
.
Ethash
pow
pow
.
PoW
accountManager
*
accounts
.
Manager
accountManager
*
accounts
.
Manager
solcPath
string
solcPath
string
solc
*
compiler
.
Solidity
solc
*
compiler
.
Solidity
NatSpec
bool
NatSpec
bool
PowTest
bool
netVersionId
int
netVersionId
int
netRPCService
*
ethapi
.
PublicNetAPI
netRPCService
*
ethapi
.
PublicNetAPI
}
}
...
@@ -97,7 +96,6 @@ func New(ctx *node.ServiceContext, config *eth.Config) (*LightEthereum, error) {
...
@@ -97,7 +96,6 @@ func New(ctx *node.ServiceContext, config *eth.Config) (*LightEthereum, error) {
shutdownChan
:
make
(
chan
bool
),
shutdownChan
:
make
(
chan
bool
),
netVersionId
:
config
.
NetworkId
,
netVersionId
:
config
.
NetworkId
,
NatSpec
:
config
.
NatSpec
,
NatSpec
:
config
.
NatSpec
,
PowTest
:
config
.
PowTest
,
solcPath
:
config
.
SolcPath
,
solcPath
:
config
.
SolcPath
,
}
}
...
...
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