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
cf2b8c06
Commit
cf2b8c06
authored
Oct 22, 2019
by
jiangpeng
Committed by
33cn
Oct 25, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mempool-price: update get proper fee
parent
8951f19a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
5 deletions
+14
-5
cache.go
plugin/mempool/price/cache.go
+1
-1
cache_test.go
plugin/mempool/price/cache_test.go
+13
-4
No files found.
plugin/mempool/price/cache.go
View file @
cf2b8c06
...
...
@@ -70,7 +70,7 @@ func (cache *Queue) Walk(count int, cb func(tx *mempool.Item) bool) {
func
(
cache
*
Queue
)
GetProperFee
()
int64
{
var
sumFeeRate
int64
var
properFeeRate
int64
if
cache
.
Size
()
==
0
{
if
cache
.
Size
()
<
10
0
{
return
cache
.
subConfig
.
ProperFee
}
i
:=
0
...
...
plugin/mempool/price/cache_test.go
View file @
cf2b8c06
...
...
@@ -41,7 +41,7 @@ var (
func
initEnv
(
size
int64
)
*
Queue
{
if
size
==
0
{
size
=
100
size
=
100
0
}
_
,
sub
:=
types
.
InitCfg
(
"chain33.test.toml"
)
var
subcfg
subConfig
...
...
@@ -161,14 +161,23 @@ func TestGetProperFee(t *testing.T) {
txs
,
err
:=
types
.
CreateTxGroup
([]
*
types
.
Transaction
{
tx2
,
tx3
,
tx5
},
1200000
)
assert
.
NoError
(
t
,
err
)
tx
:=
txs
.
Tx
()
groupItem
:=
&
drivers
.
Item
{
Value
:
txs
.
Tx
(),
Priority
:
tx
.
Fee
,
EnterTime
:
types
.
Now
()
.
Unix
()
-
1000
}
groupItem
:=
&
drivers
.
Item
{
Value
:
tx
,
Priority
:
tx
.
Fee
,
EnterTime
:
item1
.
EnterTime
-
1
}
assert
.
Equal
(
t
,
cache
.
subConfig
.
ProperFee
,
cache
.
GetProperFee
())
cache
.
Push
(
item1
)
cache
.
Push
(
item4
)
cache
.
Push
(
groupItem
)
assert
.
NoError
(
t
,
cache
.
Push
(
groupItem
))
for
i
:=
0
;
i
<
97
;
i
++
{
item
:=
*
item1
tempTx
:=
*
item1
.
Value
item
.
Value
=
&
tempTx
item
.
Value
.
Nonce
=
int64
(
i
+
1
)
assert
.
NoError
(
t
,
cache
.
Push
(
&
item
))
}
properFee
:=
cache
.
GetProperFee
()
feeRate1
:=
item1
.
Value
.
Fee
/
int64
(
proto
.
Size
(
item1
.
Value
)
/
1000
+
1
)
feeRate2
:=
item4
.
Value
.
Fee
/
int64
(
proto
.
Size
(
item4
.
Value
)
/
1000
+
1
)
assert
.
Equal
(
t
,
(
feeRate1
+
feeRate2
+
1200000
)
/
3
,
properFee
)
t
.
Log
(
feeRate1
,
feeRate2
)
assert
.
Equal
(
t
,
(
feeRate1
*
98
+
feeRate2
+
1200000
)
/
100
,
properFee
)
}
func
TestRealNodeMempool
(
t
*
testing
.
T
)
{
...
...
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