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
786a2ed7
Commit
786a2ed7
authored
Dec 14, 2018
by
vipwzw
Committed by
33cn
Dec 15, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
4bf72cdd
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
38 additions
and
9 deletions
+38
-9
create_plugin_file_template.go
...chain33/cmd/tools/strategy/create_plugin_file_template.go
+3
-3
jrpchandler_test.go
vendor/github.com/33cn/chain33/rpc/jrpchandler_test.go
+1
-1
jsonclient.go
vendor/github.com/33cn/chain33/rpc/jsonclient/jsonclient.go
+1
-2
rpc_real_test.go
vendor/github.com/33cn/chain33/rpc/rpc_real_test.go
+21
-0
error.go
vendor/github.com/33cn/chain33/types/error.go
+1
-0
executor.go
vendor/github.com/33cn/chain33/types/executor.go
+8
-1
types.go
vendor/github.com/33cn/chain33/types/types.go
+3
-2
No files found.
vendor/github.com/33cn/chain33/cmd/tools/strategy/create_plugin_file_template.go
View file @
786a2ed7
...
...
@@ -376,8 +376,8 @@ func init() {
import (
log "github.com/inconshreveable/log15"
drivers "git
lab.33.cn/chain33
/chain33/system/dapp"
"git
lab.33.cn/chain33
/chain33/types"
drivers "git
hub.com/33cn
/chain33/system/dapp"
"git
hub.com/33cn
/chain33/types"
)
var clog = log.New("module", "execs.${EXECNAME}")
...
...
@@ -453,7 +453,7 @@ message ${ACTIONNAME}None {
CpftDappTypefile
=
`package types
import (
"git
lab.33.cn/chain33
/chain33/types"
"git
hub.com/33cn
/chain33/types"
)
var (
...
...
vendor/github.com/33cn/chain33/rpc/jrpchandler_test.go
View file @
786a2ed7
...
...
@@ -1229,7 +1229,7 @@ func TestChain33_CreateTransaction(t *testing.T) {
in
:=
&
rpctypes
.
CreateTxIn
{
Execer
:
"notExist"
,
ActionName
:
"x"
,
Payload
:
[]
byte
(
"x"
)}
err
=
client
.
CreateTransaction
(
in
,
&
result
)
assert
.
Equal
(
t
,
types
.
Err
NotSupport
,
err
)
assert
.
Equal
(
t
,
types
.
Err
ExecNotFound
,
err
)
in
=
&
rpctypes
.
CreateTxIn
{
Execer
:
types
.
ExecName
(
"coins"
),
ActionName
:
"notExist"
,
Payload
:
[]
byte
(
"x"
)}
err
=
client
.
CreateTransaction
(
in
,
&
result
)
...
...
vendor/github.com/33cn/chain33/rpc/jsonclient/jsonclient.go
View file @
786a2ed7
...
...
@@ -70,7 +70,7 @@ func (client *JSONClient) Call(method string, params, resp interface{}) error {
req
:=
&
clientRequest
{}
req
.
Method
=
method
req
.
Params
[
0
]
=
params
data
,
err
:=
json
.
Marshal
Indent
(
req
,
""
,
"
\t
"
)
data
,
err
:=
json
.
Marshal
(
req
)
if
err
!=
nil
{
return
err
}
...
...
@@ -116,5 +116,4 @@ func (client *JSONClient) Call(method string, params, resp interface{}) error {
return
types
.
JSONToPB
(
b
,
msg
)
}
return
json
.
Unmarshal
(
*
cresp
.
Result
,
resp
)
}
vendor/github.com/33cn/chain33/rpc/rpc_real_test.go
View file @
786a2ed7
...
...
@@ -5,6 +5,7 @@
package
rpc_test
import
(
"fmt"
"testing"
"github.com/33cn/chain33/common"
...
...
@@ -113,3 +114,23 @@ func TestGetAllExecBalance(t *testing.T) {
assert
.
Nil
(
t
,
res
.
ExecAccount
)
assert
.
Equal
(
t
,
0
,
len
(
res
.
ExecAccount
))
}
func
TestCreateTransactionUserWrite
(
t
*
testing
.
T
)
{
mocker
:=
testnode
.
New
(
"--free--"
,
nil
)
defer
mocker
.
Close
()
mocker
.
Listen
()
jrpcClient
:=
getRPCClient
(
t
,
mocker
)
req
:=
&
rpctypes
.
CreateTxIn
{
Execer
:
"user.write"
,
ActionName
:
"write"
,
Payload
:
[]
byte
(
`{"key":"value"}`
),
}
var
res
string
err
:=
jrpcClient
.
Call
(
"Chain33.CreateTransaction"
,
req
,
&
res
)
assert
.
Nil
(
t
,
err
)
tx
:=
getTx
(
t
,
res
)
assert
.
NotNil
(
t
,
tx
)
fmt
.
Println
(
string
(
tx
.
Payload
))
assert
.
Nil
(
t
,
err
)
assert
.
Equal
(
t
,
`{"key":"value"}`
,
string
(
tx
.
Payload
))
}
vendor/github.com/33cn/chain33/types/error.go
View file @
786a2ed7
...
...
@@ -59,6 +59,7 @@ var (
ErrEmpty
=
errors
.
New
(
"ErrEmpty"
)
ErrSendSameToRecv
=
errors
.
New
(
"ErrSendSameToRecv"
)
ErrExecNameNotAllow
=
errors
.
New
(
"ErrExecNameNotAllow"
)
ErrExecNotFound
=
errors
.
New
(
"ErrExecNotFound"
)
ErrLocalDBPerfix
=
errors
.
New
(
"ErrLocalDBPerfix"
)
ErrTimeout
=
errors
.
New
(
"ErrTimeout"
)
ErrBlockHeaderDifficulty
=
errors
.
New
(
"ErrBlockHeaderDifficulty"
)
...
...
vendor/github.com/33cn/chain33/types/executor.go
View file @
786a2ed7
...
...
@@ -5,6 +5,7 @@
package
types
import
(
"bytes"
"encoding/json"
"math/rand"
"reflect"
...
...
@@ -137,8 +138,14 @@ func CallCreateTx(execName, action string, param Message) ([]byte, error) {
func
CallCreateTxJSON
(
execName
,
action
string
,
param
json
.
RawMessage
)
([]
byte
,
error
)
{
exec
:=
LoadExecutorType
(
execName
)
if
exec
==
nil
{
execer
:=
GetParaExecName
([]
byte
(
execName
))
//找不到执行器,并且是user.xxx 的情况下
if
bytes
.
HasPrefix
(
execer
,
UserKey
)
{
tx
:=
&
Transaction
{
Payload
:
param
}
return
FormatTxEncode
(
execName
,
tx
)
}
tlog
.
Error
(
"CallCreateTxJSON"
,
"Error"
,
"exec not found"
)
return
nil
,
Err
NotSupport
return
nil
,
Err
ExecNotFound
}
// param is interface{type, var-nil}, check with nil always fail
if
param
==
nil
{
...
...
vendor/github.com/33cn/chain33/types/types.go
View file @
786a2ed7
...
...
@@ -142,7 +142,8 @@ func GetParaExec(execer []byte) []byte {
return
execer
[
len
(
GetTitle
())
:
]
}
func
getParaExecName
(
execer
[]
byte
)
[]
byte
{
//GetParaExecName 获取平行链上的执行器
func
GetParaExecName
(
execer
[]
byte
)
[]
byte
{
if
!
bytes
.
HasPrefix
(
execer
,
ParaKey
)
{
return
execer
}
...
...
@@ -162,7 +163,7 @@ func getParaExecName(execer []byte) []byte {
//GetRealExecName 获取真实的执行器name
func
GetRealExecName
(
execer
[]
byte
)
[]
byte
{
//平行链执行器,获取真实执行器的规则
execer
=
g
etParaExecName
(
execer
)
execer
=
G
etParaExecName
(
execer
)
//平行链嵌套平行链是不被允许的
if
bytes
.
HasPrefix
(
execer
,
ParaKey
)
{
return
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