Commit 761c0efd authored by liuyuhang's avatar liuyuhang Committed by 33cn

plugin makefile中加入了 自动ineffassign检查

parent b2ebdcd4
......@@ -13,6 +13,7 @@ CHAIN33_PATH=vendor/${CHAIN33}
LDFLAGS := -ldflags "-w -s"
PKG_LIST_VET := `go list ./... | grep -v "vendor" | grep -v plugin/dapp/evm/executor/vm/common/crypto/bn256`
PKG_LIST := `go list ./... | grep -v "vendor" | grep -v "chain33/test" | grep -v "mocks" | grep -v "pbft"`
PKG_LIST_INEFFASSIGN= `go list -f {{.Dir}} ./... | grep -v "vendor"`
BUILD_FLAGS = -ldflags "-X github.com/33cn/chain33/common/version.GitCommit=`git rev-parse --short=8 HEAD`"
MKPATH=$(abspath $(lastword $(MAKEFILE_LIST)))
MKDIR=$(dir $(MKPATH))
......@@ -73,7 +74,7 @@ updatevendor:
dep:
dep init -v
linter: vet ## Use gometalinter check code, ignore some unserious warning
linter: vet ineffassign ## Use gometalinter check code, ignore some unserious warning
@./golinter.sh "filter"
@find . -name '*.sh' -not -path "./vendor/*" | xargs shellcheck
......@@ -81,6 +82,9 @@ linter_test: ## Use gometalinter check code, for local test
@./golinter.sh "test" "${p}"
@find . -name '*.sh' -not -path "./vendor/*" | xargs shellcheck
ineffassign:
@ineffassign -n ${PKG_LIST_INEFFASSIGN}
race: ## Run data race detector
@go test -race -short $(PKG_LIST)
......
......@@ -511,7 +511,6 @@ func (action *Action) GetCalculableHash(beg, end int64, randMolNum int64) ([]byt
timeSource := int64(0)
total := int64(0)
//last := []byte("last")
newmodify := ""
for i := beg; i < end; i += randMolNum {
req := &types.ReqBlocks{Start: i, End: i, IsDetail: false, Pid: []string{""}}
blocks, err := action.api.GetBlocks(req)
......@@ -542,7 +541,7 @@ func (action *Action) GetCalculableHash(beg, end int64, randMolNum int64) ([]byt
ticketIds += ticketAction.GetMiner().GetTicketId()
}
newmodify = fmt.Sprintf("%s:%s:%d:%d", string(modifies), ticketIds, total, bits)
newmodify := fmt.Sprintf("%s:%s:%d:%d", string(modifies), ticketIds, total, bits)
modify := common.Sha256([]byte(newmodify))
return modify, nil
......
......@@ -552,10 +552,8 @@ func (policy *ticketPolicy) openticket(mineraddr, returnaddr string, priv crypto
ta := &ty.TicketAction{}
topen := &ty.TicketOpen{MinerAddress: mineraddr, ReturnAddress: returnaddr, Count: count, RandSeed: types.Now().UnixNano()}
hashList := make([][]byte, int(count))
privStr := ""
for i := 0; i < int(count); i++ {
privStr = fmt.Sprintf("%x:%d:%d", priv.Bytes(), i, topen.RandSeed)
privHash := common.Sha256([]byte(privStr))
privHash := common.Sha256([]byte(fmt.Sprintf("%x:%d:%d", priv.Bytes(), i, topen.RandSeed)))
pubHash := common.Sha256(privHash)
hashList[i] = pubHash
}
......
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