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