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
23ad2f02
Commit
23ad2f02
authored
Mar 06, 2015
by
obscuren
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
debug comments & pow handling
parent
580d0908
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
8 deletions
+6
-8
chain_manager.go
core/chain_manager.go
+0
-5
protocol.go
eth/protocol.go
+1
-2
miner.go
miner/miner.go
+5
-1
No files found.
core/chain_manager.go
View file @
23ad2f02
...
...
@@ -66,7 +66,6 @@ func CalcGasLimit(parent, block *types.Block) *big.Int {
}
// ((1024-1) * parent.gasLimit + (gasUsed * 6 / 5)) / 1024
previous
:=
new
(
big
.
Int
)
.
Mul
(
big
.
NewInt
(
1024
-
1
),
parent
.
GasLimit
())
current
:=
new
(
big
.
Rat
)
.
Mul
(
new
(
big
.
Rat
)
.
SetInt
(
parent
.
GasUsed
()),
big
.
NewRat
(
6
,
5
))
curInt
:=
new
(
big
.
Int
)
.
Div
(
current
.
Num
(),
current
.
Denom
())
...
...
@@ -291,7 +290,6 @@ func (self *ChainManager) GetBlockHashesFromHash(hash []byte, max uint64) (chain
if
block
==
nil
{
return
}
// XXX Could be optimised by using a different database which only holds hashes (i.e., linked list)
for
i
:=
uint64
(
0
);
i
<
max
;
i
++
{
parentHash
:=
block
.
Header
()
.
ParentHash
...
...
@@ -396,12 +394,9 @@ func (bc *ChainManager) Stop() {
}
func
(
self
*
ChainManager
)
InsertChain
(
chain
types
.
Blocks
)
error
{
println
(
"insert chain start"
)
self
.
tsmu
.
Lock
()
defer
self
.
tsmu
.
Unlock
()
defer
println
(
"insert chain end"
)
for
_
,
block
:=
range
chain
{
// Call in to the block processor and check for errors. It's likely that if one block fails
// all others will fail too (unless a known block is returned).
...
...
eth/protocol.go
View file @
23ad2f02
...
...
@@ -253,10 +253,9 @@ func (self *ethProtocol) handle() error {
case
NewBlockMsg
:
var
request
newBlockMsgData
if
err
:=
msg
.
Decode
(
&
request
);
err
!=
nil
{
return
self
.
protoError
(
ErrDecode
,
"
msg
%v: %v"
,
msg
,
err
)
return
self
.
protoError
(
ErrDecode
,
"%v: %v"
,
msg
,
err
)
}
hash
:=
request
.
Block
.
Hash
()
fmt
.
Printf
(
"received block: %x
\n
"
,
hash
)
_
,
chainHead
,
_
:=
self
.
chainManager
.
Status
()
jsonlogger
.
LogJson
(
&
logger
.
EthChainReceivedNewBlock
{
...
...
miner/miner.go
View file @
23ad2f02
...
...
@@ -3,6 +3,7 @@ package miner
import
(
"math/big"
"github.com/ethereum/ethash"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/logger"
"github.com/ethereum/go-ethereum/pow"
...
...
@@ -29,7 +30,6 @@ func New(coinbase []byte, eth core.Backend, pow pow.PoW, minerThreads int) *Mine
pow
:
pow
,
}
minerThreads
=
1
for
i
:=
0
;
i
<
minerThreads
;
i
++
{
miner
.
worker
.
register
(
NewCpuMiner
(
i
,
miner
.
pow
))
}
...
...
@@ -44,6 +44,8 @@ func (self *Miner) Mining() bool {
func
(
self
*
Miner
)
Start
()
{
self
.
mining
=
true
self
.
pow
.
(
*
ethash
.
Ethash
)
.
UpdateDAG
()
self
.
worker
.
start
()
self
.
worker
.
commitNewWork
()
...
...
@@ -53,6 +55,8 @@ func (self *Miner) Stop() {
self
.
mining
=
false
self
.
worker
.
stop
()
//self.pow.(*ethash.Ethash).Stop()
}
func
(
self
*
Miner
)
HashRate
()
int64
{
...
...
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