Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
plugin
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
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
link33
plugin
Commits
05b350a0
Commit
05b350a0
authored
Feb 28, 2019
by
陈德海
Committed by
vipwzw
Mar 01, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix mempool price score
parent
f64d40a4
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
50 additions
and
40 deletions
+50
-40
chain33.toml
chain33.toml
+1
-7
chain33.test.toml
plugin/consensus/raft/chain33.test.toml
+13
-0
chain33.test.toml
plugin/mempool/price/chain33.test.toml
+1
-7
mempool.go
plugin/mempool/price/mempool.go
+0
-2
chain33.test.toml
plugin/mempool/score/chain33.test.toml
+4
-5
mempool.go
plugin/mempool/score/mempool.go
+0
-2
chain33.test.toml
vendor/github.com/33cn/chain33/cmd/chain33/chain33.test.toml
+7
-8
chain33.toml
vendor/github.com/33cn/chain33/cmd/chain33/chain33.toml
+7
-8
check.go
vendor/github.com/33cn/chain33/system/mempool/check.go
+1
-1
mempool_test.go
...or/github.com/33cn/chain33/system/mempool/mempool_test.go
+16
-0
No files found.
chain33.toml
View file @
05b350a0
...
@@ -65,25 +65,19 @@ grpcFuncWhitelist=["*"]
...
@@ -65,25 +65,19 @@ grpcFuncWhitelist=["*"]
name
=
"timeline"
name
=
"timeline"
poolCacheSize
=
10240
poolCacheSize
=
10240
minTxFee
=
100000
minTxFee
=
100000
maxTxNumPerAccount
=
100
00
maxTxNumPerAccount
=
100
[mempool.sub.timeline]
[mempool.sub.timeline]
poolCacheSize
=
10240
poolCacheSize
=
10240
minTxFee
=
100000
maxTxNumPerAccount
=
10000
[mempool.sub.score]
[mempool.sub.score]
poolCacheSize
=
10240
poolCacheSize
=
10240
minTxFee
=
100000
maxTxNumPerAccount
=
10000
timeParam
=
1
#时间占价格比例
timeParam
=
1
#时间占价格比例
priceConstant
=
1544
#手续费相对于时间的一个合适的常量,取当前unxi时间戳前四位数,排序时手续费高1e-5~=快1s
priceConstant
=
1544
#手续费相对于时间的一个合适的常量,取当前unxi时间戳前四位数,排序时手续费高1e-5~=快1s
pricePower
=
1
#常量比例
pricePower
=
1
#常量比例
[mempool.sub.price]
[mempool.sub.price]
poolCacheSize
=
10240
poolCacheSize
=
10240
minTxFee
=
100000
maxTxNumPerAccount
=
10000
[consensus]
[consensus]
name
=
"ticket"
name
=
"ticket"
...
...
plugin/consensus/raft/chain33.test.toml
View file @
05b350a0
...
@@ -62,6 +62,19 @@ grpcFuncWhitelist=["*"]
...
@@ -62,6 +62,19 @@ grpcFuncWhitelist=["*"]
name
=
"timeline"
name
=
"timeline"
poolCacheSize
=
10240
poolCacheSize
=
10240
minTxFee
=
100000
minTxFee
=
100000
maxTxNumPerAccount
=
100
[mempool.sub.timeline]
poolCacheSize
=
10240
[mempool.sub.score]
poolCacheSize
=
10240
timeParam
=
1
#时间占价格比例
priceConstant
=
1544
#手续费相对于时间的一个合适的常量,取当前unxi时间戳前四位数,排序时手续费高1e-5~=快1s
pricePower
=
1
#常量比例
[mempool.sub.price]
poolCacheSize
=
10240
[consensus]
[consensus]
# 共识驱动名,支持solo/raft/ticket/tendermint/pbft
# 共识驱动名,支持solo/raft/ticket/tendermint/pbft
...
...
plugin/mempool/price/chain33.test.toml
View file @
05b350a0
...
@@ -67,25 +67,19 @@ keyFile="key.pem"
...
@@ -67,25 +67,19 @@ keyFile="key.pem"
name
=
"price"
name
=
"price"
poolCacheSize
=
10240
poolCacheSize
=
10240
minTxFee
=
100000
minTxFee
=
100000
maxTxNumPerAccount
=
100
00
maxTxNumPerAccount
=
100
[mempool.sub.timeline]
[mempool.sub.timeline]
poolCacheSize
=
10240
poolCacheSize
=
10240
minTxFee
=
100000
maxTxNumPerAccount
=
10000
[mempool.sub.score]
[mempool.sub.score]
poolCacheSize
=
10240
poolCacheSize
=
10240
minTxFee
=
100000
maxTxNumPerAccount
=
10000
timeParam
=
1
#时间占价格比例
timeParam
=
1
#时间占价格比例
priceConstant
=
1544
#手续费相对于时间的一个合适的常量,取当前unxi时间戳前四位数,排序时手续费高1e-5~=快1s
priceConstant
=
1544
#手续费相对于时间的一个合适的常量,取当前unxi时间戳前四位数,排序时手续费高1e-5~=快1s
pricePower
=
1
#常量比例
pricePower
=
1
#常量比例
[mempool.sub.price]
[mempool.sub.price]
poolCacheSize
=
10240
poolCacheSize
=
10240
minTxFee
=
100000
maxTxNumPerAccount
=
10000
[consensus]
[consensus]
name
=
"solo"
name
=
"solo"
...
...
plugin/mempool/price/mempool.go
View file @
05b350a0
...
@@ -11,8 +11,6 @@ import (
...
@@ -11,8 +11,6 @@ import (
type
subConfig
struct
{
type
subConfig
struct
{
PoolCacheSize
int64
`json:"poolCacheSize"`
PoolCacheSize
int64
`json:"poolCacheSize"`
MinTxFee
int64
`json:"minTxFee"`
MaxTxNumPerAccount
int64
`json:"maxTxNumPerAccount"`
}
}
func
init
()
{
func
init
()
{
...
...
plugin/mempool/score/chain33.test.toml
View file @
05b350a0
...
@@ -67,21 +67,20 @@ keyFile="key.pem"
...
@@ -67,21 +67,20 @@ keyFile="key.pem"
name
=
"score"
name
=
"score"
poolCacheSize
=
10240
poolCacheSize
=
10240
minTxFee
=
100000
minTxFee
=
100000
maxTxNumPerAccount
=
100
00
maxTxNumPerAccount
=
100
[mempool.sub.timeline]
[mempool.sub.timeline]
poolCacheSize
=
10240
poolCacheSize
=
10240
minTxFee
=
100000
maxTxNumPerAccount
=
10000
[mempool.sub.score]
[mempool.sub.score]
poolCacheSize
=
10240
poolCacheSize
=
10240
minTxFee
=
100000
maxTxNumPerAccount
=
10000
timeParam
=
1
#时间占价格比例
timeParam
=
1
#时间占价格比例
priceConstant
=
1544
#手续费相对于时间的一个合适的常量,取当前unxi时间戳前四位数,排队时手续费高1e-5的分数~=快1s的分数
priceConstant
=
1544
#手续费相对于时间的一个合适的常量,取当前unxi时间戳前四位数,排队时手续费高1e-5的分数~=快1s的分数
pricePower
=
1
#常量比例
pricePower
=
1
#常量比例
[mempool.sub.price]
poolCacheSize
=
10240
[consensus]
[consensus]
name
=
"solo"
name
=
"solo"
minerstart
=
true
minerstart
=
true
...
...
plugin/mempool/score/mempool.go
View file @
05b350a0
...
@@ -11,8 +11,6 @@ import (
...
@@ -11,8 +11,6 @@ import (
type
subConfig
struct
{
type
subConfig
struct
{
PoolCacheSize
int64
`json:"poolCacheSize"`
PoolCacheSize
int64
`json:"poolCacheSize"`
MinTxFee
int64
`json:"minTxFee"`
MaxTxNumPerAccount
int64
`json:"maxTxNumPerAccount"`
TimeParam
int64
`json:"timeParam"`
TimeParam
int64
`json:"timeParam"`
PriceConstant
int64
`json:"priceConstant"`
PriceConstant
int64
`json:"priceConstant"`
PricePower
int64
`json:"pricePower"`
PricePower
int64
`json:"pricePower"`
...
...
vendor/github.com/33cn/chain33/cmd/chain33/chain33.test.toml
View file @
05b350a0
...
@@ -67,20 +67,19 @@ keyFile="key.pem"
...
@@ -67,20 +67,19 @@ keyFile="key.pem"
name
=
"timeline"
name
=
"timeline"
poolCacheSize
=
10240
poolCacheSize
=
10240
minTxFee
=
100000
minTxFee
=
100000
maxTxNumPerAccount
=
100
00
maxTxNumPerAccount
=
100
[mempool.sub.timeline]
[mempool.sub.timeline]
poolCacheSize
=
10240
poolCacheSize
=
10240
minTxFee
=
100000
maxTxNumPerAccount
=
10000
[mempool.sub.
trad
e]
[mempool.sub.
scor
e]
poolCacheSize
=
10240
poolCacheSize
=
10240
minTxFee
=
100000
maxTxNumPerAccount
=
10000
timeParam
=
1
#时间占价格比例
timeParam
=
1
#时间占价格比例
priceConstant
=
1
#一个合适的常量
priceConstant
=
1544
#手续费相对于时间的一个合适的常量,取当前unxi时间戳前四位数,排序时手续费高1e-5~=快1s
pricePower
=
0
#手续费占常量比例
pricePower
=
1
#常量比例
[mempool.sub.price]
poolCacheSize
=
10240
[consensus]
[consensus]
name
=
"solo"
name
=
"solo"
...
...
vendor/github.com/33cn/chain33/cmd/chain33/chain33.toml
View file @
05b350a0
...
@@ -67,20 +67,19 @@ keyFile="key.pem"
...
@@ -67,20 +67,19 @@ keyFile="key.pem"
name
=
"timeline"
name
=
"timeline"
poolCacheSize
=
10240
poolCacheSize
=
10240
minTxFee
=
100000
minTxFee
=
100000
maxTxNumPerAccount
=
100
00
maxTxNumPerAccount
=
100
[mempool.sub.timeline]
[mempool.sub.timeline]
poolCacheSize
=
10240
poolCacheSize
=
10240
minTxFee
=
100000
maxTxNumPerAccount
=
10000
[mempool.sub.
trad
e]
[mempool.sub.
scor
e]
poolCacheSize
=
10240
poolCacheSize
=
10240
minTxFee
=
100000
maxTxNumPerAccount
=
10000
timeParam
=
1
#时间占价格比例
timeParam
=
1
#时间占价格比例
priceConstant
=
1
#一个合适的常量
priceConstant
=
1544
#手续费相对于时间的一个合适的常量,取当前unxi时间戳前四位数,排序时手续费高1e-5~=快1s
pricePower
=
0
#手续费占常量比例
pricePower
=
1
#常量比例
[mempool.sub.price]
poolCacheSize
=
10240
[consensus]
[consensus]
name
=
"solo"
name
=
"solo"
...
...
vendor/github.com/33cn/chain33/system/mempool/check.go
View file @
05b350a0
...
@@ -63,7 +63,7 @@ func (mem *Mempool) checkTx(msg *queue.Message) *queue.Message {
...
@@ -63,7 +63,7 @@ func (mem *Mempool) checkTx(msg *queue.Message) *queue.Message {
}
}
// 检查交易账户在mempool中是否存在过多交易
// 检查交易账户在mempool中是否存在过多交易
from
:=
tx
.
From
()
from
:=
tx
.
From
()
if
mem
.
TxNumOfAccount
(
from
)
>=
maxTxNumPerAccount
{
if
mem
.
TxNumOfAccount
(
from
)
>=
m
em
.
cfg
.
M
axTxNumPerAccount
{
msg
.
Data
=
types
.
ErrManyTx
msg
.
Data
=
types
.
ErrManyTx
return
msg
return
msg
}
}
...
...
vendor/github.com/33cn/chain33/system/mempool/mempool_test.go
View file @
05b350a0
...
@@ -439,6 +439,22 @@ func TestAddMoreTxThanPoolSize(t *testing.T) {
...
@@ -439,6 +439,22 @@ func TestAddMoreTxThanPoolSize(t *testing.T) {
}
}
}
}
func
TestAddMoreTxThanMaxAccountTx
(
t
*
testing
.
T
)
{
q
,
mem
:=
initEnv
(
4
)
mem
.
cfg
.
MaxTxNumPerAccount
=
2
defer
q
.
Close
()
defer
mem
.
Close
()
err
:=
add4Tx
(
mem
.
client
)
if
err
!=
nil
{
t
.
Error
(
"add tx error"
,
err
.
Error
())
return
}
if
mem
.
Size
()
!=
2
{
t
.
Error
(
"TestAddMoreTxThanMaxAccountTx failed"
,
"size"
,
mem
.
Size
())
}
}
func
TestRemoveTxOfBlock
(
t
*
testing
.
T
)
{
func
TestRemoveTxOfBlock
(
t
*
testing
.
T
)
{
q
,
mem
:=
initEnv
(
0
)
q
,
mem
:=
initEnv
(
0
)
defer
q
.
Close
()
defer
q
.
Close
()
...
...
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