Commit 8898b5a7 authored by vipwzw's avatar vipwzw

update chain33 to master

parent ed27051b
......@@ -125,7 +125,7 @@ func createAssetTx(cmd *cobra.Command, isWithdraw bool) (string, error) {
To: toAddr,
Amount: amountInt64,
Fee: 0,
Note: note,
Note: []byte(note),
IsWithdraw: isWithdraw,
IsToken: false,
TokenSymbol: symbol,
......@@ -267,7 +267,7 @@ func createTransferTx(cmd *cobra.Command, isWithdraw bool) (string, error) {
To: toAddr,
Amount: amountInt64,
Fee: 0,
Note: note,
Note: []byte(note),
IsWithdraw: isWithdraw,
IsToken: false,
TokenSymbol: symbol,
......
......@@ -592,7 +592,7 @@ func (policy *privacyPolicy) createPublic2PrivacyTx(req *types.ReqCreateTransact
value := &privacytypes.Public2Privacy{
Tokenname: req.Tokenname,
Amount: amount,
Note: req.GetNote(),
Note: string(req.GetNote()),
Output: privacyOutput,
}
......@@ -662,7 +662,7 @@ func (policy *privacyPolicy) createPrivacy2PrivacyTx(req *types.ReqCreateTransac
value := &privacytypes.Privacy2Privacy{
Tokenname: req.GetTokenname(),
Amount: req.GetAmount(),
Note: req.GetNote(),
Note: string(req.GetNote()),
Input: privacyInput,
Output: privacyOutput,
}
......@@ -731,7 +731,7 @@ func (policy *privacyPolicy) createPrivacy2PublicTx(req *types.ReqCreateTransact
value := &privacytypes.Privacy2Public{
Tokenname: req.GetTokenname(),
Amount: req.GetAmount(),
Note: req.GetNote(),
Note: string(req.GetNote()),
Input: privacyInput,
Output: privacyOutput,
}
......
......@@ -248,7 +248,6 @@ func tokenAssets(cmd *cobra.Command, args []string) {
Address: addr,
Execer: execer,
}
var params rpctypes.Query4Jrpc
params.Execer = getRealExecName(paraName, "token")
params.FuncName = "GetAccountTokenAssets"
......
......@@ -30,11 +30,11 @@ func CreateRawTx(cmd *cobra.Command, to string, amount float64, note string, isW
var tx *types.Transaction
transfer := &tokenty.TokenAction{}
if !isWithdraw {
v := &tokenty.TokenAction_Transfer{Transfer: &types.AssetsTransfer{Cointoken: tokenSymbol, Amount: amountInt64, Note: note, To: to}}
v := &tokenty.TokenAction_Transfer{Transfer: &types.AssetsTransfer{Cointoken: tokenSymbol, Amount: amountInt64, Note: []byte(note), To: to}}
transfer.Value = v
transfer.Ty = tokenty.ActionTransfer
} else {
v := &tokenty.TokenAction_Withdraw{Withdraw: &types.AssetsWithdraw{Cointoken: tokenSymbol, Amount: amountInt64, Note: note}}
v := &tokenty.TokenAction_Withdraw{Withdraw: &types.AssetsWithdraw{Cointoken: tokenSymbol, Amount: amountInt64, Note: []byte(note)}}
transfer.Value = v
transfer.Ty = tokenty.ActionWithdraw
}
......
......@@ -5,4 +5,4 @@ import (
_ "github.com/33cn/plugin/plugin/crypto/init" //crypto init
_ "github.com/33cn/plugin/plugin/dapp/init" //dapp init
_ "github.com/33cn/plugin/plugin/store/init" //store init
)
)
\ No newline at end of file
......@@ -53,7 +53,7 @@ func (m *mockWallet) SetQueueClient(q queue.Queue) {
}
case types.EventWalletSendToAddress:
if req, ok := msg.GetData().(*types.ReqWalletSendToAddress); ok {
if req.Note == "case1" {
if string(req.Note) == "case1" {
msg.Reply(client.NewMessage(walletKey, types.EventReplyHashes, &types.Transaction{}))
} else {
msg.Reply(client.NewMessage(walletKey, types.EventReplyHashes, &types.ReplyHash{}))
......
......@@ -436,7 +436,7 @@ func testWalletSendToAddress(t *testing.T, api client.QueueProtocolAPI) {
if err == nil {
t.Error("WalletSendToAddress(nil) need return error.")
}
_, err = api.WalletSendToAddress(&types.ReqWalletSendToAddress{Note: "case1"})
_, err = api.WalletSendToAddress(&types.ReqWalletSendToAddress{Note: []byte("case1")})
if err == nil {
t.Error("WalletSendToAddress(&types.ReqWalletSendToAddress{Note:\"case1\"}) need return error.")
}
......
......@@ -75,7 +75,7 @@ import (
_ "${packname}/consensus/init" //consensus init
_ "${packname}/crypto/init" //crypto init
_ "${packname}/dapp/init" //dapp init
_ "${packname}/store/init //store init"
_ "${packname}/store/init" //store init
)`)
data = bytes.Replace(data, []byte("${packname}"), []byte(packname), -1)
ioutil.WriteFile(path, data, 0666)
......
......@@ -158,7 +158,7 @@ func scanWrite() {
continue
}
var noteTx types.Transaction
txBytes, err := common.FromHex(action.GetTransfer().Note)
txBytes, err := common.FromHex(string(action.GetTransfer().Note))
if err != nil {
fmt.Fprintln(os.Stderr, "not a user data tx")
continue
......
......@@ -85,7 +85,7 @@ func testCreateRawTransactionCoinTransfer(t *testing.T) {
IsToken: false,
IsWithdraw: false,
To: "to",
Note: "note",
Note: []byte("note"),
}
//v := &cty.CoinsAction_Transfer{
......@@ -125,7 +125,7 @@ func testCreateRawTransactionCoinTransferExec(t *testing.T) {
IsToken: false,
IsWithdraw: false,
To: "to",
Note: "note",
Note: []byte("note"),
}
client := newTestChannelClient()
......@@ -152,7 +152,7 @@ func testCreateRawTransactionCoinWithdraw(t *testing.T) {
IsToken: false,
IsWithdraw: true,
To: "to",
Note: "note",
Note: []byte("note"),
}
client := newTestChannelClient()
......
......@@ -391,7 +391,7 @@ func TestChain33_CreateRawTransaction(t *testing.T) {
To: "qew",
Amount: 10,
Fee: 1,
Note: "12312",
Note: []byte("12312"),
IsWithdraw: false,
IsToken: false,
TokenSymbol: "",
......
......@@ -371,7 +371,7 @@ func createPub2PrivTx(cmd *cobra.Command, args []string) {
Tokenname: tokenname,
Type: types.PrivacyTypePublic2Privacy,
Amount: amount,
Note: note,
Note: []byte(note),
Pubkeypair: pubkeypair,
Expire: expire,
}
......@@ -431,7 +431,7 @@ func createPriv2PrivTx(cmd *cobra.Command, args []string) {
Tokenname: tokenname,
Type: types.PrivacyTypePrivacy2Privacy,
Amount: amount,
Note: note,
Note: []byte(note),
Pubkeypair: pubkeypair,
From: sender,
Mixcount: defaultPrivacyMixCount,
......@@ -493,7 +493,7 @@ func createPriv2PubTx(cmd *cobra.Command, args []string) {
Tokenname: tokenname,
Type: types.PrivacyTypePrivacy2Public,
Amount: amount,
Note: note,
Note: []byte(note),
From: from,
To: to,
Mixcount: defaultPrivacyMixCount,
......
......@@ -62,7 +62,7 @@ func SendToAddress(rpcAddr string, from string, to string, amount int64, note st
if isWithdraw {
amt = -amount
}
params := types.ReqWalletSendToAddress{From: from, To: to, Amount: amt, Note: note}
params := types.ReqWalletSendToAddress{From: from, To: to, Amount: amt, Note: []byte(note)}
if !isToken {
params.IsToken = false
} else {
......@@ -95,16 +95,16 @@ func CreateRawTx(cmd *cobra.Command, to string, amount float64, note string, isW
transfer := &cty.CoinsAction{}
if !isWithdraw {
if initExecName != "" {
v := &cty.CoinsAction_TransferToExec{TransferToExec: &types.AssetsTransferToExec{Amount: amountInt64, Note: note, ExecName: execName, To: to}}
v := &cty.CoinsAction_TransferToExec{TransferToExec: &types.AssetsTransferToExec{Amount: amountInt64, Note: []byte(note), ExecName: execName, To: to}}
transfer.Value = v
transfer.Ty = cty.CoinsActionTransferToExec
} else {
v := &cty.CoinsAction_Transfer{Transfer: &types.AssetsTransfer{Amount: amountInt64, Note: note, To: to}}
v := &cty.CoinsAction_Transfer{Transfer: &types.AssetsTransfer{Amount: amountInt64, Note: []byte(note), To: to}}
transfer.Value = v
transfer.Ty = cty.CoinsActionTransfer
}
} else {
v := &cty.CoinsAction_Withdraw{Withdraw: &types.AssetsWithdraw{Amount: amountInt64, Note: note, ExecName: execName}}
v := &cty.CoinsAction_Withdraw{Withdraw: &types.AssetsWithdraw{Amount: amountInt64, Note: []byte(note), ExecName: execName}}
transfer.Value = v
transfer.Ty = cty.CoinsActionWithdraw
}
......
......@@ -14,7 +14,7 @@ message AssetsGenesis {
message AssetsTransferToExec {
string cointoken = 1;
int64 amount = 2;
string note = 3;
bytes note = 3;
string execName = 4;
string to = 5;
}
......@@ -22,7 +22,7 @@ message AssetsTransferToExec {
message AssetsWithdraw {
string cointoken = 1;
int64 amount = 2;
string note = 3;
bytes note = 3;
string execName = 4;
string to = 5;
}
......@@ -30,7 +30,7 @@ message AssetsWithdraw {
message AssetsTransfer {
string cointoken = 1;
int64 amount = 2;
string note = 3;
bytes note = 3;
string to = 4;
}
......@@ -44,7 +44,7 @@ message CreateTx {
string to = 1;
int64 amount = 2;
int64 fee = 3;
string note = 4;
bytes note = 4;
bool isWithdraw = 5;
bool isToken = 6;
string tokenSymbol = 7;
......
......@@ -147,7 +147,7 @@ message ReqWalletSendToAddress {
string from = 1;
string to = 2;
int64 amount = 3;
string note = 4;
bytes note = 4;
bool isToken = 5;
string tokenSymbol = 6;
}
......@@ -231,7 +231,7 @@ message ReqCreateTransaction {
// 3:隐私交易 隐私->公开
int32 type = 2;
int64 amount = 3;
string note = 4;
bytes note = 4;
// 普通交易的发送方
string from = 5;
// 普通交易的接收方
......
......@@ -202,7 +202,7 @@ func (wallet *Wallet) createSendToAddress(addrto string, amount int64, note stri
create := &types.CreateTx{
To: addrto,
Amount: amount,
Note: note,
Note: []byte(note),
IsWithdraw: isWithdraw,
IsToken: Istoken,
TokenSymbol: tokenSymbol,
......
......@@ -572,7 +572,7 @@ func (wallet *Wallet) ProcSendToAddress(SendToAddress *types.ReqWalletSendToAddr
if err != nil {
return nil, err
}
return wallet.sendToAddress(priv, addrto, amount, note, SendToAddress.IsToken, SendToAddress.TokenSymbol)
return wallet.sendToAddress(priv, addrto, amount, string(note), SendToAddress.IsToken, SendToAddress.TokenSymbol)
}
// ProcWalletSetFee 处理设置手续费
......@@ -729,7 +729,7 @@ func (wallet *Wallet) ProcMergeBalance(MergeBalance *types.ReqWalletMergeBalance
}
amount = amount - wallet.FeeAmount
v := &cty.CoinsAction_Transfer{
Transfer: &types.AssetsTransfer{Amount: amount, Note: note},
Transfer: &types.AssetsTransfer{Amount: amount, Note: []byte(note)},
}
transfer := &cty.CoinsAction{Value: v, Ty: cty.CoinsActionTransfer}
//初始化随机数
......
......@@ -461,7 +461,7 @@ func testProcSendToAddress(t *testing.T, wallet *Wallet) {
transfer := &types.ReqWalletSendToAddress{
Amount: 1000,
From: FromAddr,
Note: "test",
Note: []byte("test"),
To: "1L1zEgVcjqdM2KkQixENd7SZTaudKkcyDu",
}
msg := wallet.client.NewMessage("wallet", types.EventWalletSendToAddress, transfer)
......@@ -473,7 +473,7 @@ func testProcSendToAddress(t *testing.T, wallet *Wallet) {
withdraw := &types.ReqWalletSendToAddress{
Amount: -1000,
From: FromAddr,
Note: "test",
Note: []byte("test"),
To: "16htvcBNSEA7fZhAdLJphDwQRQJaHpyHTp",
}
msg = wallet.client.NewMessage("wallet", types.EventWalletSendToAddress, withdraw)
......@@ -592,7 +592,7 @@ func testProcWalletLock(t *testing.T, wallet *Wallet) {
transfer := &types.ReqWalletSendToAddress{
Amount: 1000,
From: FromAddr,
Note: "test",
Note: []byte("test"),
To: "1L1zEgVcjqdM2KkQixENd7SZTaudKkcyDu",
}
msg = wallet.client.NewMessage("wallet", types.EventWalletSendToAddress, transfer)
......
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