Commit 3aad2bec authored by 张振华's avatar 张振华

fix linter warnings

parent 7f223ab0
...@@ -22,8 +22,6 @@ import ( ...@@ -22,8 +22,6 @@ import (
// Config // Config
const ( const (
proposalHeartbeatIntervalSeconds = 1
continueToVote = 0 continueToVote = 0
voteSuccess = 1 voteSuccess = 1
voteFail = 2 voteFail = 2
......
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
package dpos package dpos
import ( import (
"sync"
"time" "time"
"github.com/33cn/chain33/common/crypto" "github.com/33cn/chain33/common/crypto"
...@@ -36,8 +35,8 @@ var ( ...@@ -36,8 +35,8 @@ var (
dposDelegateNum int64 = 3 //委托节点个数,从配置读取,以后可以根据投票结果来定 dposDelegateNum int64 = 3 //委托节点个数,从配置读取,以后可以根据投票结果来定
dposBlockInterval int64 = 3 //出块间隔,当前按3s dposBlockInterval int64 = 3 //出块间隔,当前按3s
dposContinueBlockNum int64 = 6 //一个委托节点当选后,一次性持续出块数量 dposContinueBlockNum int64 = 6 //一个委托节点当选后,一次性持续出块数量
dposCycle = int64(dposDelegateNum * dposBlockInterval * dposContinueBlockNum) dposCycle = dposDelegateNum * dposBlockInterval * dposContinueBlockNum
dposPeriod = int64(dposBlockInterval * dposContinueBlockNum) dposPeriod = dposBlockInterval * dposContinueBlockNum
zeroHash [32]byte zeroHash [32]byte
) )
...@@ -60,7 +59,6 @@ type Client struct { ...@@ -60,7 +59,6 @@ type Client struct {
stopC chan struct{} stopC chan struct{}
isDelegator bool isDelegator bool
blockTime int64 blockTime int64
once sync.Once
} }
type subConfig struct { type subConfig struct {
......
...@@ -133,7 +133,7 @@ func (init *InitState) timeOut(cs *ConsensusState) { ...@@ -133,7 +133,7 @@ func (init *InitState) timeOut(cs *ConsensusState) {
index := -1 index := -1
for i := 0; i < cs.validatorMgr.Validators.Size(); i++ { for i := 0; i < cs.validatorMgr.Validators.Size(); i++ {
if bytes.Compare(cs.validatorMgr.Validators.Validators[i].Address, cs.privValidator.GetAddress()) == 0 { if bytes.Equal(cs.validatorMgr.Validators.Validators[i].Address, cs.privValidator.GetAddress()) {
index = i index = i
break break
} }
...@@ -456,9 +456,7 @@ func (voted *VotedState) recvNotify(cs *ConsensusState, notify *dpostype.DPosNot ...@@ -456,9 +456,7 @@ func (voted *VotedState) recvNotify(cs *ConsensusState, notify *dpostype.DPosNot
cs.scheduleDPosTimeout(time.Duration(timeoutWaitNotify)*time.Millisecond, WaitNotifyStateType) cs.scheduleDPosTimeout(time.Duration(timeoutWaitNotify)*time.Millisecond, WaitNotifyStateType)
if cs.cachedNotify != nil { if cs.cachedNotify != nil {
cs.dposState.recvNotify(cs, cs.cachedNotify) cs.dposState.recvNotify(cs, cs.cachedNotify)
} }
return
} }
// WaitNofifyState is the state of dpos state machine to wait notify. // WaitNofifyState is the state of dpos state machine to wait notify.
......
...@@ -6,24 +6,13 @@ package dpos ...@@ -6,24 +6,13 @@ package dpos
import ( import (
"fmt" "fmt"
"math/rand"
"testing" "testing"
"time" "time"
"github.com/33cn/chain33/types"
"github.com/stretchr/testify/assert"
"google.golang.org/grpc"
_ "github.com/33cn/chain33/system" _ "github.com/33cn/chain33/system"
_ "github.com/33cn/plugin/plugin/dapp/init" _ "github.com/33cn/plugin/plugin/dapp/init"
_ "github.com/33cn/plugin/plugin/store/init" _ "github.com/33cn/plugin/plugin/store/init"
) "github.com/stretchr/testify/assert"
var (
random *rand.Rand
loopCount = 10
conn *grpc.ClientConn
c types.Chain33Client
) )
func init() { func init() {
......
...@@ -10,12 +10,9 @@ import ( ...@@ -10,12 +10,9 @@ import (
"strings" "strings"
"github.com/33cn/chain33/common/crypto" "github.com/33cn/chain33/common/crypto"
"github.com/33cn/chain33/common/log/log15"
"github.com/33cn/chain33/common/merkle" "github.com/33cn/chain33/common/merkle"
) )
var validatorsetlog = log15.New("module", "dpos-val")
// Validator ... // Validator ...
type Validator struct { type Validator struct {
Address []byte `json:"address"` Address []byte `json:"address"`
......
...@@ -13,8 +13,6 @@ import ( ...@@ -13,8 +13,6 @@ import (
ttypes "github.com/33cn/plugin/plugin/consensus/dpos/types" ttypes "github.com/33cn/plugin/plugin/consensus/dpos/types"
) )
const fee = 1e6
var ( var (
r *rand.Rand r *rand.Rand
) )
......
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