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
7f223ab0
Commit
7f223ab0
authored
May 01, 2019
by
张振华
Browse files
Options
Browse Files
Download
Plain Diff
bugfix
parents
dfd16cdf
c1cfde4e
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
18 additions
and
12 deletions
+18
-12
state_machine.go
plugin/consensus/dpos/state_machine.go
+6
-3
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 @
7f223ab0
...
@@ -31,10 +31,13 @@ var (
...
@@ -31,10 +31,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 +59,7 @@ func DecideTaskByTime(now int64) (task DPosTask) {
...
@@ -56,7 +59,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 +366,12 @@ func (voted *VotedState) timeOut(cs *ConsensusState) {
...
@@ -363,12 +366,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
{
...
...
plugin/consensus/dpos/state_machine_test.go
View file @
7f223ab0
...
@@ -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"
...
...
plugin/consensus/dpos/types/signable.go
View file @
7f223ab0
...
@@ -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
...
...
plugin/consensus/dpos/validator_manager.go
View file @
7f223ab0
...
@@ -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
...
...
plugin/dapp/guess/types/guess.pb.go
View file @
7f223ab0
// 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"
,
}
}
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