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
c2a494c7
Unverified
Commit
c2a494c7
authored
May 29, 2017
by
Péter Szilágyi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
eth: update default gas price when not mining too
parent
cb809c03
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
10 deletions
+24
-10
api.go
eth/api.go
+9
-1
backend.go
eth/backend.go
+15
-9
No files found.
eth/api.go
View file @
c2a494c7
...
...
@@ -154,7 +154,11 @@ func (api *PrivateMinerAPI) Start(threads *int) error {
// Start the miner and return
if
!
api
.
e
.
IsMining
()
{
// Propagate the initial price point to the transaction pool
api
.
e
.
txPool
.
SetGasPrice
(
api
.
e
.
gasPrice
)
api
.
e
.
lock
.
RLock
()
price
:=
api
.
e
.
gasPrice
api
.
e
.
lock
.
RUnlock
()
api
.
e
.
txPool
.
SetGasPrice
(
price
)
return
api
.
e
.
StartMining
(
true
)
}
return
nil
...
...
@@ -182,6 +186,10 @@ func (api *PrivateMinerAPI) SetExtra(extra string) (bool, error) {
// SetGasPrice sets the minimum accepted gas price for the miner.
func
(
api
*
PrivateMinerAPI
)
SetGasPrice
(
gasPrice
hexutil
.
Big
)
bool
{
api
.
e
.
lock
.
Lock
()
api
.
e
.
gasPrice
=
(
*
big
.
Int
)(
&
gasPrice
)
api
.
e
.
lock
.
Unlock
()
api
.
e
.
txPool
.
SetGasPrice
((
*
big
.
Int
)(
&
gasPrice
))
return
true
}
...
...
eth/backend.go
View file @
c2a494c7
...
...
@@ -76,14 +76,14 @@ type Ethereum struct {
ApiBackend
*
EthApiBackend
miner
*
miner
.
Miner
gasPrice
*
big
.
Int
Mining
bool
MinerThreads
int
etherbase
common
.
Address
miner
*
miner
.
Miner
gasPrice
*
big
.
Int
etherbase
common
.
Address
networkId
uint64
netRPCService
*
ethapi
.
PublicNetAPI
lock
sync
.
RWMutex
// Protects the variadic fields (e.g. gas price and etherbase)
}
func
(
s
*
Ethereum
)
AddLesServer
(
ls
LesServer
)
{
...
...
@@ -121,8 +121,8 @@ func New(ctx *node.ServiceContext, config *Config) (*Ethereum, error) {
shutdownChan
:
make
(
chan
bool
),
stopDbUpgrade
:
stopDbUpgrade
,
networkId
:
config
.
NetworkId
,
gasPrice
:
config
.
GasPrice
,
etherbase
:
config
.
Etherbase
,
MinerThreads
:
config
.
MinerThreads
,
}
if
err
:=
addMipmapBloomBins
(
chainDb
);
err
!=
nil
{
...
...
@@ -169,7 +169,6 @@ func New(ctx *node.ServiceContext, config *Config) (*Ethereum, error) {
}
eth
.
miner
=
miner
.
New
(
eth
,
eth
.
chainConfig
,
eth
.
EventMux
(),
eth
.
engine
)
eth
.
gasPrice
=
config
.
GasPrice
eth
.
miner
.
SetExtra
(
makeExtraData
(
config
.
ExtraData
))
eth
.
ApiBackend
=
&
EthApiBackend
{
eth
,
nil
}
...
...
@@ -295,8 +294,12 @@ func (s *Ethereum) ResetWithGenesisBlock(gb *types.Block) {
}
func
(
s
*
Ethereum
)
Etherbase
()
(
eb
common
.
Address
,
err
error
)
{
if
s
.
etherbase
!=
(
common
.
Address
{})
{
return
s
.
etherbase
,
nil
s
.
lock
.
RLock
()
etherbase
:=
s
.
etherbase
s
.
lock
.
RUnlock
()
if
etherbase
!=
(
common
.
Address
{})
{
return
etherbase
,
nil
}
if
wallets
:=
s
.
AccountManager
()
.
Wallets
();
len
(
wallets
)
>
0
{
if
accounts
:=
wallets
[
0
]
.
Accounts
();
len
(
accounts
)
>
0
{
...
...
@@ -308,7 +311,10 @@ func (s *Ethereum) Etherbase() (eb common.Address, err error) {
// set in js console via admin interface or wrapper from cli flags
func
(
self
*
Ethereum
)
SetEtherbase
(
etherbase
common
.
Address
)
{
self
.
lock
.
Lock
()
self
.
etherbase
=
etherbase
self
.
lock
.
Unlock
()
self
.
miner
.
SetEtherbase
(
etherbase
)
}
...
...
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