Commit a6d08daa authored by linj's avatar linj Committed by 33cn

fix check js name in para

parent 4451a3d4
......@@ -15,6 +15,13 @@ func (c *js) userExecName(name string) string {
return execer
}
func (c *js) chechJsName(name string) bool {
if types.IsPara() {
return name == types.GetTitle()+ptypes.JsX
}
return name == ptypes.JsX
}
func (c *js) Exec_Create(payload *jsproto.Create, tx *types.Transaction, index int) (*types.Receipt, error) {
err := checkPriv(tx.From(), ptypes.JsCreator, c.GetStateDB())
if err != nil {
......@@ -22,7 +29,7 @@ func (c *js) Exec_Create(payload *jsproto.Create, tx *types.Transaction, index i
}
execer := c.userExecName(payload.Name)
if string(tx.Execer) != ptypes.JsX {
if !c.chechJsName(string(tx.Execer)) {
return nil, types.ErrExecNameNotMatch
}
c.prefix = types.CalcStatePrefix([]byte(execer))
......@@ -50,7 +57,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) {
execer := c.userExecName(payload.Name)
if string(tx.Execer) != execer {
if !c.chechJsName(string(tx.Execer)) {
return nil, types.ErrExecNameNotMatch
}
c.prefix = types.CalcStatePrefix([]byte(execer))
......
......@@ -4,7 +4,6 @@ import (
"fmt"
"github.com/33cn/chain33/types"
ptypes "github.com/33cn/plugin/plugin/dapp/js/types"
"github.com/33cn/plugin/plugin/dapp/js/types/jsproto"
)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment