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
8e6d9fe0
Commit
8e6d9fe0
authored
Dec 11, 2018
by
张振华
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bugfix
parent
19bb29d0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
5 deletions
+18
-5
exec_local.go
plugin/dapp/guess/executor/exec_local.go
+4
-0
guessdb.go
plugin/dapp/guess/executor/guessdb.go
+14
-5
No files found.
plugin/dapp/guess/executor/exec_local.go
View file @
8e6d9fe0
...
...
@@ -83,6 +83,10 @@ func (g *Guess) ExecLocal_Bet(payload *pkt.GuessGameBet, tx *types.Transaction,
return
g
.
execLocal
(
receiptData
)
}
func
(
g
*
Guess
)
ExecLocal_StopBet
(
payload
*
pkt
.
GuessGameStopBet
,
tx
*
types
.
Transaction
,
receiptData
*
types
.
ReceiptData
,
index
int
)
(
*
types
.
LocalDBSet
,
error
)
{
return
g
.
execLocal
(
receiptData
)
}
func
(
g
*
Guess
)
ExecLocal_Publish
(
payload
*
pkt
.
GuessGamePublish
,
tx
*
types
.
Transaction
,
receiptData
*
types
.
ReceiptData
,
index
int
)
(
*
types
.
LocalDBSet
,
error
)
{
return
g
.
execLocal
(
receiptData
)
}
...
...
plugin/dapp/guess/executor/guessdb.go
View file @
8e6d9fe0
...
...
@@ -546,7 +546,7 @@ func (action *Action) GameStopBet(pbBet *pkt.GuessGameStopBet) (*types.Receipt,
if
game
.
AdminAddr
!=
action
.
fromaddr
{
logger
.
Error
(
"GameStopBet"
,
"addr"
,
action
.
fromaddr
,
"execaddr"
,
action
.
execaddr
,
"fromAddr is not adminAddr"
,
action
.
fromaddr
,
"adminAddr"
,
game
.
AdminAddr
)
return
nil
,
types
.
ErrInvalidParam
return
nil
,
pkt
.
ErrNoPrivilege
}
action
.
ChangeStatus
(
game
,
pkt
.
GuessGameStatusStopBet
)
...
...
@@ -610,13 +610,13 @@ func (action *Action) GamePublish(publish *pkt.GuessGamePublish) (*types.Receipt
//检查竞猜选项是否合法
options
,
legal
:=
GetOptions
(
game
.
GetOptions
())
if
!
legal
||
len
(
options
)
==
0
{
logger
.
Error
(
"Game
Bet
"
,
"addr"
,
action
.
fromaddr
,
"execaddr"
,
action
.
execaddr
,
"Game Options illegal"
,
logger
.
Error
(
"Game
Publish
"
,
"addr"
,
action
.
fromaddr
,
"execaddr"
,
action
.
execaddr
,
"Game Options illegal"
,
game
.
GetOptions
())
return
nil
,
types
.
ErrInvalidParam
}
if
!
IsLegalOption
(
options
,
publish
.
GetResult
())
{
logger
.
Error
(
"Game
Bet
"
,
"addr"
,
action
.
fromaddr
,
"execaddr"
,
action
.
execaddr
,
"Option illegal"
,
logger
.
Error
(
"Game
Publish
"
,
"addr"
,
action
.
fromaddr
,
"execaddr"
,
action
.
execaddr
,
"Option illegal"
,
publish
.
GetResult
())
return
nil
,
types
.
ErrInvalidParam
}
...
...
@@ -626,8 +626,17 @@ func (action *Action) GamePublish(publish *pkt.GuessGamePublish) (*types.Receipt
//先遍历所有下注数据,转移资金到Admin账户合约地址;
for
i
:=
0
;
i
<
len
(
game
.
Plays
);
i
++
{
player
:=
game
.
Plays
[
i
]
value
:=
int64
(
player
.
Bet
.
BetsNumber
)
receipt
,
err
:=
action
.
coinsAccount
.
ExecTransfer
(
player
.
Addr
,
game
.
AdminAddr
,
action
.
execaddr
,
value
)
value
:=
player
.
Bet
.
BetsNumber
receipt
,
err
:=
action
.
coinsAccount
.
ExecActive
(
player
.
Addr
,
action
.
execaddr
,
value
)
if
err
!=
nil
{
logger
.
Error
(
"GamePublish.ExecActive"
,
"addr"
,
player
.
Addr
,
"execaddr"
,
action
.
execaddr
,
"amount"
,
value
,
"err"
,
err
)
return
nil
,
err
}
logs
=
append
(
logs
,
receipt
.
Logs
...
)
kv
=
append
(
kv
,
receipt
.
KV
...
)
receipt
,
err
=
action
.
coinsAccount
.
ExecTransfer
(
player
.
Addr
,
game
.
AdminAddr
,
action
.
execaddr
,
value
)
if
err
!=
nil
{
action
.
coinsAccount
.
ExecFrozen
(
game
.
AdminAddr
,
action
.
execaddr
,
value
)
// rollback
logger
.
Error
(
"GamePublish"
,
"addr"
,
player
.
Addr
,
"execaddr"
,
action
.
execaddr
,
...
...
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