Commit 0bcfc1bd authored by vipwzw's avatar vipwzw

auto ci

parent 8e35dc9d
...@@ -26,7 +26,7 @@ func NewQueue(subcfg subConfig) *Queue { ...@@ -26,7 +26,7 @@ func NewQueue(subcfg subConfig) *Queue {
} }
func (cache *Queue) newSkipValue(item *mempool.Item) (*skiplist.SkipValue, error) { func (cache *Queue) newSkipValue(item *mempool.Item) (*skiplist.SkipValue, error) {
txSize:=proto.Size(item.Value) txSize := proto.Size(item.Value)
return &skiplist.SkipValue{Score: item.Value.Fee / int64(txSize), Value: item}, nil return &skiplist.SkipValue{Score: item.Value.Fee / int64(txSize), Value: item}, nil
} }
...@@ -136,8 +136,8 @@ func (cache *Queue) GetProperFee() int64 { ...@@ -136,8 +136,8 @@ func (cache *Queue) GetProperFee() int64 {
if i == 100 { if i == 100 {
return false return false
} }
txSize=proto.Size(tx.(*mempool.Item).Value) txSize = proto.Size(tx.(*mempool.Item).Value)
feeRate=tx.(*mempool.Item).Value.Fee/int64(txSize/1000+1) feeRate = tx.(*mempool.Item).Value.Fee / int64(txSize/1000+1)
sumFeeRate += feeRate sumFeeRate += feeRate
i++ i++
return true return true
......
...@@ -9,8 +9,8 @@ import ( ...@@ -9,8 +9,8 @@ import (
cty "github.com/33cn/chain33/system/dapp/coins/types" cty "github.com/33cn/chain33/system/dapp/coins/types"
drivers "github.com/33cn/chain33/system/mempool" drivers "github.com/33cn/chain33/system/mempool"
"github.com/33cn/chain33/types" "github.com/33cn/chain33/types"
"github.com/stretchr/testify/assert"
"github.com/golang/protobuf/proto" "github.com/golang/protobuf/proto"
"github.com/stretchr/testify/assert"
) )
var ( var (
...@@ -158,7 +158,7 @@ func TestGetProperFee(t *testing.T) { ...@@ -158,7 +158,7 @@ func TestGetProperFee(t *testing.T) {
cache.Push(item1) cache.Push(item1)
cache.Push(item4) cache.Push(item4)
cache.GetProperFee() cache.GetProperFee()
txSize1:=proto.Size(item1.Value) txSize1 := proto.Size(item1.Value)
txSize2:=proto.Size(item4.Value) txSize2 := proto.Size(item4.Value)
assert.Equal(t, (item1.Value.Fee/int64(txSize1/1000+1)+item4.Value.Fee/int64(txSize2/1000+1))/2,cache.GetProperFee()) assert.Equal(t, (item1.Value.Fee/int64(txSize1/1000+1)+item4.Value.Fee/int64(txSize2/1000+1))/2, cache.GetProperFee())
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment