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
54dac592
Commit
54dac592
authored
Mar 20, 2015
by
obscuren
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wip
parent
a59bb053
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
15 additions
and
3 deletions
+15
-3
backend.go
eth/backend.go
+1
-1
agent.go
miner/agent.go
+4
-0
worker.go
miner/worker.go
+2
-2
api.go
rpc/api.go
+8
-0
No files found.
eth/backend.go
View file @
54dac592
...
@@ -205,7 +205,7 @@ func New(config *Config) (*Ethereum, error) {
...
@@ -205,7 +205,7 @@ func New(config *Config) (*Ethereum, error) {
ethProto
:=
EthProtocol
(
config
.
ProtocolVersion
,
config
.
NetworkId
,
eth
.
txPool
,
eth
.
chainManager
,
eth
.
blockPool
)
ethProto
:=
EthProtocol
(
config
.
ProtocolVersion
,
config
.
NetworkId
,
eth
.
txPool
,
eth
.
chainManager
,
eth
.
blockPool
)
protocols
:=
[]
p2p
.
Protocol
{
ethProto
}
protocols
:=
[]
p2p
.
Protocol
{
ethProto
}
if
config
.
Shh
{
if
config
.
Shh
{
protocols
=
append
(
protocols
,
eth
.
whisper
.
Protocol
())
//
protocols = append(protocols, eth.whisper.Protocol())
}
}
eth
.
net
=
&
p2p
.
Server
{
eth
.
net
=
&
p2p
.
Server
{
...
...
miner/agent.go
View file @
54dac592
...
@@ -79,3 +79,7 @@ func (self *CpuMiner) mine(block *types.Block) {
...
@@ -79,3 +79,7 @@ func (self *CpuMiner) mine(block *types.Block) {
self
.
returnCh
<-
Work
{
block
.
Number
()
.
Uint64
(),
nonce
,
mixDigest
,
seedHash
}
self
.
returnCh
<-
Work
{
block
.
Number
()
.
Uint64
(),
nonce
,
mixDigest
,
seedHash
}
}
}
}
}
func
(
self
*
CpuMiner
)
GetHashRate
()
int64
{
return
self
.
pow
.
GetHashrate
()
}
miner/worker.go
View file @
54dac592
...
@@ -57,7 +57,7 @@ type Agent interface {
...
@@ -57,7 +57,7 @@ type Agent interface {
SetWorkCh
(
chan
<-
Work
)
SetWorkCh
(
chan
<-
Work
)
Stop
()
Stop
()
Start
()
Start
()
Pow
()
pow
.
PoW
GetHashRate
()
int64
}
}
type
worker
struct
{
type
worker
struct
{
...
@@ -272,7 +272,7 @@ func (self *worker) commitTransaction(tx *types.Transaction) error {
...
@@ -272,7 +272,7 @@ func (self *worker) commitTransaction(tx *types.Transaction) error {
func
(
self
*
worker
)
HashRate
()
int64
{
func
(
self
*
worker
)
HashRate
()
int64
{
var
tot
int64
var
tot
int64
for
_
,
agent
:=
range
self
.
agents
{
for
_
,
agent
:=
range
self
.
agents
{
tot
+=
agent
.
Pow
()
.
GetHashr
ate
()
tot
+=
agent
.
GetHashR
ate
()
}
}
return
tot
return
tot
...
...
rpc/api.go
View file @
54dac592
...
@@ -488,3 +488,11 @@ func toFilterOptions(options *BlockFilterArgs) *core.FilterOptions {
...
@@ -488,3 +488,11 @@ func toFilterOptions(options *BlockFilterArgs) *core.FilterOptions {
return
&
opts
return
&
opts
}
}
/*
Work() chan<- *types.Block
SetWorkCh(chan<- Work)
Stop()
Start()
Rate() uint64
*/
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