Commit 1ff6da03 authored by 张振华's avatar 张振华

fix linter warnings

parent c37744b2
......@@ -77,7 +77,7 @@ type ConsensusState struct {
Quit chan struct{}
//当前状态
dposState DposState
dposState State
//所有选票,包括自己的和从网络中接收到的
dposVotes []*dpostype.DPosVote
......@@ -296,7 +296,7 @@ func (cs *ConsensusState) IsProposer() bool {
}
// SetState method
func (cs *ConsensusState) SetState(state DposState) {
func (cs *ConsensusState) SetState(state State) {
cs.dposState = state
}
......
......@@ -42,7 +42,7 @@ var VotedStateObj = &VotedState{}
var WaitNotifyStateObj = &WaitNofifyState{}
// DPosTask 为计算当前时间所属周期的数据结构
type DPosTask struct {
type Task struct {
nodeID int64
cycleStart int64
cycleStop int64
......@@ -53,7 +53,7 @@ type DPosTask struct {
}
// DecideTaskByTime 根据时间戳计算所属的周期,包括cycle周期,负责出块周期,当前出块周期
func DecideTaskByTime(now int64) (task DPosTask) {
func DecideTaskByTime(now int64) (task Task) {
task.nodeID = now % dposCycle / dposPeriod
task.cycleStart = now - now%dposCycle
......@@ -69,7 +69,7 @@ func DecideTaskByTime(now int64) (task DPosTask) {
}
// DposState is the base class of dpos state machine, it defines some interfaces.
type DposState interface {
type State interface {
timeOut(cs *ConsensusState)
sendVote(cs *ConsensusState, vote *dpostype.DPosVote)
recvVote(cs *ConsensusState, vote *dpostype.DPosVote)
......
......@@ -26,7 +26,7 @@ func setParams(delegateNum int64, blockInterval int64, continueBlockNum int64) {
dposPeriod = int64(dposBlockInterval * dposContinueBlockNum)
}
func printTask(now int64, task *DPosTask) {
func printTask(now int64, task *Task) {
fmt.Printf("now:%v|cycleStart:%v|cycleStop:%v|periodStart:%v|periodStop:%v|blockStart:%v|blockStop:%v|nodeId:%v\n",
now,
task.cycleStart,
......@@ -37,7 +37,7 @@ func printTask(now int64, task *DPosTask) {
task.blockStop,
task.nodeID)
}
func assertTask(task *DPosTask, t *testing.T) {
func assertTask(task *Task, t *testing.T) {
assert.Equal(t, true, task.nodeID >= 0 && task.nodeID < dposDelegateNum)
assert.Equal(t, true, task.cycleStart <= task.periodStart && task.periodStart <= task.blockStart && task.blockStop <= task.periodStop && task.periodStop <= task.cycleStop)
......
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