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
bcc351de
Commit
bcc351de
authored
Feb 12, 2019
by
pengjun
Committed by
vipwzw
Feb 14, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#302 修复节点时区不一致引起的statehash不同
parent
fe703ac7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
5 additions
and
12 deletions
+5
-12
pokerbulldb.go
plugin/dapp/pokerbull/executor/pokerbulldb.go
+3
-8
pokerbull.proto
plugin/dapp/pokerbull/proto/pokerbull.proto
+2
-4
pokerbull.pb.go
plugin/dapp/pokerbull/types/pokerbull.pb.go
+0
-0
No files found.
plugin/dapp/pokerbull/executor/pokerbulldb.go
View file @
bcc351de
...
...
@@ -10,7 +10,6 @@ import (
"strconv"
"strings"
"time"
"github.com/33cn/chain33/account"
"github.com/33cn/chain33/common"
...
...
@@ -510,7 +509,7 @@ func (action *Action) newGame(gameID string, start *pkt.PBGameStart) (*pkt.Poker
game
=
&
pkt
.
PokerBull
{
GameId
:
gameID
,
Status
:
pkt
.
PBGameActionStart
,
StartTime
:
time
.
Unix
(
action
.
blocktime
,
0
)
.
Format
(
"2006-01-02 15:04:05"
)
,
StartTime
:
action
.
blocktime
,
StartTxHash
:
gameID
,
Value
:
start
.
GetValue
(),
Poker
:
NewPoker
(),
...
...
@@ -649,7 +648,6 @@ func (action *Action) GameStart(start *pkt.PBGameStart) (*types.Receipt, error)
Address
:
action
.
fromaddr
,
TxHash
:
txrng
,
Ready
:
false
,
MatchTime
:
time
.
Unix
(
action
.
blocktime
,
0
)
.
Format
(
"2006-01-02 15:04:05"
),
})
// 如果人数达标,则发牌计算斗牛结果
...
...
@@ -759,7 +757,6 @@ func (action *Action) GameContinue(pbcontinue *pkt.PBGameContinue) (*types.Recei
}
pbplayer
.
TxHash
=
txrng
pbplayer
.
Ready
=
true
pbplayer
.
MatchTime
=
time
.
Unix
(
action
.
blocktime
,
0
)
.
Format
(
"2006-01-02 15:04:05"
)
if
getReadyPlayerNum
(
game
.
Players
)
==
int
(
game
.
PlayerNum
)
{
logger
.
Info
(
fmt
.
Sprintf
(
"Game starting: %s round: %d"
,
game
.
GameId
,
game
.
Round
))
...
...
@@ -864,7 +861,7 @@ func (action *Action) GameQuit(pbquit *pkt.PBGameQuit) (*types.Receipt, error) {
game
.
Status
=
pkt
.
PBGameActionQuit
game
.
PrevIndex
=
game
.
Index
game
.
Index
=
action
.
getIndex
(
game
)
game
.
QuitTime
=
time
.
Unix
(
action
.
blocktime
,
0
)
.
Format
(
"2006-01-02 15:04:05"
)
game
.
QuitTime
=
action
.
blocktime
game
.
QuitTxHash
=
common
.
ToHex
(
action
.
txhash
)
receiptLog
:=
action
.
GetReceiptLog
(
game
)
...
...
@@ -946,7 +943,6 @@ func (action *Action) GamePlay(pbplay *pkt.PBGamePlay) (*types.Receipt, error) {
// 更新玩家信息
for
i
,
player
:=
range
game
.
Players
{
player
.
TxHash
=
rands
[
i
]
player
.
MatchTime
=
time
.
Unix
(
action
.
blocktime
,
0
)
.
Format
(
"2006-01-02 15:04:05"
)
}
game
.
Round
++
...
...
@@ -974,14 +970,13 @@ func (action *Action) GamePlay(pbplay *pkt.PBGamePlay) (*types.Receipt, error) {
player
:=
&
pkt
.
PBPlayer
{
Address
:
addr
,
TxHash
:
rands
[
i
],
MatchTime
:
time
.
Unix
(
action
.
blocktime
,
0
)
.
Format
(
"2006-01-02 15:04:05"
),
}
game
.
Players
=
append
(
game
.
Players
,
player
)
}
game
.
Status
=
pkt
.
PBGameActionQuit
// 更新游戏状态
game
.
PreStatus
=
pkt
.
PBGameActionStart
game
.
QuitTime
=
time
.
Unix
(
action
.
blocktime
,
0
)
.
Format
(
"2006-01-02 15:04:05"
)
game
.
QuitTime
=
action
.
blocktime
game
.
QuitTxHash
=
common
.
ToHex
(
action
.
txhash
)
}
...
...
plugin/dapp/pokerbull/proto/pokerbull.proto
View file @
bcc351de
...
...
@@ -6,7 +6,7 @@ package types;
message
PokerBull
{
string
gameId
=
1
;
//默认是由创建这局游戏的txHash作为gameId
int32
status
=
2
;
// Start 1 -> Continue 2 -> Quit 3
string
startTime
=
3
;
//开始时间
int64
startTime
=
3
;
//开始时间
string
startTxHash
=
4
;
//游戏启动交易hash
int64
value
=
5
;
//赌注
PBPoker
poker
=
6
;
//扑克牌
...
...
@@ -15,7 +15,7 @@ message PokerBull {
repeated
PBResult
results
=
9
;
//游戏结果集
int64
index
=
10
;
//索引
int64
prevIndex
=
11
;
//上级索引
string
quitTime
=
12
;
//游戏结束时间
int64
quitTime
=
12
;
//游戏结束时间
string
quitTxHash
=
13
;
//游戏结束交易hash
string
dealerAddr
=
14
;
//下局庄家地址
bool
isWaiting
=
15
;
//游戏是否处于等待状态
...
...
@@ -30,7 +30,6 @@ message PBHand {
string
address
=
3
;
//玩家地址
bool
isWin
=
4
;
//是否赢庄家
int32
leverage
=
5
;
//赌注倍数
string
roundTime
=
6
;
//本回合开始时间
}
//玩家
...
...
@@ -39,7 +38,6 @@ message PBPlayer {
string
address
=
2
;
//玩家地址
int64
txHash
=
3
;
//发牌随机数因子txhash的整数格式
bool
ready
=
4
;
//continue状态下,是否ready
string
matchTime
=
5
;
//玩家匹配时间
}
//本局游戏结果
...
...
plugin/dapp/pokerbull/types/pokerbull.pb.go
View file @
bcc351de
This diff is collapsed.
Click to expand it.
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