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
da9aad88
Commit
da9aad88
authored
Jul 01, 2016
by
Péter Szilágyi
Committed by
GitHub
Jul 01, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2759 from karalabe/drop-redundant-full-service
cmd, common, console, eth, release: drop redundant "full"s
parents
1e50f5dd
96dc42d9
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
86 additions
and
86 deletions
+86
-86
main.go
cmd/geth/main.go
+1
-1
main.go
cmd/gethrpctest/main.go
+1
-1
natspec_e2e_test.go
common/natspec/natspec_e2e_test.go
+2
-2
console_test.go
console/console_test.go
+2
-2
api.go
eth/api.go
+39
-39
api_backend.go
eth/api_backend.go
+1
-1
backend.go
eth/backend.go
+36
-36
bind.go
eth/bind.go
+1
-1
cpu_mining.go
eth/cpu_mining.go
+1
-1
gpu_mining.go
eth/gpu_mining.go
+1
-1
release.go
release/release.go
+1
-1
No files found.
cmd/geth/main.go
View file @
da9aad88
...
...
@@ -328,7 +328,7 @@ func startNode(ctx *cli.Context, stack *node.Node) {
}
// Start auxiliary services if enabled
if
ctx
.
GlobalBool
(
utils
.
MiningEnabledFlag
.
Name
)
{
var
ethereum
*
eth
.
FullNodeService
var
ethereum
*
eth
.
Ethereum
if
err
:=
stack
.
Service
(
&
ethereum
);
err
!=
nil
{
utils
.
Fatalf
(
"ethereum service not running: %v"
,
err
)
}
...
...
cmd/gethrpctest/main.go
View file @
da9aad88
...
...
@@ -146,7 +146,7 @@ func MakeSystemNode(keydir string, privkey string, test *tests.BlockTest) (*node
// RunTest executes the specified test against an already pre-configured protocol
// stack to ensure basic checks pass before running RPC tests.
func
RunTest
(
stack
*
node
.
Node
,
test
*
tests
.
BlockTest
)
error
{
var
ethereum
*
eth
.
FullNodeService
var
ethereum
*
eth
.
Ethereum
stack
.
Service
(
&
ethereum
)
blockchain
:=
ethereum
.
BlockChain
()
...
...
common/natspec/natspec_e2e_test.go
View file @
da9aad88
...
...
@@ -99,7 +99,7 @@ const (
type
testFrontend
struct
{
t
*
testing
.
T
ethereum
*
eth
.
FullNodeService
ethereum
*
eth
.
Ethereum
xeth
*
xe
.
XEth
wait
chan
*
big
.
Int
lastConfirm
string
...
...
@@ -123,7 +123,7 @@ func (self *testFrontend) ConfirmTransaction(tx string) bool {
return
true
}
func
testEth
(
t
*
testing
.
T
)
(
ethereum
*
eth
.
FullNodeService
,
err
error
)
{
func
testEth
(
t
*
testing
.
T
)
(
ethereum
*
eth
.
Ethereum
,
err
error
)
{
tmp
,
err
:=
ioutil
.
TempDir
(
""
,
"natspec-test"
)
if
err
!=
nil
{
...
...
console/console_test.go
View file @
da9aad88
...
...
@@ -76,7 +76,7 @@ func (p *hookedPrompter) SetWordCompleter(completer WordCompleter) {}
type
tester
struct
{
workspace
string
stack
*
node
.
Node
ethereum
*
eth
.
FullNodeService
ethereum
*
eth
.
Ethereum
console
*
Console
input
*
hookedPrompter
output
*
bytes
.
Buffer
...
...
@@ -134,7 +134,7 @@ func newTester(t *testing.T, confOverride func(*eth.Config)) *tester {
t
.
Fatalf
(
"failed to create JavaScript console: %v"
,
err
)
}
// Create the final tester and return
var
ethereum
*
eth
.
FullNodeService
var
ethereum
*
eth
.
Ethereum
stack
.
Service
(
&
ethereum
)
return
&
tester
{
...
...
eth/api.go
View file @
da9aad88
...
...
@@ -40,41 +40,41 @@ import (
"github.com/ethereum/go-ethereum/rpc"
)
// Public
Full
EthereumAPI provides an API to access Ethereum full node-related
// PublicEthereumAPI provides an API to access Ethereum full node-related
// information.
type
Public
Full
EthereumAPI
struct
{
e
*
FullNodeService
type
PublicEthereumAPI
struct
{
e
*
Ethereum
}
// NewPublic
Full
EthereumAPI creates a new Etheruem protocol API for full nodes.
func
NewPublic
FullEthereumAPI
(
e
*
FullNodeService
)
*
PublicFull
EthereumAPI
{
return
&
Public
Full
EthereumAPI
{
e
}
// NewPublicEthereumAPI creates a new Etheruem protocol API for full nodes.
func
NewPublic
EthereumAPI
(
e
*
Ethereum
)
*
Public
EthereumAPI
{
return
&
PublicEthereumAPI
{
e
}
}
// Etherbase is the address that mining rewards will be send to
func
(
s
*
Public
Full
EthereumAPI
)
Etherbase
()
(
common
.
Address
,
error
)
{
func
(
s
*
PublicEthereumAPI
)
Etherbase
()
(
common
.
Address
,
error
)
{
return
s
.
e
.
Etherbase
()
}
// Coinbase is the address that mining rewards will be send to (alias for Etherbase)
func
(
s
*
Public
Full
EthereumAPI
)
Coinbase
()
(
common
.
Address
,
error
)
{
func
(
s
*
PublicEthereumAPI
)
Coinbase
()
(
common
.
Address
,
error
)
{
return
s
.
Etherbase
()
}
// Hashrate returns the POW hashrate
func
(
s
*
Public
Full
EthereumAPI
)
Hashrate
()
*
rpc
.
HexNumber
{
func
(
s
*
PublicEthereumAPI
)
Hashrate
()
*
rpc
.
HexNumber
{
return
rpc
.
NewHexNumber
(
s
.
e
.
Miner
()
.
HashRate
())
}
// PublicMinerAPI provides an API to control the miner.
// It offers only methods that operate on data that pose no security risk when it is publicly accessible.
type
PublicMinerAPI
struct
{
e
*
FullNodeService
e
*
Ethereum
agent
*
miner
.
RemoteAgent
}
// NewPublicMinerAPI create a new PublicMinerAPI instance.
func
NewPublicMinerAPI
(
e
*
FullNodeService
)
*
PublicMinerAPI
{
func
NewPublicMinerAPI
(
e
*
Ethereum
)
*
PublicMinerAPI
{
agent
:=
miner
.
NewRemoteAgent
()
e
.
Miner
()
.
Register
(
agent
)
...
...
@@ -120,11 +120,11 @@ func (s *PublicMinerAPI) SubmitHashrate(hashrate rpc.HexNumber, id common.Hash)
// PrivateMinerAPI provides private RPC methods to control the miner.
// These methods can be abused by external users and must be considered insecure for use by untrusted users.
type
PrivateMinerAPI
struct
{
e
*
FullNodeService
e
*
Ethereum
}
// NewPrivateMinerAPI create a new RPC service which controls the miner of this node.
func
NewPrivateMinerAPI
(
e
*
FullNodeService
)
*
PrivateMinerAPI
{
func
NewPrivateMinerAPI
(
e
*
Ethereum
)
*
PrivateMinerAPI
{
return
&
PrivateMinerAPI
{
e
:
e
}
}
...
...
@@ -191,20 +191,20 @@ func (s *PrivateMinerAPI) MakeDAG(blockNr rpc.BlockNumber) (bool, error) {
return
true
,
nil
}
// Private
Full
AdminAPI is the collection of Etheruem full node-related APIs
// PrivateAdminAPI is the collection of Etheruem full node-related APIs
// exposed over the private admin endpoint.
type
Private
Full
AdminAPI
struct
{
eth
*
FullNodeService
type
PrivateAdminAPI
struct
{
eth
*
Ethereum
}
// NewPrivateAdminAPI creates a new API definition for the full node private
// admin methods of the Ethereum service.
func
NewPrivate
FullAdminAPI
(
eth
*
FullNodeService
)
*
PrivateFull
AdminAPI
{
return
&
Private
Full
AdminAPI
{
eth
:
eth
}
func
NewPrivate
AdminAPI
(
eth
*
Ethereum
)
*
Private
AdminAPI
{
return
&
PrivateAdminAPI
{
eth
:
eth
}
}
// ExportChain exports the current blockchain into a local file.
func
(
api
*
Private
Full
AdminAPI
)
ExportChain
(
file
string
)
(
bool
,
error
)
{
func
(
api
*
PrivateAdminAPI
)
ExportChain
(
file
string
)
(
bool
,
error
)
{
// Make sure we can create the file to export into
out
,
err
:=
os
.
OpenFile
(
file
,
os
.
O_CREATE
|
os
.
O_WRONLY
|
os
.
O_TRUNC
,
os
.
ModePerm
)
if
err
!=
nil
{
...
...
@@ -230,7 +230,7 @@ func hasAllBlocks(chain *core.BlockChain, bs []*types.Block) bool {
}
// ImportChain imports a blockchain from a local file.
func
(
api
*
Private
Full
AdminAPI
)
ImportChain
(
file
string
)
(
bool
,
error
)
{
func
(
api
*
PrivateAdminAPI
)
ImportChain
(
file
string
)
(
bool
,
error
)
{
// Make sure the can access the file to import
in
,
err
:=
os
.
Open
(
file
)
if
err
!=
nil
{
...
...
@@ -271,20 +271,20 @@ func (api *PrivateFullAdminAPI) ImportChain(file string) (bool, error) {
return
true
,
nil
}
// Public
Full
DebugAPI is the collection of Etheruem full node APIs exposed
// PublicDebugAPI is the collection of Etheruem full node APIs exposed
// over the public debugging endpoint.
type
Public
Full
DebugAPI
struct
{
eth
*
FullNodeService
type
PublicDebugAPI
struct
{
eth
*
Ethereum
}
// NewPublic
Full
DebugAPI creates a new API definition for the full node-
// NewPublicDebugAPI creates a new API definition for the full node-
// related public debug methods of the Ethereum service.
func
NewPublic
FullDebugAPI
(
eth
*
FullNodeService
)
*
PublicFull
DebugAPI
{
return
&
Public
Full
DebugAPI
{
eth
:
eth
}
func
NewPublic
DebugAPI
(
eth
*
Ethereum
)
*
Public
DebugAPI
{
return
&
PublicDebugAPI
{
eth
:
eth
}
}
// DumpBlock retrieves the entire state of the database at a given block.
func
(
api
*
Public
Full
DebugAPI
)
DumpBlock
(
number
uint64
)
(
state
.
World
,
error
)
{
func
(
api
*
PublicDebugAPI
)
DumpBlock
(
number
uint64
)
(
state
.
World
,
error
)
{
block
:=
api
.
eth
.
BlockChain
()
.
GetBlockByNumber
(
number
)
if
block
==
nil
{
return
state
.
World
{},
fmt
.
Errorf
(
"block #%d not found"
,
number
)
...
...
@@ -296,17 +296,17 @@ func (api *PublicFullDebugAPI) DumpBlock(number uint64) (state.World, error) {
return
stateDb
.
RawDump
(),
nil
}
// Private
Full
DebugAPI is the collection of Etheruem full node APIs exposed over
// PrivateDebugAPI is the collection of Etheruem full node APIs exposed over
// the private debugging endpoint.
type
Private
Full
DebugAPI
struct
{
type
PrivateDebugAPI
struct
{
config
*
core
.
ChainConfig
eth
*
FullNodeService
eth
*
Ethereum
}
// NewPrivate
Full
DebugAPI creates a new API definition for the full node-related
// NewPrivateDebugAPI creates a new API definition for the full node-related
// private debug methods of the Ethereum service.
func
NewPrivate
FullDebugAPI
(
config
*
core
.
ChainConfig
,
eth
*
FullNodeService
)
*
PrivateFull
DebugAPI
{
return
&
Private
Full
DebugAPI
{
config
:
config
,
eth
:
eth
}
func
NewPrivate
DebugAPI
(
config
*
core
.
ChainConfig
,
eth
*
Ethereum
)
*
Private
DebugAPI
{
return
&
PrivateDebugAPI
{
config
:
config
,
eth
:
eth
}
}
// BlockTraceResult is the returned value when replaying a block to check for
...
...
@@ -319,7 +319,7 @@ type BlockTraceResult struct {
// TraceBlock processes the given block's RLP but does not import the block in to
// the chain.
func
(
api
*
Private
Full
DebugAPI
)
TraceBlock
(
blockRlp
[]
byte
,
config
*
vm
.
Config
)
BlockTraceResult
{
func
(
api
*
PrivateDebugAPI
)
TraceBlock
(
blockRlp
[]
byte
,
config
*
vm
.
Config
)
BlockTraceResult
{
var
block
types
.
Block
err
:=
rlp
.
Decode
(
bytes
.
NewReader
(
blockRlp
),
&
block
)
if
err
!=
nil
{
...
...
@@ -336,7 +336,7 @@ func (api *PrivateFullDebugAPI) TraceBlock(blockRlp []byte, config *vm.Config) B
// TraceBlockFromFile loads the block's RLP from the given file name and attempts to
// process it but does not import the block in to the chain.
func
(
api
*
Private
Full
DebugAPI
)
TraceBlockFromFile
(
file
string
,
config
*
vm
.
Config
)
BlockTraceResult
{
func
(
api
*
PrivateDebugAPI
)
TraceBlockFromFile
(
file
string
,
config
*
vm
.
Config
)
BlockTraceResult
{
blockRlp
,
err
:=
ioutil
.
ReadFile
(
file
)
if
err
!=
nil
{
return
BlockTraceResult
{
Error
:
fmt
.
Sprintf
(
"could not read file: %v"
,
err
)}
...
...
@@ -345,7 +345,7 @@ func (api *PrivateFullDebugAPI) TraceBlockFromFile(file string, config *vm.Confi
}
// TraceBlockByNumber processes the block by canonical block number.
func
(
api
*
Private
Full
DebugAPI
)
TraceBlockByNumber
(
number
uint64
,
config
*
vm
.
Config
)
BlockTraceResult
{
func
(
api
*
PrivateDebugAPI
)
TraceBlockByNumber
(
number
uint64
,
config
*
vm
.
Config
)
BlockTraceResult
{
// Fetch the block that we aim to reprocess
block
:=
api
.
eth
.
BlockChain
()
.
GetBlockByNumber
(
number
)
if
block
==
nil
{
...
...
@@ -361,7 +361,7 @@ func (api *PrivateFullDebugAPI) TraceBlockByNumber(number uint64, config *vm.Con
}
// TraceBlockByHash processes the block by hash.
func
(
api
*
Private
Full
DebugAPI
)
TraceBlockByHash
(
hash
common
.
Hash
,
config
*
vm
.
Config
)
BlockTraceResult
{
func
(
api
*
PrivateDebugAPI
)
TraceBlockByHash
(
hash
common
.
Hash
,
config
*
vm
.
Config
)
BlockTraceResult
{
// Fetch the block that we aim to reprocess
block
:=
api
.
eth
.
BlockChain
()
.
GetBlockByHash
(
hash
)
if
block
==
nil
{
...
...
@@ -389,7 +389,7 @@ func (t *TraceCollector) AddStructLog(slog vm.StructLog) {
}
// traceBlock processes the given block but does not save the state.
func
(
api
*
Private
Full
DebugAPI
)
traceBlock
(
block
*
types
.
Block
,
config
*
vm
.
Config
)
(
bool
,
[]
vm
.
StructLog
,
error
)
{
func
(
api
*
PrivateDebugAPI
)
traceBlock
(
block
*
types
.
Block
,
config
*
vm
.
Config
)
(
bool
,
[]
vm
.
StructLog
,
error
)
{
// Validate and reprocess the block
var
(
blockchain
=
api
.
eth
.
BlockChain
()
...
...
@@ -452,7 +452,7 @@ func formatError(err error) string {
// TraceTransaction returns the structured logs created during the execution of EVM
// and returns them as a JSON object.
func
(
api
*
Private
Full
DebugAPI
)
TraceTransaction
(
txHash
common
.
Hash
,
logger
*
vm
.
LogConfig
)
(
*
ethapi
.
ExecutionResult
,
error
)
{
func
(
api
*
PrivateDebugAPI
)
TraceTransaction
(
txHash
common
.
Hash
,
logger
*
vm
.
LogConfig
)
(
*
ethapi
.
ExecutionResult
,
error
)
{
if
logger
==
nil
{
logger
=
new
(
vm
.
LogConfig
)
}
...
...
eth/api_backend.go
View file @
da9aad88
...
...
@@ -36,7 +36,7 @@ import (
// EthApiBackend implements ethapi.Backend for full nodes
type
EthApiBackend
struct
{
eth
*
FullNodeService
eth
*
Ethereum
gpo
*
gasprice
.
GasPriceOracle
}
...
...
eth/backend.go
View file @
da9aad88
...
...
@@ -103,8 +103,8 @@ type Config struct {
TestGenesisState
ethdb
.
Database
// Genesis state to seed the database with (testing only!)
}
//
FullNodeService
implements the Ethereum full node service.
type
FullNodeService
struct
{
//
Ethereum
implements the Ethereum full node service.
type
Ethereum
struct
{
chainConfig
*
core
.
ChainConfig
// Channel for shutting down the service
shutdownChan
chan
bool
// Channel for shutting down the ethereum
...
...
@@ -140,9 +140,9 @@ type FullNodeService struct {
netRPCService
*
ethapi
.
PublicNetAPI
}
// New creates a new
FullNodeService
object (including the
// New creates a new
Ethereum
object (including the
// initialisation of the common Ethereum object)
func
New
(
ctx
*
node
.
ServiceContext
,
config
*
Config
)
(
*
FullNodeService
,
error
)
{
func
New
(
ctx
*
node
.
ServiceContext
,
config
*
Config
)
(
*
Ethereum
,
error
)
{
chainDb
,
dappDb
,
err
:=
CreateDBs
(
ctx
,
config
)
if
err
!=
nil
{
return
nil
,
err
...
...
@@ -156,7 +156,7 @@ func New(ctx *node.ServiceContext, config *Config) (*FullNodeService, error) {
return
nil
,
err
}
eth
:=
&
FullNodeService
{
eth
:=
&
Ethereum
{
chainDb
:
chainDb
,
dappDb
:
dappDb
,
eventMux
:
ctx
.
EventMux
,
...
...
@@ -303,12 +303,12 @@ func CreatePoW(config *Config) (*ethash.Ethash, error) {
// APIs returns the collection of RPC services the ethereum package offers.
// NOTE, some of these services probably need to be moved to somewhere else.
func
(
s
*
FullNodeService
)
APIs
()
[]
rpc
.
API
{
func
(
s
*
Ethereum
)
APIs
()
[]
rpc
.
API
{
return
append
(
ethapi
.
GetAPIs
(
s
.
apiBackend
,
&
s
.
solcPath
,
&
s
.
solc
),
[]
rpc
.
API
{
{
Namespace
:
"eth"
,
Version
:
"1.0"
,
Service
:
NewPublic
Full
EthereumAPI
(
s
),
Service
:
NewPublicEthereumAPI
(
s
),
Public
:
true
,
},
{
Namespace
:
"eth"
,
...
...
@@ -333,16 +333,16 @@ func (s *FullNodeService) APIs() []rpc.API {
},
{
Namespace
:
"admin"
,
Version
:
"1.0"
,
Service
:
NewPrivate
Full
AdminAPI
(
s
),
Service
:
NewPrivateAdminAPI
(
s
),
},
{
Namespace
:
"debug"
,
Version
:
"1.0"
,
Service
:
NewPublic
Full
DebugAPI
(
s
),
Service
:
NewPublicDebugAPI
(
s
),
Public
:
true
,
},
{
Namespace
:
"debug"
,
Version
:
"1.0"
,
Service
:
NewPrivate
Full
DebugAPI
(
s
.
chainConfig
,
s
),
Service
:
NewPrivateDebugAPI
(
s
.
chainConfig
,
s
),
},
{
Namespace
:
"net"
,
Version
:
"1.0"
,
...
...
@@ -356,11 +356,11 @@ func (s *FullNodeService) APIs() []rpc.API {
}
...
)
}
func
(
s
*
FullNodeService
)
ResetWithGenesisBlock
(
gb
*
types
.
Block
)
{
func
(
s
*
Ethereum
)
ResetWithGenesisBlock
(
gb
*
types
.
Block
)
{
s
.
blockchain
.
ResetWithGenesisBlock
(
gb
)
}
func
(
s
*
FullNodeService
)
Etherbase
()
(
eb
common
.
Address
,
err
error
)
{
func
(
s
*
Ethereum
)
Etherbase
()
(
eb
common
.
Address
,
err
error
)
{
eb
=
s
.
etherbase
if
(
eb
==
common
.
Address
{})
{
firstAccount
,
err
:=
s
.
AccountManager
()
.
AccountByIndex
(
0
)
...
...
@@ -373,36 +373,36 @@ func (s *FullNodeService) Etherbase() (eb common.Address, err error) {
}
// set in js console via admin interface or wrapper from cli flags
func
(
self
*
FullNodeService
)
SetEtherbase
(
etherbase
common
.
Address
)
{
func
(
self
*
Ethereum
)
SetEtherbase
(
etherbase
common
.
Address
)
{
self
.
etherbase
=
etherbase
self
.
miner
.
SetEtherbase
(
etherbase
)
}
func
(
s
*
FullNodeService
)
StopMining
()
{
s
.
miner
.
Stop
()
}
func
(
s
*
FullNodeService
)
IsMining
()
bool
{
return
s
.
miner
.
Mining
()
}
func
(
s
*
FullNodeService
)
Miner
()
*
miner
.
Miner
{
return
s
.
miner
}
func
(
s
*
FullNodeService
)
AccountManager
()
*
accounts
.
Manager
{
return
s
.
accountManager
}
func
(
s
*
FullNodeService
)
BlockChain
()
*
core
.
BlockChain
{
return
s
.
blockchain
}
func
(
s
*
FullNodeService
)
TxPool
()
*
core
.
TxPool
{
return
s
.
txPool
}
func
(
s
*
FullNodeService
)
EventMux
()
*
event
.
TypeMux
{
return
s
.
eventMux
}
func
(
s
*
FullNodeService
)
Pow
()
*
ethash
.
Ethash
{
return
s
.
pow
}
func
(
s
*
FullNodeService
)
ChainDb
()
ethdb
.
Database
{
return
s
.
chainDb
}
func
(
s
*
FullNodeService
)
DappDb
()
ethdb
.
Database
{
return
s
.
dappDb
}
func
(
s
*
FullNodeService
)
IsListening
()
bool
{
return
true
}
// Always listening
func
(
s
*
FullNodeService
)
EthVersion
()
int
{
return
int
(
s
.
protocolManager
.
SubProtocols
[
0
]
.
Version
)
}
func
(
s
*
FullNodeService
)
NetVersion
()
int
{
return
s
.
netVersionId
}
func
(
s
*
FullNodeService
)
Downloader
()
*
downloader
.
Downloader
{
return
s
.
protocolManager
.
downloader
}
func
(
s
*
Ethereum
)
StopMining
()
{
s
.
miner
.
Stop
()
}
func
(
s
*
Ethereum
)
IsMining
()
bool
{
return
s
.
miner
.
Mining
()
}
func
(
s
*
Ethereum
)
Miner
()
*
miner
.
Miner
{
return
s
.
miner
}
func
(
s
*
Ethereum
)
AccountManager
()
*
accounts
.
Manager
{
return
s
.
accountManager
}
func
(
s
*
Ethereum
)
BlockChain
()
*
core
.
BlockChain
{
return
s
.
blockchain
}
func
(
s
*
Ethereum
)
TxPool
()
*
core
.
TxPool
{
return
s
.
txPool
}
func
(
s
*
Ethereum
)
EventMux
()
*
event
.
TypeMux
{
return
s
.
eventMux
}
func
(
s
*
Ethereum
)
Pow
()
*
ethash
.
Ethash
{
return
s
.
pow
}
func
(
s
*
Ethereum
)
ChainDb
()
ethdb
.
Database
{
return
s
.
chainDb
}
func
(
s
*
Ethereum
)
DappDb
()
ethdb
.
Database
{
return
s
.
dappDb
}
func
(
s
*
Ethereum
)
IsListening
()
bool
{
return
true
}
// Always listening
func
(
s
*
Ethereum
)
EthVersion
()
int
{
return
int
(
s
.
protocolManager
.
SubProtocols
[
0
]
.
Version
)
}
func
(
s
*
Ethereum
)
NetVersion
()
int
{
return
s
.
netVersionId
}
func
(
s
*
Ethereum
)
Downloader
()
*
downloader
.
Downloader
{
return
s
.
protocolManager
.
downloader
}
// Protocols implements node.Service, returning all the currently configured
// network protocols to start.
func
(
s
*
FullNodeService
)
Protocols
()
[]
p2p
.
Protocol
{
func
(
s
*
Ethereum
)
Protocols
()
[]
p2p
.
Protocol
{
return
s
.
protocolManager
.
SubProtocols
}
// Start implements node.Service, starting all internal goroutines needed by the
//
FullNodeService
protocol implementation.
func
(
s
*
FullNodeService
)
Start
(
srvr
*
p2p
.
Server
)
error
{
//
Ethereum
protocol implementation.
func
(
s
*
Ethereum
)
Start
(
srvr
*
p2p
.
Server
)
error
{
s
.
netRPCService
=
ethapi
.
NewPublicNetAPI
(
srvr
,
s
.
NetVersion
())
if
s
.
AutoDAG
{
s
.
StartAutoDAG
()
...
...
@@ -413,7 +413,7 @@ func (s *FullNodeService) Start(srvr *p2p.Server) error {
// Stop implements node.Service, terminating all internal goroutines used by the
// Ethereum protocol.
func
(
s
*
FullNodeService
)
Stop
()
error
{
func
(
s
*
Ethereum
)
Stop
()
error
{
if
s
.
stopDbUpgrade
!=
nil
{
s
.
stopDbUpgrade
()
}
...
...
@@ -433,7 +433,7 @@ func (s *FullNodeService) Stop() error {
}
// This function will wait for a shutdown and resumes main thread execution
func
(
s
*
FullNodeService
)
WaitForShutdown
()
{
func
(
s
*
Ethereum
)
WaitForShutdown
()
{
<-
s
.
shutdownChan
}
...
...
@@ -446,7 +446,7 @@ func (s *FullNodeService) WaitForShutdown() {
// stop any number of times.
// For any more sophisticated pattern of DAG generation, use CLI subcommand
// makedag
func
(
self
*
FullNodeService
)
StartAutoDAG
()
{
func
(
self
*
Ethereum
)
StartAutoDAG
()
{
if
self
.
autodagquit
!=
nil
{
return
// already started
}
...
...
@@ -492,7 +492,7 @@ func (self *FullNodeService) StartAutoDAG() {
}
// stopAutoDAG stops automatic DAG pregeneration by quitting the loop
func
(
self
*
FullNodeService
)
StopAutoDAG
()
{
func
(
self
*
Ethereum
)
StopAutoDAG
()
{
if
self
.
autodagquit
!=
nil
{
close
(
self
.
autodagquit
)
self
.
autodagquit
=
nil
...
...
@@ -502,7 +502,7 @@ func (self *FullNodeService) StopAutoDAG() {
// HTTPClient returns the light http client used for fetching offchain docs
// (natspec, source for verification)
func
(
self
*
FullNodeService
)
HTTPClient
()
*
httpclient
.
HTTPClient
{
func
(
self
*
Ethereum
)
HTTPClient
()
*
httpclient
.
HTTPClient
{
return
self
.
httpclient
}
...
...
eth/bind.go
View file @
da9aad88
...
...
@@ -42,7 +42,7 @@ type ContractBackend struct {
// NewContractBackend creates a new native contract backend using an existing
// Etheruem object.
func
NewContractBackend
(
eth
*
FullNodeService
)
*
ContractBackend
{
func
NewContractBackend
(
eth
*
Ethereum
)
*
ContractBackend
{
return
&
ContractBackend
{
eapi
:
ethapi
.
NewPublicEthereumAPI
(
eth
.
apiBackend
,
nil
,
nil
),
bcapi
:
ethapi
.
NewPublicBlockChainAPI
(
eth
.
apiBackend
),
...
...
eth/cpu_mining.go
View file @
da9aad88
...
...
@@ -28,7 +28,7 @@ import (
const
disabledInfo
=
"Set GO_OPENCL and re-build to enable."
func
(
s
*
FullNodeService
)
StartMining
(
threads
int
,
gpus
string
)
error
{
func
(
s
*
Ethereum
)
StartMining
(
threads
int
,
gpus
string
)
error
{
eb
,
err
:=
s
.
Etherbase
()
if
err
!=
nil
{
err
=
fmt
.
Errorf
(
"Cannot start mining without etherbase address: %v"
,
err
)
...
...
eth/gpu_mining.go
View file @
da9aad88
...
...
@@ -33,7 +33,7 @@ import (
"github.com/ethereum/go-ethereum/miner"
)
func
(
s
*
FullNodeService
)
StartMining
(
threads
int
,
gpus
string
)
error
{
func
(
s
*
Ethereum
)
StartMining
(
threads
int
,
gpus
string
)
error
{
eb
,
err
:=
s
.
Etherbase
()
if
err
!=
nil
{
err
=
fmt
.
Errorf
(
"Cannot start mining without etherbase address: %v"
,
err
)
...
...
release/release.go
View file @
da9aad88
...
...
@@ -58,7 +58,7 @@ type ReleaseService struct {
// releases and notify the user of such.
func
NewReleaseService
(
ctx
*
node
.
ServiceContext
,
config
Config
)
(
node
.
Service
,
error
)
{
// Retrieve the Ethereum service dependency to access the blockchain
var
ethereum
*
eth
.
FullNodeService
var
ethereum
*
eth
.
Ethereum
if
err
:=
ctx
.
Service
(
&
ethereum
);
err
!=
nil
{
return
nil
,
err
}
...
...
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