Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
plugin
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
link33
plugin
Commits
c1cfde4e
Commit
c1cfde4e
authored
Apr 30, 2019
by
vipwzw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
auto ci
parent
75f24bd1
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
20 additions
and
13 deletions
+20
-13
state_machine.go
plugin/consensus/dpos/state_machine.go
+8
-4
state_machine_test.go
plugin/consensus/dpos/state_machine_test.go
+4
-3
signable.go
plugin/consensus/dpos/types/signable.go
+3
-2
validator_manager.go
plugin/consensus/dpos/validator_manager.go
+2
-1
guess.pb.go
plugin/dapp/guess/types/guess.pb.go
+3
-3
No files found.
plugin/consensus/dpos/state_machine.go
View file @
c1cfde4e
...
...
@@ -7,9 +7,10 @@ package dpos
import
(
"bytes"
"encoding/json"
"github.com/outbrain/golib/math"
"time"
"github.com/outbrain/golib/math"
"github.com/33cn/chain33/common"
"github.com/33cn/chain33/common/crypto"
dpostype
"github.com/33cn/plugin/plugin/consensus/dpos/types"
...
...
@@ -31,10 +32,13 @@ var (
// InitStateObj is the InitState obj
var
InitStateObj
=
&
InitState
{}
// VotingStateObj is the VotingState obj
var
VotingStateObj
=
&
VotingState
{}
// VotedStateObj is the VotedState obj
var
VotedStateObj
=
&
VotedState
{}
// WaitNotifyStateObj is the WaitNotifyState obj
var
WaitNotifyStateObj
=
&
WaitNofifyState
{}
...
...
@@ -56,7 +60,7 @@ func DecideTaskByTime(now int64) (task DPosTask) {
task
.
cycleStart
=
now
-
now
%
dposCycle
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
.
blockStart
=
task
.
periodStart
+
now
%
dposCycle
%
dposPeriod
/
dposBlockInterval
*
dposBlockInterval
...
...
@@ -363,12 +367,12 @@ func (voted *VotedState) timeOut(cs *ConsensusState) {
cs
.
client
.
SetBlockTime
(
task
.
blockStop
)
cs
.
client
.
CreateBlock
()
cs
.
scheduleDPosTimeout
(
time
.
Millisecond
*
500
,
VotedStateType
)
cs
.
scheduleDPosTimeout
(
time
.
Millisecond
*
500
,
VotedStateType
)
return
}
dposlog
.
Info
(
"Wait time to create block near blockStop."
)
cs
.
scheduleDPosTimeout
(
time
.
Millisecond
*
500
,
VotedStateType
)
cs
.
scheduleDPosTimeout
(
time
.
Millisecond
*
500
,
VotedStateType
)
return
}
else
{
...
...
plugin/consensus/dpos/state_machine_test.go
View file @
c1cfde4e
...
...
@@ -6,13 +6,14 @@ package dpos
import
(
"fmt"
"github.com/33cn/chain33/types"
"github.com/stretchr/testify/assert"
"google.golang.org/grpc"
"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"
...
...
plugin/consensus/dpos/types/signable.go
View file @
c1cfde4e
...
...
@@ -9,10 +9,11 @@ import (
"encoding/json"
"errors"
"fmt"
"github.com/33cn/chain33/common/crypto"
"github.com/33cn/chain33/common/log/log15"
"io"
"time"
"github.com/33cn/chain33/common/crypto"
"github.com/33cn/chain33/common/log/log15"
)
// error defines
...
...
plugin/consensus/dpos/validator_manager.go
View file @
c1cfde4e
...
...
@@ -8,8 +8,9 @@ import (
"bytes"
"encoding/json"
"fmt"
ttypes
"github.com/33cn/plugin/plugin/consensus/dpos/types"
"math/rand"
ttypes
"github.com/33cn/plugin/plugin/consensus/dpos/types"
)
const
fee
=
1e6
...
...
plugin/dapp/guess/types/guess.pb.go
View file @
c1cfde4e
// Code generated by protoc-gen-go. DO NOT EDIT.
// source:
dpos_msg
.proto
// source:
guess
.proto
package
types
...
...
@@ -2059,7 +2059,7 @@ func init() {
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
{
// 1367 bytes of a gzipped FileDescriptorProto
...
...
@@ -2362,5 +2362,5 @@ var _Guess_serviceDesc = grpc.ServiceDesc{
},
},
Streams
:
[]
grpc
.
StreamDesc
{},
Metadata
:
"
dpos_msg
.proto"
,
Metadata
:
"
guess
.proto"
,
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment