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
a28e3aaf
Commit
a28e3aaf
authored
Apr 25, 2019
by
kingwang
Committed by
33cn
Apr 25, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update 04/25
parent
8be1cb21
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
52 additions
and
38 deletions
+52
-38
jrpchandler.go
vendor/github.com/33cn/chain33/rpc/jrpchandler.go
+20
-4
tx.go
vendor/github.com/33cn/chain33/system/dapp/commands/tx.go
+15
-27
chain33.go
vendor/github.com/33cn/chain33/util/cli/chain33.go
+1
-6
sendtx.go
vendor/github.com/33cn/chain33/wallet/sendtx.go
+6
-0
wallet_proc.go
vendor/github.com/33cn/chain33/wallet/wallet_proc.go
+10
-1
No files found.
vendor/github.com/33cn/chain33/rpc/jrpchandler.go
View file @
a28e3aaf
...
...
@@ -936,17 +936,33 @@ func (c *Chain33) GetFatalFailure(in *types.ReqNil, result *interface{}) error {
}
// DecodeRawTransaction
decode rawtransaction
// DecodeRawTransaction
考虑交易组的解析统一返回ReplyTxList列表
func
(
c
*
Chain33
)
DecodeRawTransaction
(
in
*
types
.
ReqDecodeRawTransaction
,
result
*
interface
{})
error
{
reply
,
err
:=
c
.
cli
.
DecodeRawTransaction
(
in
)
tx
,
err
:=
c
.
cli
.
DecodeRawTransaction
(
in
)
if
err
!=
nil
{
return
err
}
res
,
err
:=
rpctypes
.
DecodeTx
(
reply
)
txs
,
err
:=
tx
.
GetTxGroup
(
)
if
err
!=
nil
{
return
err
}
*
result
=
res
var
rpctxs
rpctypes
.
ReplyTxList
if
txs
==
nil
{
res
,
err
:=
rpctypes
.
DecodeTx
(
tx
)
if
err
!=
nil
{
return
err
}
rpctxs
.
Txs
=
append
(
rpctxs
.
Txs
,
res
)
}
else
{
for
_
,
rpctx
:=
range
txs
.
GetTxs
()
{
res
,
err
:=
rpctypes
.
DecodeTx
(
rpctx
)
if
err
!=
nil
{
return
err
}
rpctxs
.
Txs
=
append
(
rpctxs
.
Txs
,
res
)
}
}
*
result
=
&
rpctxs
return
nil
}
...
...
vendor/github.com/33cn/chain33/system/dapp/commands/tx.go
View file @
a28e3aaf
...
...
@@ -5,14 +5,11 @@
package
commands
import
(
"encoding/json"
"fmt"
"os"
"strconv"
"strings"
"github.com/33cn/chain33/common"
"github.com/33cn/chain33/rpc/jsonclient"
rpctypes
"github.com/33cn/chain33/rpc/types"
commandtypes
"github.com/33cn/chain33/system/dapp/commands/types"
...
...
@@ -233,35 +230,26 @@ func addDecodeTxFlags(cmd *cobra.Command) {
}
func
decodeTx
(
cmd
*
cobra
.
Command
,
args
[]
string
)
{
rpcLaddr
,
_
:=
cmd
.
Flags
()
.
GetString
(
"rpc_laddr"
)
data
,
_
:=
cmd
.
Flags
()
.
GetString
(
"data"
)
var
tx
types
.
Transaction
bytes
,
err
:=
common
.
FromHex
(
data
)
if
err
!=
nil
{
fmt
.
Fprintln
(
os
.
Stderr
,
err
)
return
params
:=
types
.
ReqDecodeRawTransaction
{
TxHex
:
data
,
}
err
=
types
.
Decode
(
bytes
,
&
tx
)
if
err
!=
nil
{
fmt
.
Fprintln
(
os
.
Stderr
,
err
)
return
}
res
,
err
:=
rpctypes
.
DecodeTx
(
&
tx
)
if
err
!=
nil
{
fmt
.
Fprintln
(
os
.
Stderr
,
err
)
return
}
txResult
:=
commandtypes
.
DecodeTransaction
(
res
)
var
res
rpctypes
.
ReplyTxList
ctx
:=
jsonclient
.
NewRPCCtx
(
rpcLaddr
,
"Chain33.DecodeRawTransaction"
,
params
,
&
res
)
ctx
.
SetResultCb
(
parseReplyTxList
)
ctx
.
Run
()
}
result
,
err
:=
json
.
MarshalIndent
(
txResult
,
""
,
" "
)
if
err
!=
nil
{
fmt
.
Fprintln
(
os
.
Stderr
,
err
)
return
func
parseReplyTxList
(
view
interface
{})
(
interface
{},
error
)
{
replyTxList
:=
view
.
(
*
rpctypes
.
ReplyTxList
)
var
commandtxs
commandtypes
.
TxListResult
for
_
,
cmdtx
:=
range
replyTxList
.
Txs
{
txResult
:=
commandtypes
.
DecodeTransaction
(
cmdtx
)
commandtxs
.
Txs
=
append
(
commandtxs
.
Txs
,
txResult
)
}
fmt
.
Println
(
string
(
result
))
return
&
commandtxs
,
nil
}
// GetAddrOverviewCmd get overview of an address
...
...
vendor/github.com/33cn/chain33/util/cli/chain33.go
View file @
a28e3aaf
...
...
@@ -141,12 +141,7 @@ func RunChain33(name string) {
q
:=
queue
.
New
(
"channel"
)
log
.
Info
(
"loading mempool module"
)
var
mem
queue
.
Module
if
!
types
.
IsPara
()
{
mem
=
mempool
.
New
(
cfg
.
Mempool
,
sub
.
Mempool
)
}
else
{
mem
=
&
util
.
MockModule
{
Key
:
"mempool"
}
}
mem
:=
mempool
.
New
(
cfg
.
Mempool
,
sub
.
Mempool
)
mem
.
SetQueueClient
(
q
.
Client
())
log
.
Info
(
"loading execs module"
)
...
...
vendor/github.com/33cn/chain33/wallet/sendtx.go
View file @
a28e3aaf
...
...
@@ -237,6 +237,12 @@ func (wallet *Wallet) createSendToAddress(addrto string, amount int64, note stri
if
len
(
tx
.
Execer
)
==
0
{
tx
.
Execer
=
[]
byte
(
exec
)
}
if
types
.
IsPara
()
{
tx
.
Execer
=
[]
byte
(
types
.
GetTitle
()
+
string
(
tx
.
Execer
))
tx
.
To
=
address
.
ExecAddress
(
string
(
tx
.
Execer
))
}
tx
.
Nonce
=
rand
.
Int63
()
return
tx
,
nil
}
...
...
vendor/github.com/33cn/chain33/wallet/wallet_proc.go
View file @
a28e3aaf
...
...
@@ -715,9 +715,18 @@ func (wallet *Wallet) ProcMergeBalance(MergeBalance *types.ReqWalletMergeBalance
v
:=
&
cty
.
CoinsAction_Transfer
{
Transfer
:
&
types
.
AssetsTransfer
{
Amount
:
amount
,
Note
:
[]
byte
(
note
)},
}
if
types
.
IsPara
()
{
v
.
Transfer
.
To
=
MergeBalance
.
GetTo
()
}
transfer
:=
&
cty
.
CoinsAction
{
Value
:
v
,
Ty
:
cty
.
CoinsActionTransfer
}
//初始化随机数
tx
:=
&
types
.
Transaction
{
Execer
:
[]
byte
(
"coins"
),
Payload
:
types
.
Encode
(
transfer
),
Fee
:
wallet
.
FeeAmount
,
To
:
addrto
,
Nonce
:
wallet
.
random
.
Int63
()}
exec
:=
[]
byte
(
"coins"
)
toAddr
:=
addrto
if
types
.
IsPara
()
{
exec
=
[]
byte
(
types
.
GetTitle
()
+
"coins"
)
toAddr
=
address
.
ExecAddress
(
string
(
exec
))
}
tx
:=
&
types
.
Transaction
{
Execer
:
exec
,
Payload
:
types
.
Encode
(
transfer
),
Fee
:
wallet
.
FeeAmount
,
To
:
toAddr
,
Nonce
:
wallet
.
random
.
Int63
()}
tx
.
SetExpire
(
time
.
Second
*
120
)
tx
.
Sign
(
int32
(
SignType
),
priv
)
//walletlog.Info("ProcMergeBalance", "tx.Nonce", tx.Nonce, "tx", tx, "index", index)
...
...
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