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
7270585a
Commit
7270585a
authored
May 22, 2019
by
linj
Committed by
vipwzw
May 22, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix check tx.Execer
parent
83adafb1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
16 deletions
+6
-16
exec.go
plugin/dapp/js/executor/exec.go
+6
-16
No files found.
plugin/dapp/js/executor/exec.go
View file @
7270585a
package
executor
package
executor
import
(
import
(
"strings"
"github.com/33cn/chain33/system/dapp"
"github.com/33cn/chain33/system/dapp"
"github.com/33cn/chain33/types"
"github.com/33cn/chain33/types"
ptypes
"github.com/33cn/plugin/plugin/dapp/js/types"
ptypes
"github.com/33cn/plugin/plugin/dapp/js/types"
...
@@ -17,18 +15,10 @@ func (c *js) userExecName(name string, local bool) string {
...
@@ -17,18 +15,10 @@ func (c *js) userExecName(name string, local bool) string {
return
execer
return
execer
}
}
func
(
c
*
js
)
checkJsName
(
name
string
)
bool
{
// execName 在create 时为 jsvm
if
types
.
IsPara
()
{
// 在 call 时为 user.jsvm.game
return
name
==
types
.
GetTitle
()
+
ptypes
.
JsX
func
(
c
*
js
)
checkTxExec
(
txExec
string
,
execName
string
)
bool
{
}
return
txExec
==
types
.
ExecName
(
execName
)
return
name
==
ptypes
.
JsX
}
func
(
c
*
js
)
checkJsPrefix
(
name
string
)
bool
{
if
types
.
IsPara
()
{
return
strings
.
HasPrefix
(
name
,
types
.
GetTitle
()
+
"user."
+
ptypes
.
JsX
)
}
return
strings
.
HasPrefix
(
name
,
"user."
+
ptypes
.
JsX
)
}
}
func
(
c
*
js
)
Exec_Create
(
payload
*
jsproto
.
Create
,
tx
*
types
.
Transaction
,
index
int
)
(
*
types
.
Receipt
,
error
)
{
func
(
c
*
js
)
Exec_Create
(
payload
*
jsproto
.
Create
,
tx
*
types
.
Transaction
,
index
int
)
(
*
types
.
Receipt
,
error
)
{
...
@@ -38,7 +28,7 @@ func (c *js) Exec_Create(payload *jsproto.Create, tx *types.Transaction, index i
...
@@ -38,7 +28,7 @@ func (c *js) Exec_Create(payload *jsproto.Create, tx *types.Transaction, index i
}
}
execer
:=
c
.
userExecName
(
payload
.
Name
,
false
)
execer
:=
c
.
userExecName
(
payload
.
Name
,
false
)
if
!
c
.
check
JsName
(
string
(
tx
.
Execer
)
)
{
if
!
c
.
check
TxExec
(
string
(
tx
.
Execer
),
ptypes
.
JsX
)
{
return
nil
,
types
.
ErrExecNameNotMatch
return
nil
,
types
.
ErrExecNameNotMatch
}
}
c
.
prefix
=
types
.
CalcStatePrefix
([]
byte
(
execer
))
c
.
prefix
=
types
.
CalcStatePrefix
([]
byte
(
execer
))
...
@@ -66,7 +56,7 @@ func (c *js) Exec_Create(payload *jsproto.Create, tx *types.Transaction, index i
...
@@ -66,7 +56,7 @@ func (c *js) Exec_Create(payload *jsproto.Create, tx *types.Transaction, index i
func
(
c
*
js
)
Exec_Call
(
payload
*
jsproto
.
Call
,
tx
*
types
.
Transaction
,
index
int
)
(
*
types
.
Receipt
,
error
)
{
func
(
c
*
js
)
Exec_Call
(
payload
*
jsproto
.
Call
,
tx
*
types
.
Transaction
,
index
int
)
(
*
types
.
Receipt
,
error
)
{
execer
:=
c
.
userExecName
(
payload
.
Name
,
false
)
execer
:=
c
.
userExecName
(
payload
.
Name
,
false
)
if
!
c
.
check
JsPrefix
(
string
(
tx
.
Execer
)
)
{
if
!
c
.
check
TxExec
(
string
(
tx
.
Execer
),
execer
)
{
return
nil
,
types
.
ErrExecNameNotMatch
return
nil
,
types
.
ErrExecNameNotMatch
}
}
c
.
prefix
=
types
.
CalcStatePrefix
([]
byte
(
execer
))
c
.
prefix
=
types
.
CalcStatePrefix
([]
byte
(
execer
))
...
...
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