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
144f7493
Commit
144f7493
authored
Jan 25, 2019
by
kingwang
Committed by
33cn
Jan 25, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update 01/25
parent
3f366492
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
24 changed files
with
51 additions
and
105 deletions
+51
-105
account.go
vendor/github.com/33cn/chain33/account/account.go
+1
-1
table_test.go
vendor/github.com/33cn/chain33/common/db/table/table_test.go
+1
-1
db.go
vendor/github.com/33cn/chain33/executor/db.go
+5
-2
execenv.go
vendor/github.com/33cn/chain33/executor/execenv.go
+2
-2
executor.go
vendor/github.com/33cn/chain33/executor/executor.go
+12
-5
plugin_addrindex.go
vendor/github.com/33cn/chain33/executor/plugin_addrindex.go
+1
-1
plugin_fee.go
vendor/github.com/33cn/chain33/executor/plugin_fee.go
+1
-1
plugin_kvmvcc.go
vendor/github.com/33cn/chain33/executor/plugin_kvmvcc.go
+4
-5
plugin_stat.go
vendor/github.com/33cn/chain33/executor/plugin_stat.go
+9
-5
plugin_txindex.go
vendor/github.com/33cn/chain33/executor/plugin_txindex.go
+1
-1
client.go
vendor/github.com/33cn/chain33/rpc/client.go
+0
-3
grpchandler_test.go
vendor/github.com/33cn/chain33/rpc/grpchandler_test.go
+0
-2
jrpchandler.go
vendor/github.com/33cn/chain33/rpc/jrpchandler.go
+7
-53
jrpchandler_test.go
vendor/github.com/33cn/chain33/rpc/jrpchandler_test.go
+0
-2
server_test.go
vendor/github.com/33cn/chain33/rpc/server_test.go
+0
-5
types.go
vendor/github.com/33cn/chain33/rpc/types/types.go
+0
-1
block.go
vendor/github.com/33cn/chain33/system/dapp/commands/block.go
+2
-1
tx.go
vendor/github.com/33cn/chain33/system/dapp/commands/tx.go
+0
-3
wallet.go
...or/github.com/33cn/chain33/system/dapp/commands/wallet.go
+0
-3
transaction.proto
vendor/github.com/33cn/chain33/types/proto/transaction.proto
+2
-2
wallet.proto
vendor/github.com/33cn/chain33/types/proto/wallet.proto
+3
-3
transaction.pb.go
vendor/github.com/33cn/chain33/types/transaction.pb.go
+0
-0
wallet.pb.go
vendor/github.com/33cn/chain33/types/wallet.pb.go
+0
-0
wallet_proc.go
vendor/github.com/33cn/chain33/wallet/wallet_proc.go
+0
-3
No files found.
vendor/github.com/33cn/chain33/account/account.go
View file @
144f7493
...
@@ -277,7 +277,7 @@ func (acc *DB) loadAccountsHistory(api client.QueueProtocolAPI, addrs []string,
...
@@ -277,7 +277,7 @@ func (acc *DB) loadAccountsHistory(api client.QueueProtocolAPI, addrs []string,
// GetBalance 获取某个状态下账户余额
// GetBalance 获取某个状态下账户余额
func
(
acc
*
DB
)
GetBalance
(
api
client
.
QueueProtocolAPI
,
in
*
types
.
ReqBalance
)
([]
*
types
.
Account
,
error
)
{
func
(
acc
*
DB
)
GetBalance
(
api
client
.
QueueProtocolAPI
,
in
*
types
.
ReqBalance
)
([]
*
types
.
Account
,
error
)
{
// load account
// load account
if
in
.
AssetExec
==
in
.
Execer
||
""
==
in
.
Execer
{
if
in
.
AssetExec
==
string
(
types
.
GetParaExec
([]
byte
(
in
.
Execer
)))
||
""
==
in
.
Execer
{
addrs
:=
in
.
GetAddresses
()
addrs
:=
in
.
GetAddresses
()
var
exaddrs
[]
string
var
exaddrs
[]
string
for
_
,
addr
:=
range
addrs
{
for
_
,
addr
:=
range
addrs
{
...
...
vendor/github.com/33cn/chain33/common/db/table/table_test.go
View file @
144f7493
...
@@ -355,7 +355,7 @@ func TestReplace(t *testing.T) {
...
@@ -355,7 +355,7 @@ func TestReplace(t *testing.T) {
dir
,
ldb
,
kvdb
:=
util
.
CreateTestDB
()
dir
,
ldb
,
kvdb
:=
util
.
CreateTestDB
()
defer
util
.
CloseTestDB
(
dir
,
ldb
)
defer
util
.
CloseTestDB
(
dir
,
ldb
)
opt
:=
&
Option
{
opt
:=
&
Option
{
Prefix
:
"prefix"
,
Prefix
:
"prefix
-hello
"
,
Name
:
"name"
,
Name
:
"name"
,
Primary
:
"Hash"
,
Primary
:
"Hash"
,
Index
:
[]
string
{
"From"
,
"To"
},
Index
:
[]
string
{
"From"
,
"To"
},
...
...
vendor/github.com/33cn/chain33/executor/db.go
View file @
144f7493
...
@@ -51,10 +51,13 @@ func NewStateDB(client queue.Client, stateHash []byte, localdb db.KVDB, opt *Sta
...
@@ -51,10 +51,13 @@ func NewStateDB(client queue.Client, stateHash []byte, localdb db.KVDB, opt *Sta
return
db
return
db
}
}
func
(
s
*
StateDB
)
enableMVCC
()
{
func
(
s
*
StateDB
)
enableMVCC
(
hash
[]
byte
)
{
opt
:=
s
.
opt
opt
:=
s
.
opt
if
opt
.
EnableMVCC
{
if
opt
.
EnableMVCC
{
v
,
err
:=
s
.
local
.
GetVersion
(
s
.
stateHash
)
if
hash
==
nil
{
hash
=
s
.
stateHash
}
v
,
err
:=
s
.
local
.
GetVersion
(
hash
)
if
err
==
nil
&&
v
>=
0
{
if
err
==
nil
&&
v
>=
0
{
s
.
version
=
v
s
.
version
=
v
}
else
if
s
.
height
>
0
{
}
else
if
s
.
height
>
0
{
...
...
vendor/github.com/33cn/chain33/executor/execenv.go
View file @
144f7493
...
@@ -66,8 +66,8 @@ func newExecutor(ctx *executorCtx, exec *Executor, txs []*types.Transaction, rec
...
@@ -66,8 +66,8 @@ func newExecutor(ctx *executorCtx, exec *Executor, txs []*types.Transaction, rec
return
e
return
e
}
}
func
(
e
*
executor
)
enableMVCC
()
{
func
(
e
*
executor
)
enableMVCC
(
hash
[]
byte
)
{
e
.
stateDB
.
(
*
StateDB
)
.
enableMVCC
()
e
.
stateDB
.
(
*
StateDB
)
.
enableMVCC
(
hash
)
}
}
// AddMVCC convert key value to mvcc kv data
// AddMVCC convert key value to mvcc kv data
...
...
vendor/github.com/33cn/chain33/executor/executor.go
View file @
144f7493
...
@@ -147,7 +147,7 @@ func (exec *Executor) procExecQuery(msg queue.Message) {
...
@@ -147,7 +147,7 @@ func (exec *Executor) procExecQuery(msg queue.Message) {
opt
:=
&
StateDBOption
{
EnableMVCC
:
exec
.
pluginEnable
[
"mvcc"
],
Height
:
header
.
GetHeight
()}
opt
:=
&
StateDBOption
{
EnableMVCC
:
exec
.
pluginEnable
[
"mvcc"
],
Height
:
header
.
GetHeight
()}
db
:=
NewStateDB
(
exec
.
client
,
data
.
StateHash
,
localdb
,
opt
)
db
:=
NewStateDB
(
exec
.
client
,
data
.
StateHash
,
localdb
,
opt
)
db
.
(
*
StateDB
)
.
enableMVCC
()
db
.
(
*
StateDB
)
.
enableMVCC
(
nil
)
driver
.
SetStateDB
(
db
)
driver
.
SetStateDB
(
db
)
driver
.
SetAPI
(
exec
.
qclient
)
driver
.
SetAPI
(
exec
.
qclient
)
driver
.
SetExecutorAPI
(
exec
.
qclient
,
exec
.
grpccli
)
driver
.
SetExecutorAPI
(
exec
.
qclient
,
exec
.
grpccli
)
...
@@ -174,7 +174,7 @@ func (exec *Executor) procExecCheckTx(msg queue.Message) {
...
@@ -174,7 +174,7 @@ func (exec *Executor) procExecCheckTx(msg queue.Message) {
parentHash
:
datas
.
ParentHash
,
parentHash
:
datas
.
ParentHash
,
}
}
execute
:=
newExecutor
(
ctx
,
exec
,
datas
.
Txs
,
nil
)
execute
:=
newExecutor
(
ctx
,
exec
,
datas
.
Txs
,
nil
)
execute
.
enableMVCC
()
execute
.
enableMVCC
(
nil
)
//返回一个列表表示成功还是失败
//返回一个列表表示成功还是失败
result
:=
&
types
.
ReceiptCheckTxList
{}
result
:=
&
types
.
ReceiptCheckTxList
{}
for
i
:=
0
;
i
<
len
(
datas
.
Txs
);
i
++
{
for
i
:=
0
;
i
<
len
(
datas
.
Txs
);
i
++
{
...
@@ -205,7 +205,7 @@ func (exec *Executor) procExecTxList(msg queue.Message) {
...
@@ -205,7 +205,7 @@ func (exec *Executor) procExecTxList(msg queue.Message) {
parentHash
:
datas
.
ParentHash
,
parentHash
:
datas
.
ParentHash
,
}
}
execute
:=
newExecutor
(
ctx
,
exec
,
datas
.
Txs
,
nil
)
execute
:=
newExecutor
(
ctx
,
exec
,
datas
.
Txs
,
nil
)
execute
.
enableMVCC
()
execute
.
enableMVCC
(
nil
)
var
receipts
[]
*
types
.
Receipt
var
receipts
[]
*
types
.
Receipt
index
:=
0
index
:=
0
for
i
:=
0
;
i
<
len
(
datas
.
Txs
);
i
++
{
for
i
:=
0
;
i
<
len
(
datas
.
Txs
);
i
++
{
...
@@ -274,7 +274,8 @@ func (exec *Executor) procExecAddBlock(msg queue.Message) {
...
@@ -274,7 +274,8 @@ func (exec *Executor) procExecAddBlock(msg queue.Message) {
parentHash
:
b
.
ParentHash
,
parentHash
:
b
.
ParentHash
,
}
}
execute
:=
newExecutor
(
ctx
,
exec
,
b
.
Txs
,
datas
.
Receipts
)
execute
:=
newExecutor
(
ctx
,
exec
,
b
.
Txs
,
datas
.
Receipts
)
execute
.
enableMVCC
()
//因为mvcc 还没有写入,所以目前的mvcc版本是前一个区块的版本
execute
.
enableMVCC
(
datas
.
PrevStatusHash
)
var
kvset
types
.
LocalDBSet
var
kvset
types
.
LocalDBSet
for
_
,
kv
:=
range
datas
.
KV
{
for
_
,
kv
:=
range
datas
.
KV
{
execute
.
stateDB
.
Set
(
kv
.
Key
,
kv
.
Value
)
execute
.
stateDB
.
Set
(
kv
.
Key
,
kv
.
Value
)
...
@@ -297,6 +298,9 @@ func (exec *Executor) procExecAddBlock(msg queue.Message) {
...
@@ -297,6 +298,9 @@ func (exec *Executor) procExecAddBlock(msg queue.Message) {
}
}
if
len
(
kvs
)
>
0
{
if
len
(
kvs
)
>
0
{
kvset
.
KV
=
append
(
kvset
.
KV
,
kvs
...
)
kvset
.
KV
=
append
(
kvset
.
KV
,
kvs
...
)
for
_
,
kv
:=
range
kvs
{
execute
.
localDB
.
Set
(
kv
.
Key
,
kv
.
Value
)
}
}
}
}
}
for
i
:=
0
;
i
<
len
(
b
.
Txs
);
i
++
{
for
i
:=
0
;
i
<
len
(
b
.
Txs
);
i
++
{
...
@@ -316,6 +320,9 @@ func (exec *Executor) procExecAddBlock(msg queue.Message) {
...
@@ -316,6 +320,9 @@ func (exec *Executor) procExecAddBlock(msg queue.Message) {
return
return
}
}
kvset
.
KV
=
append
(
kvset
.
KV
,
kv
.
KV
...
)
kvset
.
KV
=
append
(
kvset
.
KV
,
kv
.
KV
...
)
for
_
,
kv
:=
range
kv
.
KV
{
execute
.
localDB
.
Set
(
kv
.
Key
,
kv
.
Value
)
}
}
}
}
}
msg
.
Reply
(
exec
.
client
.
NewMessage
(
""
,
types
.
EventAddBlock
,
&
kvset
))
msg
.
Reply
(
exec
.
client
.
NewMessage
(
""
,
types
.
EventAddBlock
,
&
kvset
))
...
@@ -334,7 +341,7 @@ func (exec *Executor) procExecDelBlock(msg queue.Message) {
...
@@ -334,7 +341,7 @@ func (exec *Executor) procExecDelBlock(msg queue.Message) {
parentHash
:
b
.
ParentHash
,
parentHash
:
b
.
ParentHash
,
}
}
execute
:=
newExecutor
(
ctx
,
exec
,
b
.
Txs
,
nil
)
execute
:=
newExecutor
(
ctx
,
exec
,
b
.
Txs
,
nil
)
execute
.
enableMVCC
()
execute
.
enableMVCC
(
nil
)
var
kvset
types
.
LocalDBSet
var
kvset
types
.
LocalDBSet
for
_
,
kv
:=
range
datas
.
KV
{
for
_
,
kv
:=
range
datas
.
KV
{
execute
.
stateDB
.
Set
(
kv
.
Key
,
kv
.
Value
)
execute
.
stateDB
.
Set
(
kv
.
Key
,
kv
.
Value
)
...
...
vendor/github.com/33cn/chain33/executor/plugin_addrindex.go
View file @
144f7493
...
@@ -15,7 +15,7 @@ func init() {
...
@@ -15,7 +15,7 @@ func init() {
}
}
type
addrindexPlugin
struct
{
type
addrindexPlugin
struct
{
*
pluginBase
pluginBase
}
}
func
(
p
*
addrindexPlugin
)
CheckEnable
(
executor
*
executor
,
enable
bool
)
(
kvs
[]
*
types
.
KeyValue
,
ok
bool
,
err
error
)
{
func
(
p
*
addrindexPlugin
)
CheckEnable
(
executor
*
executor
,
enable
bool
)
(
kvs
[]
*
types
.
KeyValue
,
ok
bool
,
err
error
)
{
...
...
vendor/github.com/33cn/chain33/executor/plugin_fee.go
View file @
144f7493
...
@@ -11,7 +11,7 @@ func init() {
...
@@ -11,7 +11,7 @@ func init() {
}
}
type
feePlugin
struct
{
type
feePlugin
struct
{
*
pluginBase
pluginBase
fee
types
.
TotalFee
fee
types
.
TotalFee
}
}
...
...
vendor/github.com/33cn/chain33/executor/plugin_kvmvcc.go
View file @
144f7493
...
@@ -4,14 +4,16 @@
...
@@ -4,14 +4,16 @@
package
executor
package
executor
import
"github.com/33cn/chain33/types"
import
(
"github.com/33cn/chain33/types"
)
func
init
()
{
func
init
()
{
RegisterPlugin
(
"mvcc"
,
&
mvccPlugin
{})
RegisterPlugin
(
"mvcc"
,
&
mvccPlugin
{})
}
}
type
mvccPlugin
struct
{
type
mvccPlugin
struct
{
*
pluginBase
pluginBase
}
}
func
(
p
*
mvccPlugin
)
CheckEnable
(
executor
*
executor
,
enable
bool
)
(
kvs
[]
*
types
.
KeyValue
,
ok
bool
,
err
error
)
{
func
(
p
*
mvccPlugin
)
CheckEnable
(
executor
*
executor
,
enable
bool
)
(
kvs
[]
*
types
.
KeyValue
,
ok
bool
,
err
error
)
{
...
@@ -24,9 +26,6 @@ func (p *mvccPlugin) CheckEnable(executor *executor, enable bool) (kvs []*types.
...
@@ -24,9 +26,6 @@ func (p *mvccPlugin) CheckEnable(executor *executor, enable bool) (kvs []*types.
func
(
p
*
mvccPlugin
)
ExecLocal
(
executor
*
executor
,
data
*
types
.
BlockDetail
)
(
kvs
[]
*
types
.
KeyValue
,
err
error
)
{
func
(
p
*
mvccPlugin
)
ExecLocal
(
executor
*
executor
,
data
*
types
.
BlockDetail
)
(
kvs
[]
*
types
.
KeyValue
,
err
error
)
{
kvs
=
AddMVCC
(
executor
.
localDB
,
data
)
kvs
=
AddMVCC
(
executor
.
localDB
,
data
)
for
_
,
kv
:=
range
kvs
{
executor
.
localDB
.
Set
(
kv
.
Key
,
kv
.
Value
)
}
return
kvs
,
nil
return
kvs
,
nil
}
}
...
...
vendor/github.com/33cn/chain33/executor/plugin_stat.go
View file @
144f7493
...
@@ -13,7 +13,7 @@ func init() {
...
@@ -13,7 +13,7 @@ func init() {
}
}
type
statPlugin
struct
{
type
statPlugin
struct
{
*
pluginBase
pluginBase
}
}
func
(
p
*
statPlugin
)
CheckEnable
(
executor
*
executor
,
enable
bool
)
(
kvs
[]
*
types
.
KeyValue
,
ok
bool
,
err
error
)
{
func
(
p
*
statPlugin
)
CheckEnable
(
executor
*
executor
,
enable
bool
)
(
kvs
[]
*
types
.
KeyValue
,
ok
bool
,
err
error
)
{
...
@@ -39,8 +39,10 @@ func countInfo(ex *executor, b *types.BlockDetail) ([]*types.KeyValue, error) {
...
@@ -39,8 +39,10 @@ func countInfo(ex *executor, b *types.BlockDetail) ([]*types.KeyValue, error) {
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
kvset
.
KV
=
append
(
kvset
.
KV
,
ticketkv
.
KV
...
)
if
ticketkv
==
nil
{
return
nil
,
nil
}
kvset
.
KV
=
ticketkv
.
KV
return
kvset
.
KV
,
nil
return
kvset
.
KV
,
nil
}
}
...
@@ -51,8 +53,10 @@ func delCountInfo(ex *executor, b *types.BlockDetail) ([]*types.KeyValue, error)
...
@@ -51,8 +53,10 @@ func delCountInfo(ex *executor, b *types.BlockDetail) ([]*types.KeyValue, error)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
kvset
.
KV
=
append
(
kvset
.
KV
,
ticketkv
.
KV
...
)
if
ticketkv
==
nil
{
return
nil
,
nil
}
kvset
.
KV
=
ticketkv
.
KV
return
kvset
.
KV
,
nil
return
kvset
.
KV
,
nil
}
}
...
...
vendor/github.com/33cn/chain33/executor/plugin_txindex.go
View file @
144f7493
...
@@ -16,7 +16,7 @@ func init() {
...
@@ -16,7 +16,7 @@ func init() {
}
}
type
txindexPlugin
struct
{
type
txindexPlugin
struct
{
*
pluginBase
pluginBase
}
}
func
(
p
*
txindexPlugin
)
CheckEnable
(
executor
*
executor
,
enable
bool
)
(
kvs
[]
*
types
.
KeyValue
,
ok
bool
,
err
error
)
{
func
(
p
*
txindexPlugin
)
CheckEnable
(
executor
*
executor
,
enable
bool
)
(
kvs
[]
*
types
.
KeyValue
,
ok
bool
,
err
error
)
{
...
...
vendor/github.com/33cn/chain33/rpc/client.go
View file @
144f7493
...
@@ -63,9 +63,6 @@ func (c *channelClient) ReWriteRawTx(param *types.ReWriteRawTx) ([]byte, error)
...
@@ -63,9 +63,6 @@ func (c *channelClient) ReWriteRawTx(param *types.ReWriteRawTx) ([]byte, error)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
if
param
.
Execer
!=
nil
{
tx
.
Execer
=
param
.
Execer
}
if
param
.
To
!=
""
{
if
param
.
To
!=
""
{
tx
.
To
=
param
.
To
tx
.
To
=
param
.
To
}
}
...
...
vendor/github.com/33cn/chain33/rpc/grpchandler_test.go
View file @
144f7493
...
@@ -1051,7 +1051,6 @@ func TestReWriteRawTx(t *testing.T) {
...
@@ -1051,7 +1051,6 @@ func TestReWriteRawTx(t *testing.T) {
txHex1
:=
"0a05636f696e73122c18010a281080c2d72f222131477444795771577233553637656a7663776d333867396e7a6e7a434b58434b7120a08d0630a696c0b3f78dd9ec083a2131477444795771577233553637656a7663776d333867396e7a6e7a434b58434b71"
txHex1
:=
"0a05636f696e73122c18010a281080c2d72f222131477444795771577233553637656a7663776d333867396e7a6e7a434b58434b7120a08d0630a696c0b3f78dd9ec083a2131477444795771577233553637656a7663776d333867396e7a6e7a434b58434b71"
in
:=
&
types
.
ReWriteRawTx
{
in
:=
&
types
.
ReWriteRawTx
{
Tx
:
txHex1
,
Tx
:
txHex1
,
Execer
:
[]
byte
(
"paracross"
),
Fee
:
29977777777
,
Fee
:
29977777777
,
Expire
:
"130s"
,
Expire
:
"130s"
,
To
:
"aabbccdd"
,
To
:
"aabbccdd"
,
...
@@ -1066,7 +1065,6 @@ func TestReWriteRawTx(t *testing.T) {
...
@@ -1066,7 +1065,6 @@ func TestReWriteRawTx(t *testing.T) {
tx
:=
&
types
.
Transaction
{}
tx
:=
&
types
.
Transaction
{}
err
=
types
.
Decode
(
data
.
Data
,
tx
)
err
=
types
.
Decode
(
data
.
Data
,
tx
)
assert
.
Nil
(
t
,
err
)
assert
.
Nil
(
t
,
err
)
assert
.
Equal
(
t
,
tx
.
Execer
,
[]
byte
(
in
.
Execer
))
assert
.
Equal
(
t
,
tx
.
Fee
,
in
.
Fee
)
assert
.
Equal
(
t
,
tx
.
Fee
,
in
.
Fee
)
assert
.
Equal
(
t
,
int64
(
130000000000
),
tx
.
Expire
)
assert
.
Equal
(
t
,
int64
(
130000000000
),
tx
.
Expire
)
assert
.
Equal
(
t
,
in
.
To
,
tx
.
To
)
assert
.
Equal
(
t
,
in
.
To
,
tx
.
To
)
...
...
vendor/github.com/33cn/chain33/rpc/jrpchandler.go
View file @
144f7493
...
@@ -48,7 +48,6 @@ func (c *Chain33) CreateRawTransaction(in *rpctypes.CreateTx, result *interface{
...
@@ -48,7 +48,6 @@ func (c *Chain33) CreateRawTransaction(in *rpctypes.CreateTx, result *interface{
func
(
c
*
Chain33
)
ReWriteRawTx
(
in
*
rpctypes
.
ReWriteRawTx
,
result
*
interface
{})
error
{
func
(
c
*
Chain33
)
ReWriteRawTx
(
in
*
rpctypes
.
ReWriteRawTx
,
result
*
interface
{})
error
{
inpb
:=
&
types
.
ReWriteRawTx
{
inpb
:=
&
types
.
ReWriteRawTx
{
Tx
:
in
.
Tx
,
Tx
:
in
.
Tx
,
Execer
:
[]
byte
(
in
.
Execer
),
To
:
in
.
To
,
To
:
in
.
To
,
Fee
:
in
.
Fee
,
Fee
:
in
.
Fee
,
Expire
:
in
.
Expire
,
Expire
:
in
.
Expire
,
...
@@ -874,6 +873,9 @@ func (c *Chain33) IsNtpClockSync(in *types.ReqNil, result *interface{}) error {
...
@@ -874,6 +873,9 @@ func (c *Chain33) IsNtpClockSync(in *types.ReqNil, result *interface{}) error {
// QueryTotalFee query total fee
// QueryTotalFee query total fee
func
(
c
*
Chain33
)
QueryTotalFee
(
in
*
types
.
LocalDBGet
,
result
*
interface
{})
error
{
func
(
c
*
Chain33
)
QueryTotalFee
(
in
*
types
.
LocalDBGet
,
result
*
interface
{})
error
{
if
in
==
nil
||
len
(
in
.
Keys
)
>
1
{
return
types
.
ErrInvalidParam
}
reply
,
err
:=
c
.
cli
.
LocalGet
(
in
)
reply
,
err
:=
c
.
cli
.
LocalGet
(
in
)
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
...
@@ -925,58 +927,6 @@ func (c *Chain33) GetFatalFailure(in *types.ReqNil, result *interface{}) error {
...
@@ -925,58 +927,6 @@ func (c *Chain33) GetFatalFailure(in *types.ReqNil, result *interface{}) error {
}
}
// QueryTicketStat quert stat of ticket
func
(
c
*
Chain33
)
QueryTicketStat
(
in
*
types
.
LocalDBGet
,
result
*
interface
{})
error
{
reply
,
err
:=
c
.
cli
.
LocalGet
(
in
)
if
err
!=
nil
{
return
err
}
var
ticketStat
types
.
TicketStatistic
err
=
types
.
Decode
(
reply
.
Values
[
0
],
&
ticketStat
)
if
err
!=
nil
{
return
err
}
*
result
=
ticketStat
return
nil
}
// QueryTicketInfo query ticket information
func
(
c
*
Chain33
)
QueryTicketInfo
(
in
*
types
.
LocalDBGet
,
result
*
interface
{})
error
{
reply
,
err
:=
c
.
cli
.
LocalGet
(
in
)
if
err
!=
nil
{
return
err
}
var
ticketInfo
types
.
TicketMinerInfo
err
=
types
.
Decode
(
reply
.
Values
[
0
],
&
ticketInfo
)
if
err
!=
nil
{
return
err
}
*
result
=
ticketInfo
return
nil
}
// QueryTicketInfoList query ticket list information
func
(
c
*
Chain33
)
QueryTicketInfoList
(
in
*
types
.
LocalDBList
,
result
*
interface
{})
error
{
reply
,
err
:=
c
.
cli
.
LocalList
(
in
)
if
err
!=
nil
{
return
err
}
var
ticketInfo
types
.
TicketMinerInfo
var
ticketList
[]
types
.
TicketMinerInfo
for
_
,
v
:=
range
reply
.
Values
{
err
=
types
.
Decode
(
v
,
&
ticketInfo
)
if
err
!=
nil
{
return
err
}
ticketList
=
append
(
ticketList
,
ticketInfo
)
}
*
result
=
ticketList
return
nil
}
// DecodeRawTransaction decode rawtransaction
// DecodeRawTransaction decode rawtransaction
func
(
c
*
Chain33
)
DecodeRawTransaction
(
in
*
types
.
ReqDecodeRawTransaction
,
result
*
interface
{})
error
{
func
(
c
*
Chain33
)
DecodeRawTransaction
(
in
*
types
.
ReqDecodeRawTransaction
,
result
*
interface
{})
error
{
reply
,
err
:=
c
.
cli
.
DecodeRawTransaction
(
in
)
reply
,
err
:=
c
.
cli
.
DecodeRawTransaction
(
in
)
...
@@ -1152,6 +1102,10 @@ func convertBlockDetails(details []*types.BlockDetail, retDetails *rpctypes.Bloc
...
@@ -1152,6 +1102,10 @@ func convertBlockDetails(details []*types.BlockDetail, retDetails *rpctypes.Bloc
for
_
,
item
:=
range
details
{
for
_
,
item
:=
range
details
{
var
bdtl
rpctypes
.
BlockDetail
var
bdtl
rpctypes
.
BlockDetail
var
block
rpctypes
.
Block
var
block
rpctypes
.
Block
if
item
==
nil
{
retDetails
.
Items
=
append
(
retDetails
.
Items
,
nil
)
continue
}
block
.
BlockTime
=
item
.
Block
.
GetBlockTime
()
block
.
BlockTime
=
item
.
Block
.
GetBlockTime
()
block
.
Height
=
item
.
Block
.
GetHeight
()
block
.
Height
=
item
.
Block
.
GetHeight
()
block
.
Version
=
item
.
Block
.
GetVersion
()
block
.
Version
=
item
.
Block
.
GetVersion
()
...
...
vendor/github.com/33cn/chain33/rpc/jrpchandler_test.go
View file @
144f7493
...
@@ -413,7 +413,6 @@ func TestChain33_ReWriteRawTx(t *testing.T) {
...
@@ -413,7 +413,6 @@ func TestChain33_ReWriteRawTx(t *testing.T) {
reTx
:=
&
rpctypes
.
ReWriteRawTx
{
reTx
:=
&
rpctypes
.
ReWriteRawTx
{
Tx
:
txHex1
,
Tx
:
txHex1
,
Execer
:
"paracross"
,
Fee
:
29977777777
,
Fee
:
29977777777
,
Expire
:
"130s"
,
Expire
:
"130s"
,
To
:
"aabbccdd"
,
To
:
"aabbccdd"
,
...
@@ -428,7 +427,6 @@ func TestChain33_ReWriteRawTx(t *testing.T) {
...
@@ -428,7 +427,6 @@ func TestChain33_ReWriteRawTx(t *testing.T) {
tx
:=
&
types
.
Transaction
{}
tx
:=
&
types
.
Transaction
{}
err
=
types
.
Decode
(
txData
,
tx
)
err
=
types
.
Decode
(
txData
,
tx
)
assert
.
Nil
(
t
,
err
)
assert
.
Nil
(
t
,
err
)
assert
.
Equal
(
t
,
tx
.
Execer
,
[]
byte
(
reTx
.
Execer
))
assert
.
Equal
(
t
,
tx
.
Fee
,
reTx
.
Fee
)
assert
.
Equal
(
t
,
tx
.
Fee
,
reTx
.
Fee
)
assert
.
Equal
(
t
,
int64
(
130000000000
),
tx
.
Expire
)
assert
.
Equal
(
t
,
int64
(
130000000000
),
tx
.
Expire
)
assert
.
Equal
(
t
,
reTx
.
To
,
tx
.
To
)
assert
.
Equal
(
t
,
reTx
.
To
,
tx
.
To
)
...
...
vendor/github.com/33cn/chain33/rpc/server_test.go
View file @
144f7493
...
@@ -104,11 +104,6 @@ func TestJSONClient_Call(t *testing.T) {
...
@@ -104,11 +104,6 @@ func TestJSONClient_Call(t *testing.T) {
err
=
jsonClient
.
Call
(
"Chain33.QueryTotalFee"
,
&
types
.
ReqSignRawTx
{},
&
fee
)
err
=
jsonClient
.
Call
(
"Chain33.QueryTotalFee"
,
&
types
.
ReqSignRawTx
{},
&
fee
)
assert
.
NotNil
(
t
,
err
)
assert
.
NotNil
(
t
,
err
)
var
ticket
[]
types
.
TicketMinerInfo
api
.
On
(
"LocalList"
,
mock
.
Anything
)
.
Return
(
nil
,
errors
.
New
(
"error value"
))
err
=
jsonClient
.
Call
(
"Chain33.QueryTicketInfoList"
,
&
types
.
ReqSignRawTx
{},
&
ticket
)
assert
.
NotNil
(
t
,
err
)
var
retNtp
bool
var
retNtp
bool
api
.
On
(
"IsNtpClockSync"
,
mock
.
Anything
)
.
Return
(
&
types
.
Reply
{
IsOk
:
true
,
Msg
:
[]
byte
(
"yes"
)},
nil
)
api
.
On
(
"IsNtpClockSync"
,
mock
.
Anything
)
.
Return
(
&
types
.
Reply
{
IsOk
:
true
,
Msg
:
[]
byte
(
"yes"
)},
nil
)
err
=
jsonClient
.
Call
(
"Chain33.IsNtpClockSync"
,
&
types
.
ReqNil
{},
&
retNtp
)
err
=
jsonClient
.
Call
(
"Chain33.IsNtpClockSync"
,
&
types
.
ReqNil
{},
&
retNtp
)
...
...
vendor/github.com/33cn/chain33/rpc/types/types.go
View file @
144f7493
...
@@ -377,7 +377,6 @@ type CreateTx struct {
...
@@ -377,7 +377,6 @@ type CreateTx struct {
// ReWriteRawTx parameter
// ReWriteRawTx parameter
type
ReWriteRawTx
struct
{
type
ReWriteRawTx
struct
{
Tx
string
`json:"tx"`
Tx
string
`json:"tx"`
Execer
string
`json:"execer"`
To
string
`json:"to"`
To
string
`json:"to"`
Fee
int64
`json:"fee"`
Fee
int64
`json:"fee"`
Expire
string
`json:"expire"`
Expire
string
`json:"expire"`
...
...
vendor/github.com/33cn/chain33/system/dapp/commands/block.go
View file @
144f7493
...
@@ -288,7 +288,8 @@ func addBlockByHashsFlags(cmd *cobra.Command) {
...
@@ -288,7 +288,8 @@ func addBlockByHashsFlags(cmd *cobra.Command) {
func
getblockbyhashs
(
cmd
*
cobra
.
Command
,
args
[]
string
)
{
func
getblockbyhashs
(
cmd
*
cobra
.
Command
,
args
[]
string
)
{
rpcLaddr
,
_
:=
cmd
.
Flags
()
.
GetString
(
"rpc_laddr"
)
rpcLaddr
,
_
:=
cmd
.
Flags
()
.
GetString
(
"rpc_laddr"
)
hashes
,
_
:=
cmd
.
Flags
()
.
GetString
(
"hashes"
)
hashes
,
_
:=
cmd
.
Flags
()
.
GetString
(
"hashes"
)
hashesArr
:=
strings
.
Split
(
hashes
,
" "
)
hashesArr
:=
strings
.
Fields
(
hashes
)
params
:=
rpctypes
.
ReqHashes
{
params
:=
rpctypes
.
ReqHashes
{
Hashes
:
hashesArr
,
Hashes
:
hashesArr
,
}
}
...
...
vendor/github.com/33cn/chain33/system/dapp/commands/tx.go
View file @
144f7493
...
@@ -320,7 +320,6 @@ func addReWriteRawTxFlags(cmd *cobra.Command) {
...
@@ -320,7 +320,6 @@ func addReWriteRawTxFlags(cmd *cobra.Command) {
cmd
.
Flags
()
.
StringP
(
"tx"
,
"s"
,
""
,
"transaction hex"
)
cmd
.
Flags
()
.
StringP
(
"tx"
,
"s"
,
""
,
"transaction hex"
)
cmd
.
MarkFlagRequired
(
"tx"
)
cmd
.
MarkFlagRequired
(
"tx"
)
cmd
.
Flags
()
.
StringP
(
"execer"
,
"x"
,
""
,
"transaction execer (optional)"
)
cmd
.
Flags
()
.
StringP
(
"to"
,
"t"
,
""
,
"to addr (optional)"
)
cmd
.
Flags
()
.
StringP
(
"to"
,
"t"
,
""
,
"to addr (optional)"
)
cmd
.
Flags
()
.
Float64P
(
"fee"
,
"f"
,
0
,
"transaction fee (optional)"
)
cmd
.
Flags
()
.
Float64P
(
"fee"
,
"f"
,
0
,
"transaction fee (optional)"
)
cmd
.
Flags
()
.
StringP
(
"expire"
,
"e"
,
"120s"
,
"expire time (optional)"
)
cmd
.
Flags
()
.
StringP
(
"expire"
,
"e"
,
"120s"
,
"expire time (optional)"
)
...
@@ -329,7 +328,6 @@ func addReWriteRawTxFlags(cmd *cobra.Command) {
...
@@ -329,7 +328,6 @@ func addReWriteRawTxFlags(cmd *cobra.Command) {
func
reWriteRawTx
(
cmd
*
cobra
.
Command
,
args
[]
string
)
{
func
reWriteRawTx
(
cmd
*
cobra
.
Command
,
args
[]
string
)
{
rpcLaddr
,
_
:=
cmd
.
Flags
()
.
GetString
(
"rpc_laddr"
)
rpcLaddr
,
_
:=
cmd
.
Flags
()
.
GetString
(
"rpc_laddr"
)
txHash
,
_
:=
cmd
.
Flags
()
.
GetString
(
"tx"
)
txHash
,
_
:=
cmd
.
Flags
()
.
GetString
(
"tx"
)
execer
,
_
:=
cmd
.
Flags
()
.
GetString
(
"execer"
)
to
,
_
:=
cmd
.
Flags
()
.
GetString
(
"to"
)
to
,
_
:=
cmd
.
Flags
()
.
GetString
(
"to"
)
fee
,
_
:=
cmd
.
Flags
()
.
GetFloat64
(
"fee"
)
fee
,
_
:=
cmd
.
Flags
()
.
GetFloat64
(
"fee"
)
expire
,
_
:=
cmd
.
Flags
()
.
GetString
(
"expire"
)
expire
,
_
:=
cmd
.
Flags
()
.
GetString
(
"expire"
)
...
@@ -342,7 +340,6 @@ func reWriteRawTx(cmd *cobra.Command, args []string) {
...
@@ -342,7 +340,6 @@ func reWriteRawTx(cmd *cobra.Command, args []string) {
params
:=
rpctypes
.
ReWriteRawTx
{
params
:=
rpctypes
.
ReWriteRawTx
{
Tx
:
txHash
,
Tx
:
txHash
,
Execer
:
execer
,
To
:
to
,
To
:
to
,
Fee
:
feeInt64
*
1e4
,
Fee
:
feeInt64
*
1e4
,
Expire
:
expire
,
Expire
:
expire
,
...
...
vendor/github.com/33cn/chain33/system/dapp/commands/wallet.go
View file @
144f7493
...
@@ -310,7 +310,6 @@ func addSignRawTxFlags(cmd *cobra.Command) {
...
@@ -310,7 +310,6 @@ func addSignRawTxFlags(cmd *cobra.Command) {
cmd
.
Flags
()
.
StringP
(
"addr"
,
"a"
,
""
,
"account address (optional)"
)
cmd
.
Flags
()
.
StringP
(
"addr"
,
"a"
,
""
,
"account address (optional)"
)
cmd
.
Flags
()
.
StringP
(
"expire"
,
"e"
,
"120s"
,
"transaction expire time"
)
cmd
.
Flags
()
.
StringP
(
"expire"
,
"e"
,
"120s"
,
"transaction expire time"
)
cmd
.
Flags
()
.
Float64P
(
"fee"
,
"f"
,
0
,
"transaction fee (optional)"
)
cmd
.
Flags
()
.
Float64P
(
"fee"
,
"f"
,
0
,
"transaction fee (optional)"
)
cmd
.
Flags
()
.
StringP
(
"execer"
,
"x"
,
""
,
"new transaction execer (optional)"
)
cmd
.
Flags
()
.
StringP
(
"to"
,
"t"
,
""
,
"new to addr (optional)"
)
cmd
.
Flags
()
.
StringP
(
"to"
,
"t"
,
""
,
"new to addr (optional)"
)
// A duration string is a possibly signed sequence of
// A duration string is a possibly signed sequence of
...
@@ -350,7 +349,6 @@ func signRawTx(cmd *cobra.Command, args []string) {
...
@@ -350,7 +349,6 @@ func signRawTx(cmd *cobra.Command, args []string) {
key
,
_
:=
cmd
.
Flags
()
.
GetString
(
"key"
)
key
,
_
:=
cmd
.
Flags
()
.
GetString
(
"key"
)
addr
,
_
:=
cmd
.
Flags
()
.
GetString
(
"addr"
)
addr
,
_
:=
cmd
.
Flags
()
.
GetString
(
"addr"
)
index
,
_
:=
cmd
.
Flags
()
.
GetInt32
(
"index"
)
index
,
_
:=
cmd
.
Flags
()
.
GetInt32
(
"index"
)
execer
,
_
:=
cmd
.
Flags
()
.
GetString
(
"execer"
)
to
,
_
:=
cmd
.
Flags
()
.
GetString
(
"to"
)
to
,
_
:=
cmd
.
Flags
()
.
GetString
(
"to"
)
fee
,
_
:=
cmd
.
Flags
()
.
GetFloat64
(
"fee"
)
fee
,
_
:=
cmd
.
Flags
()
.
GetFloat64
(
"fee"
)
expire
,
_
:=
cmd
.
Flags
()
.
GetString
(
"expire"
)
expire
,
_
:=
cmd
.
Flags
()
.
GetString
(
"expire"
)
...
@@ -367,7 +365,6 @@ func signRawTx(cmd *cobra.Command, args []string) {
...
@@ -367,7 +365,6 @@ func signRawTx(cmd *cobra.Command, args []string) {
Expire
:
expire
,
Expire
:
expire
,
Index
:
index
,
Index
:
index
,
Fee
:
feeInt64
*
1e4
,
Fee
:
feeInt64
*
1e4
,
NewExecer
:
[]
byte
(
execer
),
NewToAddr
:
to
,
NewToAddr
:
to
,
}
}
ctx
:=
jsonclient
.
NewRPCCtx
(
rpcLaddr
,
"Chain33.SignRawTx"
,
params
,
nil
)
ctx
:=
jsonclient
.
NewRPCCtx
(
rpcLaddr
,
"Chain33.SignRawTx"
,
params
,
nil
)
...
...
vendor/github.com/33cn/chain33/types/proto/transaction.proto
View file @
144f7493
...
@@ -53,8 +53,8 @@ message CreateTx {
...
@@ -53,8 +53,8 @@ message CreateTx {
}
}
message
ReWriteRawTx
{
message
ReWriteRawTx
{
string
tx
=
1
;
string
tx
=
1
;
bytes
execer
=
2
;
//
bytes execer = 2;
string
to
=
3
;
string
to
=
3
;
string
expire
=
4
;
string
expire
=
4
;
int64
fee
=
5
;
int64
fee
=
5
;
...
...
vendor/github.com/33cn/chain33/types/proto/wallet.proto
View file @
144f7493
...
@@ -204,9 +204,9 @@ message ReqSignRawTx {
...
@@ -204,9 +204,9 @@ message ReqSignRawTx {
// 0:普通交易
// 0:普通交易
// 1:隐私交易
// 1:隐私交易
// int32 mode = 6;
// int32 mode = 6;
string
token
=
7
;
string
token
=
7
;
int64
fee
=
8
;
int64
fee
=
8
;
bytes
newExecer
=
9
;
//
bytes newExecer = 9;
string
newToAddr
=
10
;
string
newToAddr
=
10
;
}
}
...
...
vendor/github.com/33cn/chain33/types/transaction.pb.go
View file @
144f7493
This diff is collapsed.
Click to expand it.
vendor/github.com/33cn/chain33/types/wallet.pb.go
View file @
144f7493
This diff is collapsed.
Click to expand it.
vendor/github.com/33cn/chain33/wallet/wallet_proc.go
View file @
144f7493
...
@@ -80,9 +80,6 @@ func (wallet *Wallet) ProcSignRawTx(unsigned *types.ReqSignRawTx) (string, error
...
@@ -80,9 +80,6 @@ func (wallet *Wallet) ProcSignRawTx(unsigned *types.ReqSignRawTx) (string, error
return
""
,
err
return
""
,
err
}
}
if
unsigned
.
GetNewExecer
()
!=
nil
{
tx
.
Execer
=
unsigned
.
NewExecer
}
if
unsigned
.
NewToAddr
!=
""
{
if
unsigned
.
NewToAddr
!=
""
{
tx
.
To
=
unsigned
.
NewToAddr
tx
.
To
=
unsigned
.
NewToAddr
}
}
...
...
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