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
5e38f7a6
Unverified
Commit
5e38f7a6
authored
Jul 05, 2017
by
Péter Szilágyi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cmd, core: add --txpool.nolocals to disable local price exemptions
parent
4c1d0b16
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
13 additions
and
2 deletions
+13
-2
main.go
cmd/geth/main.go
+1
-0
usage.go
cmd/geth/usage.go
+1
-0
flags.go
cmd/utils/flags.go
+7
-0
tx_pool.go
core/tx_pool.go
+4
-2
No files found.
cmd/geth/main.go
View file @
5e38f7a6
...
@@ -66,6 +66,7 @@ var (
...
@@ -66,6 +66,7 @@ var (
utils
.
EthashDatasetDirFlag
,
utils
.
EthashDatasetDirFlag
,
utils
.
EthashDatasetsInMemoryFlag
,
utils
.
EthashDatasetsInMemoryFlag
,
utils
.
EthashDatasetsOnDiskFlag
,
utils
.
EthashDatasetsOnDiskFlag
,
utils
.
TxPoolNoLocalsFlag
,
utils
.
TxPoolPriceLimitFlag
,
utils
.
TxPoolPriceLimitFlag
,
utils
.
TxPoolPriceBumpFlag
,
utils
.
TxPoolPriceBumpFlag
,
utils
.
TxPoolAccountSlotsFlag
,
utils
.
TxPoolAccountSlotsFlag
,
...
...
cmd/geth/usage.go
View file @
5e38f7a6
...
@@ -95,6 +95,7 @@ var AppHelpFlagGroups = []flagGroup{
...
@@ -95,6 +95,7 @@ var AppHelpFlagGroups = []flagGroup{
{
{
Name
:
"TRANSACTION POOL"
,
Name
:
"TRANSACTION POOL"
,
Flags
:
[]
cli
.
Flag
{
Flags
:
[]
cli
.
Flag
{
utils
.
TxPoolNoLocalsFlag
,
utils
.
TxPoolPriceLimitFlag
,
utils
.
TxPoolPriceLimitFlag
,
utils
.
TxPoolPriceBumpFlag
,
utils
.
TxPoolPriceBumpFlag
,
utils
.
TxPoolAccountSlotsFlag
,
utils
.
TxPoolAccountSlotsFlag
,
...
...
cmd/utils/flags.go
View file @
5e38f7a6
...
@@ -209,6 +209,10 @@ var (
...
@@ -209,6 +209,10 @@ var (
Value
:
eth
.
DefaultConfig
.
EthashDatasetsOnDisk
,
Value
:
eth
.
DefaultConfig
.
EthashDatasetsOnDisk
,
}
}
// Transaction pool settings
// Transaction pool settings
TxPoolNoLocalsFlag
=
cli
.
BoolFlag
{
Name
:
"txpool.nolocals"
,
Usage
:
"Disables price exemptions for locally submitted transactions"
,
}
TxPoolPriceLimitFlag
=
cli
.
Uint64Flag
{
TxPoolPriceLimitFlag
=
cli
.
Uint64Flag
{
Name
:
"txpool.pricelimit"
,
Name
:
"txpool.pricelimit"
,
Usage
:
"Minimum gas price limit to enforce for acceptance into the pool"
,
Usage
:
"Minimum gas price limit to enforce for acceptance into the pool"
,
...
@@ -831,6 +835,9 @@ func setGPO(ctx *cli.Context, cfg *gasprice.Config) {
...
@@ -831,6 +835,9 @@ func setGPO(ctx *cli.Context, cfg *gasprice.Config) {
}
}
func
setTxPool
(
ctx
*
cli
.
Context
,
cfg
*
core
.
TxPoolConfig
)
{
func
setTxPool
(
ctx
*
cli
.
Context
,
cfg
*
core
.
TxPoolConfig
)
{
if
ctx
.
GlobalIsSet
(
TxPoolNoLocalsFlag
.
Name
)
{
cfg
.
NoLocals
=
ctx
.
GlobalBool
(
TxPoolNoLocalsFlag
.
Name
)
}
if
ctx
.
GlobalIsSet
(
TxPoolPriceLimitFlag
.
Name
)
{
if
ctx
.
GlobalIsSet
(
TxPoolPriceLimitFlag
.
Name
)
{
cfg
.
PriceLimit
=
ctx
.
GlobalUint64
(
TxPoolPriceLimitFlag
.
Name
)
cfg
.
PriceLimit
=
ctx
.
GlobalUint64
(
TxPoolPriceLimitFlag
.
Name
)
}
}
...
...
core/tx_pool.go
View file @
5e38f7a6
...
@@ -99,6 +99,8 @@ type stateFn func() (*state.StateDB, error)
...
@@ -99,6 +99,8 @@ type stateFn func() (*state.StateDB, error)
// TxPoolConfig are the configuration parameters of the transaction pool.
// TxPoolConfig are the configuration parameters of the transaction pool.
type
TxPoolConfig
struct
{
type
TxPoolConfig
struct
{
NoLocals
bool
// Whether local transaction handling should be disabled
PriceLimit
uint64
// Minimum gas price to enforce for acceptance into the pool
PriceLimit
uint64
// Minimum gas price to enforce for acceptance into the pool
PriceBump
uint64
// Minimum price bump percentage to replace an already existing transaction (nonce)
PriceBump
uint64
// Minimum price bump percentage to replace an already existing transaction (nonce)
...
@@ -394,7 +396,7 @@ func (pool *TxPool) validateTx(tx *types.Transaction, local bool) error {
...
@@ -394,7 +396,7 @@ func (pool *TxPool) validateTx(tx *types.Transaction, local bool) error {
}
}
// Drop non-local transactions under our own minimal accepted gas price
// Drop non-local transactions under our own minimal accepted gas price
local
=
local
||
pool
.
locals
.
contains
(
from
)
// account may be local even if the transaction arrived from the network
local
=
local
||
pool
.
locals
.
contains
(
from
)
// account may be local even if the transaction arrived from the network
if
!
local
&&
pool
.
gasPrice
.
Cmp
(
tx
.
GasPrice
())
>
0
{
if
(
!
local
||
pool
.
config
.
NoLocals
)
&&
pool
.
gasPrice
.
Cmp
(
tx
.
GasPrice
())
>
0
{
return
ErrUnderpriced
return
ErrUnderpriced
}
}
// Ensure the transaction adheres to nonce ordering
// Ensure the transaction adheres to nonce ordering
...
@@ -480,7 +482,7 @@ func (pool *TxPool) add(tx *types.Transaction, local bool) (bool, error) {
...
@@ -480,7 +482,7 @@ func (pool *TxPool) add(tx *types.Transaction, local bool) (bool, error) {
if
err
!=
nil
{
if
err
!=
nil
{
return
false
,
err
return
false
,
err
}
}
if
local
{
if
local
&&
!
pool
.
config
.
NoLocals
{
pool
.
locals
.
add
(
from
)
pool
.
locals
.
add
(
from
)
}
}
log
.
Trace
(
"Pooled new future transaction"
,
"hash"
,
hash
,
"from"
,
from
,
"to"
,
tx
.
To
())
log
.
Trace
(
"Pooled new future transaction"
,
"hash"
,
hash
,
"from"
,
from
,
"to"
,
tx
.
To
())
...
...
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