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
caed05f3
Commit
caed05f3
authored
Nov 26, 2018
by
vipwzw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix vet
parent
7b6003c9
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
12 additions
and
13 deletions
+12
-13
Makefile
Makefile
+1
-1
main.go
main.go
+2
-3
consensus_state.go
plugin/consensus/tendermint/consensus_state.go
+1
-1
gamedb.go
plugin/dapp/game/executor/gamedb.go
+8
-8
No files found.
Makefile
View file @
caed05f3
...
...
@@ -74,7 +74,7 @@ updatevendor:
dep
:
dep init
-v
linter
:
##
Use gometalinter check code
,
ignore some unserious warning
linter
:
vet
##
Use gometalinter check code
,
ignore some unserious warning
@
./golinter.sh
"filter"
@
find
.
-name
'*.sh'
-not
-path
"./vendor/*"
| xargs shellcheck
...
...
main.go
View file @
caed05f3
...
...
@@ -2,14 +2,13 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build go1.9
/*
每个系统的功能通过插件完成,插件分成4类:
共识 加密 dapp 存储
这个go 包提供了 官方提供的 插件。
*/
// +build go1.9
package
main
import
(
...
...
plugin/consensus/tendermint/consensus_state.go
View file @
caed05f3
...
...
@@ -1180,7 +1180,7 @@ func (cs *ConsensusState) defaultSetProposal(proposal *tmtypes.Proposal) error {
// NOTE: block is not necessarily valid.
// Asynchronously triggers either enterPrevote (before we timeout of propose) or tryFinalizeCommit, once we have the full block.
func
(
cs
*
ConsensusState
)
addProposalBlock
(
proposalBlock
*
tmtypes
.
TendermintBlock
)
(
err
error
)
{
block
:=
&
ttypes
.
TendermintBlock
{
proposalBlock
}
block
:=
&
ttypes
.
TendermintBlock
{
TendermintBlock
:
proposalBlock
}
height
,
round
:=
block
.
Header
.
Height
,
block
.
Header
.
Round
tendermintlog
.
Debug
(
fmt
.
Sprintf
(
"Consensus receive proposal block. Current: %v/%v/%v"
,
cs
.
Height
,
cs
.
Round
,
cs
.
Step
),
"block(H/R/hash)"
,
fmt
.
Sprintf
(
"%v/%v/%X"
,
height
,
round
,
block
.
Hash
()))
...
...
plugin/dapp/game/executor/gamedb.go
View file @
caed05f3
...
...
@@ -117,7 +117,7 @@ func (action *Action) GetIndex(game *gt.Game) int64 {
//GetKVSet get kv set
func
(
action
*
Action
)
GetKVSet
(
game
*
gt
.
Game
)
(
kvset
[]
*
types
.
KeyValue
)
{
value
:=
types
.
Encode
(
game
)
kvset
=
append
(
kvset
,
&
types
.
KeyValue
{
Key
(
game
.
GameId
),
value
})
kvset
=
append
(
kvset
,
&
types
.
KeyValue
{
Key
:
Key
(
game
.
GameId
),
Value
:
value
})
return
kvset
}
...
...
@@ -126,7 +126,7 @@ func (action *Action) updateCount(status int32, addr string) (kvset []*types.Key
if
err
!=
nil
{
glog
.
Error
(
"updateCount"
,
"Query count have err:"
,
err
.
Error
())
}
kvset
=
append
(
kvset
,
&
types
.
KeyValue
{
calcCountKey
(
status
,
addr
),
[]
byte
(
strconv
.
FormatInt
(
count
+
1
,
10
))})
kvset
=
append
(
kvset
,
&
types
.
KeyValue
{
Key
:
calcCountKey
(
status
,
addr
),
Value
:
[]
byte
(
strconv
.
FormatInt
(
count
+
1
,
10
))})
return
kvset
}
...
...
@@ -231,7 +231,7 @@ func (action *Action) GameCreate(create *gt.GameCreate) (*types.Receipt, error)
kv
=
append
(
kv
,
receipt
.
KV
...
)
kv
=
append
(
kv
,
action
.
updateCount
(
game
.
GetStatus
(),
""
)
...
)
kv
=
append
(
kv
,
action
.
updateCount
(
game
.
GetStatus
(),
game
.
GetCreateAddress
())
...
)
receipt
=
&
types
.
Receipt
{
types
.
ExecOk
,
kv
,
logs
}
receipt
=
&
types
.
Receipt
{
Ty
:
types
.
ExecOk
,
KV
:
kv
,
Logs
:
logs
}
return
receipt
,
nil
}
...
...
@@ -286,7 +286,7 @@ func (action *Action) GameMatch(match *gt.GameMatch) (*types.Receipt, error) {
kvs
=
append
(
kvs
,
action
.
updateCount
(
game
.
GetStatus
(),
""
)
...
)
kvs
=
append
(
kvs
,
action
.
updateCount
(
game
.
GetStatus
(),
game
.
GetCreateAddress
())
...
)
kvs
=
append
(
kvs
,
action
.
updateCount
(
game
.
GetStatus
(),
game
.
GetMatchAddress
())
...
)
receipts
:=
&
types
.
Receipt
{
types
.
ExecOk
,
kvs
,
logs
}
receipts
:=
&
types
.
Receipt
{
Ty
:
types
.
ExecOk
,
KV
:
kvs
,
Logs
:
logs
}
return
receipts
,
nil
}
...
...
@@ -338,7 +338,7 @@ func (action *Action) GameCancel(cancel *gt.GameCancel) (*types.Receipt, error)
kv
=
append
(
kv
,
action
.
updateCount
(
game
.
GetStatus
(),
""
)
...
)
kv
=
append
(
kv
,
action
.
updateCount
(
game
.
GetStatus
(),
game
.
GetCreateAddress
())
...
)
return
&
types
.
Receipt
{
types
.
ExecOk
,
kv
,
logs
},
nil
return
&
types
.
Receipt
{
Ty
:
types
.
ExecOk
,
KV
:
kv
,
Logs
:
logs
},
nil
}
// GameClose close game
...
...
@@ -480,7 +480,7 @@ func (action *Action) GameClose(close *gt.GameClose) (*types.Receipt, error) {
kv
=
append
(
kv
,
action
.
updateCount
(
game
.
GetStatus
(),
""
)
...
)
kv
=
append
(
kv
,
action
.
updateCount
(
game
.
GetStatus
(),
game
.
GetCreateAddress
())
...
)
kv
=
append
(
kv
,
action
.
updateCount
(
game
.
GetStatus
(),
game
.
GetMatchAddress
())
...
)
return
&
types
.
Receipt
{
types
.
ExecOk
,
kv
,
logs
},
nil
return
&
types
.
Receipt
{
Ty
:
types
.
ExecOk
,
KV
:
kv
,
Logs
:
logs
},
nil
}
// 检查开奖是否超时,若超过一天,则不让庄家开奖,但其他人可以开奖,
...
...
@@ -602,7 +602,7 @@ func queryGameListByStatusAndAddr(db dbm.Lister, stateDB dbm.KV, param *gt.Query
}
gameIds
=
append
(
gameIds
,
record
.
GetGameId
())
}
return
&
gt
.
ReplyGameList
{
GetGameList
(
stateDB
,
gameIds
)},
nil
return
&
gt
.
ReplyGameList
{
G
ames
:
G
etGameList
(
stateDB
,
gameIds
)},
nil
}
// QueryGameListCount count数查询
...
...
@@ -610,7 +610,7 @@ func QueryGameListCount(stateDB dbm.KV, param *gt.QueryGameListCount) (types.Mes
if
param
.
Status
<
1
||
param
.
Status
>
4
{
return
nil
,
fmt
.
Errorf
(
"%s"
,
"the status only fill in 1,2,3,4!"
)
}
return
&
gt
.
ReplyGameListCount
{
QueryCountByStatusAndAddr
(
stateDB
,
param
.
GetStatus
(),
param
.
GetAddress
())},
nil
return
&
gt
.
ReplyGameListCount
{
Count
:
QueryCountByStatusAndAddr
(
stateDB
,
param
.
GetStatus
(),
param
.
GetAddress
())},
nil
}
// QueryCountByStatusAndAddr query game count by status and addr
...
...
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