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
e463479b
Commit
e463479b
authored
Mar 13, 2015
by
Felix Lange
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
eth: add ResetWithGenesisBlock
This depends on a change in ethash which exposes UpdateCache.
parent
6f8a2d6b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
4 deletions
+11
-4
backend.go
eth/backend.go
+11
-4
No files found.
eth/backend.go
View file @
e463479b
...
...
@@ -11,6 +11,7 @@ import (
"github.com/ethereum/go-ethereum/accounts"
"github.com/ethereum/go-ethereum/blockpool"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/ethdb"
"github.com/ethereum/go-ethereum/ethutil"
...
...
@@ -123,6 +124,7 @@ type Ethereum struct {
blockPool
*
blockpool
.
BlockPool
accountManager
*
accounts
.
Manager
whisper
*
whisper
.
Whisper
pow
*
ethash
.
Ethash
net
*
p2p
.
Server
eventMux
*
event
.
TypeMux
...
...
@@ -175,16 +177,16 @@ func New(config *Config) (*Ethereum, error) {
}
eth
.
chainManager
=
core
.
NewChainManager
(
blockDb
,
stateDb
,
eth
.
EventMux
())
pow
:
=
ethash
.
New
(
eth
.
chainManager
)
eth
.
pow
=
ethash
.
New
(
eth
.
chainManager
)
eth
.
txPool
=
core
.
NewTxPool
(
eth
.
EventMux
())
eth
.
blockProcessor
=
core
.
NewBlockProcessor
(
stateDb
,
pow
,
eth
.
txPool
,
eth
.
chainManager
,
eth
.
EventMux
())
eth
.
blockProcessor
=
core
.
NewBlockProcessor
(
stateDb
,
eth
.
pow
,
eth
.
txPool
,
eth
.
chainManager
,
eth
.
EventMux
())
eth
.
chainManager
.
SetProcessor
(
eth
.
blockProcessor
)
eth
.
whisper
=
whisper
.
New
()
eth
.
miner
=
miner
.
New
(
eth
,
pow
,
config
.
MinerThreads
)
eth
.
miner
=
miner
.
New
(
eth
,
eth
.
pow
,
config
.
MinerThreads
)
hasBlock
:=
eth
.
chainManager
.
HasBlock
insertChain
:=
eth
.
chainManager
.
InsertChain
eth
.
blockPool
=
blockpool
.
New
(
hasBlock
,
insertChain
,
pow
.
Verify
)
eth
.
blockPool
=
blockpool
.
New
(
hasBlock
,
insertChain
,
eth
.
pow
.
Verify
)
netprv
,
err
:=
config
.
nodeKey
()
if
err
!=
nil
{
...
...
@@ -214,6 +216,11 @@ func New(config *Config) (*Ethereum, error) {
return
eth
,
nil
}
func
(
s
*
Ethereum
)
ResetWithGenesisBlock
(
gb
*
types
.
Block
)
{
s
.
chainManager
.
ResetWithGenesisBlock
(
gb
)
s
.
pow
.
UpdateCache
(
true
)
}
func
(
s
*
Ethereum
)
StartMining
()
error
{
cb
,
err
:=
s
.
accountManager
.
Coinbase
()
if
err
!=
nil
{
...
...
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