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

fix linter warnings

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