Commit c1cfde4e authored by vipwzw's avatar vipwzw

auto ci

parent 75f24bd1
...@@ -7,9 +7,10 @@ package dpos ...@@ -7,9 +7,10 @@ package dpos
import ( import (
"bytes" "bytes"
"encoding/json" "encoding/json"
"github.com/outbrain/golib/math"
"time" "time"
"github.com/outbrain/golib/math"
"github.com/33cn/chain33/common" "github.com/33cn/chain33/common"
"github.com/33cn/chain33/common/crypto" "github.com/33cn/chain33/common/crypto"
dpostype "github.com/33cn/plugin/plugin/consensus/dpos/types" dpostype "github.com/33cn/plugin/plugin/consensus/dpos/types"
...@@ -31,10 +32,13 @@ var ( ...@@ -31,10 +32,13 @@ var (
// InitStateObj is the InitState obj // InitStateObj is the InitState obj
var InitStateObj = &InitState{} var InitStateObj = &InitState{}
// VotingStateObj is the VotingState obj // VotingStateObj is the VotingState obj
var VotingStateObj = &VotingState{} var VotingStateObj = &VotingState{}
// VotedStateObj is the VotedState obj // VotedStateObj is the VotedState obj
var VotedStateObj = &VotedState{} var VotedStateObj = &VotedState{}
// WaitNotifyStateObj is the WaitNotifyState obj // WaitNotifyStateObj is the WaitNotifyState obj
var WaitNotifyStateObj = &WaitNofifyState{} var WaitNotifyStateObj = &WaitNofifyState{}
...@@ -56,7 +60,7 @@ func DecideTaskByTime(now int64) (task DPosTask) { ...@@ -56,7 +60,7 @@ func DecideTaskByTime(now int64) (task DPosTask) {
task.cycleStart = now - now%dposCycle task.cycleStart = now - now%dposCycle
task.cycleStop = task.cycleStart + dposCycle - 1 task.cycleStop = task.cycleStart + dposCycle - 1
task.periodStart = task.cycleStart + task.nodeID * dposBlockInterval * dposContinueBlockNum task.periodStart = task.cycleStart + task.nodeID*dposBlockInterval*dposContinueBlockNum
task.periodStop = task.periodStart + dposPeriod - 1 task.periodStop = task.periodStart + dposPeriod - 1
task.blockStart = task.periodStart + now%dposCycle%dposPeriod/dposBlockInterval*dposBlockInterval task.blockStart = task.periodStart + now%dposCycle%dposPeriod/dposBlockInterval*dposBlockInterval
...@@ -363,12 +367,12 @@ func (voted *VotedState) timeOut(cs *ConsensusState) { ...@@ -363,12 +367,12 @@ func (voted *VotedState) timeOut(cs *ConsensusState) {
cs.client.SetBlockTime(task.blockStop) cs.client.SetBlockTime(task.blockStop)
cs.client.CreateBlock() cs.client.CreateBlock()
cs.scheduleDPosTimeout(time.Millisecond * 500, VotedStateType) cs.scheduleDPosTimeout(time.Millisecond*500, VotedStateType)
return return
} }
dposlog.Info("Wait time to create block near blockStop.") dposlog.Info("Wait time to create block near blockStop.")
cs.scheduleDPosTimeout(time.Millisecond * 500, VotedStateType) cs.scheduleDPosTimeout(time.Millisecond*500, VotedStateType)
return return
} else { } else {
......
...@@ -6,13 +6,14 @@ package dpos ...@@ -6,13 +6,14 @@ package dpos
import ( import (
"fmt" "fmt"
"github.com/33cn/chain33/types"
"github.com/stretchr/testify/assert"
"google.golang.org/grpc"
"math/rand" "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"
......
...@@ -9,10 +9,11 @@ import ( ...@@ -9,10 +9,11 @@ import (
"encoding/json" "encoding/json"
"errors" "errors"
"fmt" "fmt"
"github.com/33cn/chain33/common/crypto"
"github.com/33cn/chain33/common/log/log15"
"io" "io"
"time" "time"
"github.com/33cn/chain33/common/crypto"
"github.com/33cn/chain33/common/log/log15"
) )
// error defines // error defines
......
...@@ -8,8 +8,9 @@ import ( ...@@ -8,8 +8,9 @@ import (
"bytes" "bytes"
"encoding/json" "encoding/json"
"fmt" "fmt"
ttypes "github.com/33cn/plugin/plugin/consensus/dpos/types"
"math/rand" "math/rand"
ttypes "github.com/33cn/plugin/plugin/consensus/dpos/types"
) )
const fee = 1e6 const fee = 1e6
......
// Code generated by protoc-gen-go. DO NOT EDIT. // Code generated by protoc-gen-go. DO NOT EDIT.
// source: dpos_msg.proto // source: guess.proto
package types package types
...@@ -2059,7 +2059,7 @@ func init() { ...@@ -2059,7 +2059,7 @@ func init() {
proto.RegisterType((*GuessGameRecords)(nil), "types.GuessGameRecords") proto.RegisterType((*GuessGameRecords)(nil), "types.GuessGameRecords")
} }
func init() { proto.RegisterFile("dpos_msg.proto", fileDescriptor_7574406c5d3430e8) } func init() { proto.RegisterFile("guess.proto", fileDescriptor_7574406c5d3430e8) }
var fileDescriptor_7574406c5d3430e8 = []byte{ var fileDescriptor_7574406c5d3430e8 = []byte{
// 1367 bytes of a gzipped FileDescriptorProto // 1367 bytes of a gzipped FileDescriptorProto
...@@ -2362,5 +2362,5 @@ var _Guess_serviceDesc = grpc.ServiceDesc{ ...@@ -2362,5 +2362,5 @@ var _Guess_serviceDesc = grpc.ServiceDesc{
}, },
}, },
Streams: []grpc.StreamDesc{}, Streams: []grpc.StreamDesc{},
Metadata: "dpos_msg.proto", Metadata: "guess.proto",
} }
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