Commit c093f7a4 authored by liuyuhang's avatar liuyuhang Committed by 33cn

modify linter

parent e9985ab0
......@@ -255,7 +255,7 @@ func ShowProposalBoardCmd() *cobra.Command {
}
func addShowProposalBoardflags(cmd *cobra.Command) {
cmd.Flags().Uint32P("type", "t", 0, "type(0:query by hash; 1:list)")
cmd.Flags().Uint32P("type", "y", 0, "type(0:query by hash; 1:list)")
cmd.MarkFlagRequired("type")
cmd.Flags().StringP("proposalID", "p", "", "proposal ID")
......@@ -264,7 +264,7 @@ func addShowProposalBoardflags(cmd *cobra.Command) {
cmd.Flags().StringP("addr", "a", "", "address")
cmd.Flags().Int32P("count", "c", 1, "count, default is 1")
cmd.Flags().Int32P("direction", "d", -1, "direction, default is reserve")
cmd.Flags().Int64P("height", "h", -1, "height, default is -1")
cmd.Flags().Int64P("height", "t", -1, "height, default is -1")
cmd.Flags().Int32P("index", "i", -1, "index, default is -1")
}
......
......@@ -282,7 +282,7 @@ func ShowProposalProjectCmd() *cobra.Command {
}
func addShowProposalProjectflags(cmd *cobra.Command) {
cmd.Flags().Uint32P("type", "t", 0, "type(0:query by hash; 1:list)")
cmd.Flags().Uint32P("type", "y", 0, "type(0:query by hash; 1:list)")
cmd.MarkFlagRequired("type")
cmd.Flags().StringP("proposalID", "p", "", "proposal ID")
......@@ -291,7 +291,7 @@ func addShowProposalProjectflags(cmd *cobra.Command) {
cmd.Flags().StringP("addr", "a", "", "address")
cmd.Flags().Int32P("count", "c", 1, "count, default is 1")
cmd.Flags().Int32P("direction", "d", -1, "direction, default is reserve")
cmd.Flags().Int64P("height", "h", -1, "height, default is -1")
cmd.Flags().Int64P("height", "t", -1, "height, default is -1")
cmd.Flags().Int32P("index", "i", -1, "index, default is -1")
}
......
......@@ -222,7 +222,7 @@ func ShowProposalRuleCmd() *cobra.Command {
}
func addShowProposalRuleflags(cmd *cobra.Command) {
cmd.Flags().Uint32P("type", "t", 0, "type(0:query by hash; 1:list)")
cmd.Flags().Uint32P("type", "y", 0, "type(0:query by hash; 1:list)")
cmd.MarkFlagRequired("type")
cmd.Flags().StringP("proposalID", "p", "", "proposal ID")
......@@ -231,7 +231,7 @@ func addShowProposalRuleflags(cmd *cobra.Command) {
cmd.Flags().StringP("addr", "a", "", "address")
cmd.Flags().Int32P("count", "c", 1, "count, default is 1")
cmd.Flags().Int32P("direction", "d", -1, "direction, default is reserve")
cmd.Flags().Int64P("height", "h", -1, "height, default is -1")
cmd.Flags().Int64P("height", "t", -1, "height, default is -1")
cmd.Flags().Int32P("index", "i", -1, "index, default is -1")
}
......@@ -373,7 +373,7 @@ func addShowProposalCommentflags(cmd *cobra.Command) {
cmd.MarkFlagRequired("proposalID")
cmd.Flags().Int32P("count", "c", 1, "count, default is 1")
cmd.Flags().Int32P("direction", "d", -1, "direction, default is reserve")
cmd.Flags().Int64P("height", "h", -1, "height, default is -1")
cmd.Flags().Int64P("height", "t", -1, "height, default is -1")
cmd.Flags().Int64P("index", "i", -1, "index, default is -1")
}
......
......@@ -5,8 +5,6 @@
package executor
import (
"fmt"
"github.com/33cn/chain33/system/dapp"
"github.com/33cn/chain33/types"
auty "github.com/33cn/plugin/plugin/dapp/autonomy/types"
......@@ -130,6 +128,10 @@ func (a *Autonomy) listProposalBoard(req *auty.ReqQueryProposalBoard) (types.Mes
cur.Height = req.Height
cur.Index = req.Index
prefix, err := cur.Get(indexName)
if err != nil {
alog.Error("Get", "indexName", indexName, "err", err)
return nil, err
}
rows, err := query.ListIndex(indexName, prefix, primary, req.Count, req.Direction)
if err != nil {
......@@ -151,7 +153,3 @@ func (a *Autonomy) listProposalBoard(req *auty.ReqQueryProposalBoard) (types.Mes
}
return &rep, nil
}
func genHeightIndexStr(index int64) string {
return fmt.Sprintf("%018d", index)
}
......@@ -326,7 +326,10 @@ func checkExecLocalBoard(t *testing.T, kvdb db.KVDB, cur *auty.AutonomyProposalB
prop, ok := rows[0].Data.(*auty.AutonomyProposalBoard)
assert.Equal(t, true, ok)
assert.Equal(t, prop, cur)
assert.Equal(t, prop.Status, cur.Status)
assert.Equal(t, prop.Address, cur.Address)
assert.Equal(t, prop.Height, cur.Height)
assert.Equal(t, prop.Index, cur.Index)
}
......
......@@ -24,7 +24,7 @@ var boardOpt = &table.Option{
Index: []string{"addr", "status", "addr_status"},
}
//NewTable 新建表
//NewBoardTable 新建表
func NewBoardTable(kvdb db.KV) *table.Table {
rowmeta := NewBoardRow()
table, err := table.NewTable(rowmeta, kvdb, boardOpt)
......
......@@ -24,7 +24,6 @@ func votesRecord(txHash string) []byte {
var (
// board
boardPrefix = idPrefix + "board" + "-"
localBoardPrefix = localPrefix + "board" + "-"
boardVotesRecordPrefix = boardPrefix + "vote" + "-"
)
......@@ -40,30 +39,18 @@ func boardVotesRecord(txHash string) []byte {
return []byte(fmt.Sprintf("%s%s", boardVotesRecordPrefix, txHash))
}
func calcBoardKey4StatusHeight(status int32, heightindex string) []byte {
key := fmt.Sprintf(localBoardPrefix+"%d-"+"%s", status, heightindex)
return []byte(key)
}
var (
// project
projectPrefix = idPrefix + "project" + "-"
localProjectPrefix = localPrefix + "project" + "-"
)
func propProjectID(txHash string) []byte {
return []byte(fmt.Sprintf("%s%s", projectPrefix, txHash))
}
func calcProjectKey4StatusHeight(status int32, heightindex string) []byte {
key := fmt.Sprintf(localProjectPrefix+"%d-"+"%s", status, heightindex)
return []byte(key)
}
var (
// rule
rulePrefix = idPrefix + "rule" + "-"
localRulePrefix = localPrefix + "rule" + "-"
)
func activeRuleID() []byte {
......@@ -74,11 +61,6 @@ func propRuleID(txHash string) []byte {
return []byte(fmt.Sprintf("%s%s", rulePrefix, txHash))
}
func calcRuleKey4StatusHeight(status int32, heightindex string) []byte {
key := fmt.Sprintf(localRulePrefix+"%d-"+"%s", status, heightindex)
return []byte(key)
}
var (
// comment
localCommentPrefix = localPrefix + "cmt" + "-"
......
......@@ -128,6 +128,10 @@ func (a *Autonomy) listProposalProject(req *auty.ReqQueryProposalProject) (types
cur.Height = req.Height
cur.Index = req.Index
prefix, err := cur.Get(indexName)
if err != nil {
alog.Error("Get", "indexName", indexName, "err", err)
return nil, err
}
rows, err := query.ListIndex(indexName, prefix, primary, req.Count, req.Direction)
if err != nil {
......
......@@ -332,6 +332,9 @@ func checkExecLocalProject(t *testing.T, kvdb db.KVDB, cur *auty.AutonomyProposa
prop, ok := rows[0].Data.(*auty.AutonomyProposalProject)
assert.Equal(t, true, ok)
assert.Equal(t, prop, cur)
assert.Equal(t, prop.Status, cur.Status)
assert.Equal(t, prop.Address, cur.Address)
assert.Equal(t, prop.Height, cur.Height)
assert.Equal(t, prop.Index, cur.Index)
}
......@@ -24,7 +24,7 @@ var projectOpt = &table.Option{
Index: []string{"addr", "status", "addr_status"},
}
//NewTable 新建表
//NewProjectTable 新建表
func NewProjectTable(kvdb db.KV) *table.Table {
rowmeta := NewProjectRow()
table, err := table.NewTable(rowmeta, kvdb, projectOpt)
......
......@@ -127,6 +127,10 @@ func (a *Autonomy) listProposalRule(req *auty.ReqQueryProposalRule) (types.Messa
cur.Height = req.Height
cur.Index = req.Index
prefix, err := cur.Get(indexName)
if err != nil {
alog.Error("Get", "indexName", indexName, "err", err)
return nil, err
}
rows, err := query.ListIndex(indexName, prefix, primary, req.Count, req.Direction)
if err != nil {
......
......@@ -192,7 +192,10 @@ func checkExecLocalRule(t *testing.T, kvdb db.KVDB, cur *auty.AutonomyProposalRu
prop, ok := rows[0].Data.(*auty.AutonomyProposalRule)
assert.Equal(t, true, ok)
assert.Equal(t, prop, cur)
assert.Equal(t, prop.Status, cur.Status)
assert.Equal(t, prop.Address, cur.Address)
assert.Equal(t, prop.Height, cur.Height)
assert.Equal(t, prop.Index, cur.Index)
}
......
......@@ -24,7 +24,7 @@ var ruleOpt = &table.Option{
Index: []string{"addr", "status", "addr_status"},
}
//NewTable 新建表
//NewRuleTable 新建表
func NewRuleTable(kvdb db.KV) *table.Table {
rowmeta := NewRuleRow()
table, err := table.NewTable(rowmeta, kvdb, ruleOpt)
......
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