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
e0449943
Unverified
Commit
e0449943
authored
Feb 05, 2020
by
vipwzw
Committed by
GitHub
Feb 05, 2020
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #778 from icehawk-hyb/issues-673
add by hyb for wallet mtx
parents
1fa99781
a29fddf3
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
25 additions
and
56 deletions
+25
-56
go.mod
go.mod
+1
-1
go.sum
go.sum
+2
-2
paracommitmsg.go
plugin/consensus/para/paracommitmsg.go
+2
-12
ticket_test.go
plugin/consensus/ticket/ticket_test.go
+6
-5
exec.go
plugin/dapp/multisig/wallet/exec.go
+0
-3
exec_test.go
plugin/dapp/multisig/wallet/exec_test.go
+1
-1
para_test.go
plugin/dapp/paracross/wallet/para_test.go
+3
-4
exec.go
plugin/dapp/privacy/wallet/exec.go
+3
-16
privacy.go
plugin/dapp/privacy/wallet/privacy.go
+0
-2
privacybizpolicy_test.go
plugin/dapp/privacy/wallet/privacybizpolicy_test.go
+0
-3
ticket_test.go
plugin/dapp/ticket/executor/ticket_test.go
+6
-5
ticket.go
plugin/dapp/ticket/wallet/ticket.go
+1
-2
No files found.
go.mod
View file @
e0449943
...
...
@@ -3,7 +3,7 @@ module github.com/33cn/plugin
go 1.12
require (
github.com/33cn/chain33 v0.0.0-20200
115085731-38f06ce8411c
github.com/33cn/chain33 v0.0.0-20200
205062829-bb33acc5e2e8
github.com/BurntSushi/toml v0.3.1
github.com/NebulousLabs/Sia v1.3.7
github.com/beorn7/perks v1.0.1 // indirect
...
...
go.sum
View file @
e0449943
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
github.com/33cn/chain33 v0.0.0-20200
115085731-38f06ce8411c h1:ePkHv1GhUGsEubK1mxtrCe0ricOc66QNAN11hOWH6ps
=
github.com/33cn/chain33 v0.0.0-20200
115085731-38f06ce8411c
/go.mod h1:lhZbNbCnCGsiiapxGZcSxfxKdIAdCK0UzHgpp65XMlM=
github.com/33cn/chain33 v0.0.0-20200
205062829-bb33acc5e2e8 h1:AVS7qtYkzdxxGUquh/m9gIkDAr+5y6N+0lRZgsFoM/0
=
github.com/33cn/chain33 v0.0.0-20200
205062829-bb33acc5e2e8
/go.mod h1:lhZbNbCnCGsiiapxGZcSxfxKdIAdCK0UzHgpp65XMlM=
github.com/AndreasBriese/bbloom v0.0.0-20180913140656-343706a395b7 h1:PqzgE6kAMi81xWQA2QIVxjWkFHptGgC547vchpUbtFo=
github.com/AndreasBriese/bbloom v0.0.0-20180913140656-343706a395b7/go.mod h1:bOvUY6CB00SOBii9/FifXqc0awNKxLFCL/+pkDPuyl8=
github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
...
...
plugin/consensus/para/paracommitmsg.go
View file @
e0449943
...
...
@@ -883,18 +883,8 @@ func (client *commitMsgClient) onWalletAccount(acc *types.Account) {
func
(
client
*
commitMsgClient
)
fetchPriKey
()
error
{
req
:=
&
types
.
ReqString
{
Data
:
client
.
authAccount
}
msg
:=
client
.
paraClient
.
GetQueueClient
()
.
NewMessage
(
"wallet"
,
types
.
EventDumpPrivkey
,
req
)
err
:=
client
.
paraClient
.
GetQueueClient
()
.
Send
(
msg
,
true
)
if
err
!=
nil
{
plog
.
Error
(
"para commit send msg"
,
"err"
,
err
.
Error
())
return
err
}
resp
,
err
:=
client
.
paraClient
.
GetQueueClient
()
.
Wait
(
msg
)
if
err
!=
nil
{
plog
.
Error
(
"para commit msg sign to wallet"
,
"err"
,
err
.
Error
())
return
err
}
str
:=
resp
.
GetData
()
.
(
*
types
.
ReplyString
)
.
Data
resp
,
err
:=
client
.
paraClient
.
GetAPI
()
.
ExecWalletFunc
(
"wallet"
,
"DumpPrivkey"
,
req
)
str
:=
resp
.
(
*
types
.
ReplyString
)
.
Data
pk
,
err
:=
common
.
FromHex
(
str
)
if
err
!=
nil
&&
pk
==
nil
{
return
err
...
...
plugin/consensus/ticket/ticket_test.go
View file @
e0449943
...
...
@@ -65,15 +65,15 @@ func testTicket(t *testing.T) {
//fmt.Println(string(js))
_
,
err
=
mock33
.
GetAPI
()
.
ExecWalletFunc
(
"ticket"
,
"WalletAutoMiner"
,
&
ty
.
MinerFlag
{
Flag
:
0
})
assert
.
Nil
(
t
,
err
)
status
,
err
:=
mock33
.
GetAPI
()
.
GetWalletStatus
(
)
status
,
err
:=
mock33
.
GetAPI
()
.
ExecWalletFunc
(
"wallet"
,
"GetWalletStatus"
,
&
types
.
ReqNil
{}
)
assert
.
Nil
(
t
,
err
)
assert
.
Equal
(
t
,
false
,
status
.
IsAutoMining
)
assert
.
Equal
(
t
,
false
,
status
.
(
*
types
.
WalletStatus
)
.
IsAutoMining
)
assert
.
Equal
(
t
,
int32
(
2
),
detail
.
Receipt
.
Ty
)
_
,
err
=
mock33
.
GetAPI
()
.
ExecWalletFunc
(
"ticket"
,
"WalletAutoMiner"
,
&
ty
.
MinerFlag
{
Flag
:
1
})
assert
.
Nil
(
t
,
err
)
status
,
err
=
mock33
.
GetAPI
()
.
GetWalletStatus
(
)
status
,
err
=
mock33
.
GetAPI
()
.
ExecWalletFunc
(
"wallet"
,
"GetWalletStatus"
,
&
types
.
ReqNil
{}
)
assert
.
Nil
(
t
,
err
)
assert
.
Equal
(
t
,
true
,
status
.
IsAutoMining
)
assert
.
Equal
(
t
,
true
,
status
.
(
*
types
.
WalletStatus
)
.
IsAutoMining
)
start
:=
time
.
Now
()
height
:=
int64
(
0
)
hastclose
:=
false
...
...
@@ -84,7 +84,8 @@ func testTicket(t *testing.T) {
assert
.
Nil
(
t
,
err
)
//查询票是否自动close,并且购买了新的票
req
:=
&
types
.
ReqWalletTransactionList
{
Count
:
1000
}
list
,
err
:=
mock33
.
GetAPI
()
.
WalletTransactionList
(
req
)
resp
,
err
:=
mock33
.
GetAPI
()
.
ExecWalletFunc
(
"wallet"
,
"WalletTransactionList"
,
req
)
list
:=
resp
.
(
*
types
.
WalletTxDetails
)
assert
.
Nil
(
t
,
err
)
for
_
,
tx
:=
range
list
.
TxDetails
{
if
tx
.
ActionName
==
"tclose"
&&
tx
.
Receipt
.
Ty
==
2
{
...
...
plugin/dapp/multisig/wallet/exec.go
View file @
e0449943
...
...
@@ -10,9 +10,6 @@ import (
//On_MultiSigAddresList 获取owner对应的多重签名地址列表
func
(
policy
*
multisigPolicy
)
On_MultiSigAddresList
(
req
*
types
.
ReqString
)
(
types
.
Message
,
error
)
{
policy
.
getWalletOperate
()
.
GetMutex
()
.
Lock
()
defer
policy
.
getWalletOperate
()
.
GetMutex
()
.
Unlock
()
//获取本钱包中记录的所有多重签名地址
if
req
.
Data
==
""
{
reply
,
err
:=
policy
.
store
.
listOwnerAttrs
()
...
...
plugin/dapp/multisig/wallet/exec_test.go
View file @
e0449943
...
...
@@ -70,7 +70,7 @@ func TestMultiSigAccount(t *testing.T) {
//导入私钥到钱包
for
i
,
priv
:=
range
TestPrivkeyHex
{
privkey
:=
&
types
.
ReqWalletImportPrivkey
{
Privkey
:
priv
,
Label
:
fmt
.
Sprintf
(
"heyubin%d"
,
i
)}
_
,
err
:=
mocker
.
GetAPI
()
.
WalletImportprivkey
(
privkey
)
_
,
err
:=
mocker
.
GetAPI
()
.
ExecWalletFunc
(
"wallet"
,
"WalletImportPrivkey"
,
privkey
)
if
err
!=
nil
{
panic
(
err
)
}
...
...
plugin/dapp/paracross/wallet/para_test.go
View file @
e0449943
...
...
@@ -23,13 +23,12 @@ func TestParaQuery(t *testing.T) {
var
param
types
.
ReqWalletImportPrivkey
param
.
Label
=
"Importprivkey"
param
.
Privkey
=
"CC38546E9E659D15E6B4893F0AB32A06D103931A8230B0BDE71459D2B27D6944"
para
.
Para
.
GetAPI
()
.
WalletImportprivkey
(
&
param
)
para
.
Para
.
GetAPI
()
.
ExecWalletFunc
(
"wallet"
,
"WalletImportPrivkey"
,
&
param
)
var
param1
types
.
ReqNewAccount
param1
.
Label
=
"NewAccount"
para
.
Para
.
GetAPI
()
.
NewAccount
(
&
param1
)
para
.
Para
.
GetAPI
()
.
WalletLock
()
para
.
Para
.
GetAPI
()
.
ExecWalletFunc
(
"wallet"
,
"NewAccount"
,
&
param1
)
para
.
Para
.
GetAPI
()
.
ExecWalletFunc
(
"wallet"
,
"WalletLock"
,
&
types
.
ReqNil
{})
//通过rpc 发生信息
tx
:=
util
.
CreateTxWithExecer
(
paraCfg
,
para
.
Para
.
GetGenesisKey
(),
"user.p.test.none"
)
...
...
plugin/dapp/privacy/wallet/exec.go
View file @
e0449943
...
...
@@ -10,8 +10,6 @@ import (
)
func
(
policy
*
privacyPolicy
)
On_ShowPrivacyAccountSpend
(
req
*
privacytypes
.
ReqPrivBal4AddrToken
)
(
types
.
Message
,
error
)
{
policy
.
getWalletOperate
()
.
GetMutex
()
.
Lock
()
defer
policy
.
getWalletOperate
()
.
GetMutex
()
.
Unlock
()
reply
,
err
:=
policy
.
showPrivacyAccountsSpend
(
req
)
if
err
!=
nil
{
bizlog
.
Error
(
"showPrivacyAccountsSpend"
,
"err"
,
err
.
Error
())
...
...
@@ -20,8 +18,6 @@ func (policy *privacyPolicy) On_ShowPrivacyAccountSpend(req *privacytypes.ReqPri
}
func
(
policy
*
privacyPolicy
)
On_ShowPrivacyKey
(
req
*
types
.
ReqString
)
(
types
.
Message
,
error
)
{
policy
.
getWalletOperate
()
.
GetMutex
()
.
Lock
()
defer
policy
.
getWalletOperate
()
.
GetMutex
()
.
Unlock
()
reply
,
err
:=
policy
.
showPrivacyKeyPair
(
req
)
if
err
!=
nil
{
bizlog
.
Error
(
"showPrivacyKeyPair"
,
"err"
,
err
.
Error
())
...
...
@@ -30,6 +26,7 @@ func (policy *privacyPolicy) On_ShowPrivacyKey(req *types.ReqString) (types.Mess
}
func
(
policy
*
privacyPolicy
)
On_CreateTransaction
(
req
*
privacytypes
.
ReqCreatePrivacyTx
)
(
types
.
Message
,
error
)
{
ok
,
err
:=
policy
.
getWalletOperate
()
.
CheckWalletStatus
()
if
!
ok
{
bizlog
.
Error
(
"createTransaction"
,
"CheckWalletStatus cause error."
,
err
)
...
...
@@ -57,8 +54,6 @@ func (policy *privacyPolicy) On_CreateTransaction(req *privacytypes.ReqCreatePri
bizlog
.
Error
(
"createTransaction"
,
"isRescanUtxosFlagScaning cause error."
,
err
)
return
nil
,
err
}
policy
.
getWalletOperate
()
.
GetMutex
()
.
Lock
()
defer
policy
.
getWalletOperate
()
.
GetMutex
()
.
Unlock
()
reply
,
err
:=
policy
.
createTransaction
(
req
)
if
err
!=
nil
{
...
...
@@ -68,8 +63,6 @@ func (policy *privacyPolicy) On_CreateTransaction(req *privacytypes.ReqCreatePri
}
func
(
policy
*
privacyPolicy
)
On_ShowPrivacyAccountInfo
(
req
*
privacytypes
.
ReqPPrivacyAccount
)
(
types
.
Message
,
error
)
{
policy
.
getWalletOperate
()
.
GetMutex
()
.
Lock
()
defer
policy
.
getWalletOperate
()
.
GetMutex
()
.
Unlock
()
reply
,
err
:=
policy
.
getPrivacyAccountInfo
(
req
)
if
err
!=
nil
{
bizlog
.
Error
(
"getPrivacyAccountInfo"
,
"err"
,
err
.
Error
())
...
...
@@ -78,6 +71,7 @@ func (policy *privacyPolicy) On_ShowPrivacyAccountInfo(req *privacytypes.ReqPPri
}
func
(
policy
*
privacyPolicy
)
On_PrivacyTransactionList
(
req
*
privacytypes
.
ReqPrivacyTransactionList
)
(
types
.
Message
,
error
)
{
if
req
.
Direction
!=
0
&&
req
.
Direction
!=
1
{
bizlog
.
Error
(
"getPrivacyTransactionList"
,
"invalid direction "
,
req
.
Direction
)
return
nil
,
types
.
ErrInvalidParam
...
...
@@ -90,9 +84,6 @@ func (policy *privacyPolicy) On_PrivacyTransactionList(req *privacytypes.ReqPriv
}
req
.
SendRecvFlag
=
sendRecvFlag
policy
.
getWalletOperate
()
.
GetMutex
()
.
Lock
()
defer
policy
.
getWalletOperate
()
.
GetMutex
()
.
Unlock
()
reply
,
err
:=
policy
.
store
.
getWalletPrivacyTxDetails
(
req
)
if
err
!=
nil
{
bizlog
.
Error
(
"getWalletPrivacyTxDetails"
,
"err"
,
err
.
Error
())
...
...
@@ -101,8 +92,7 @@ func (policy *privacyPolicy) On_PrivacyTransactionList(req *privacytypes.ReqPriv
}
func
(
policy
*
privacyPolicy
)
On_RescanUtxos
(
req
*
privacytypes
.
ReqRescanUtxos
)
(
types
.
Message
,
error
)
{
policy
.
getWalletOperate
()
.
GetMutex
()
.
Lock
()
defer
policy
.
getWalletOperate
()
.
GetMutex
()
.
Unlock
()
reply
,
err
:=
policy
.
rescanUTXOs
(
req
)
if
err
!=
nil
{
bizlog
.
Error
(
"rescanUTXOs"
,
"err"
,
err
.
Error
())
...
...
@@ -111,9 +101,6 @@ func (policy *privacyPolicy) On_RescanUtxos(req *privacytypes.ReqRescanUtxos) (t
}
func
(
policy
*
privacyPolicy
)
On_EnablePrivacy
(
req
*
privacytypes
.
ReqEnablePrivacy
)
(
types
.
Message
,
error
)
{
operater
:=
policy
.
getWalletOperate
()
operater
.
GetMutex
()
.
Lock
()
defer
operater
.
GetMutex
()
.
Unlock
()
reply
,
err
:=
policy
.
enablePrivacy
(
req
)
if
err
!=
nil
{
bizlog
.
Error
(
"enablePrivacy"
,
"err"
,
err
.
Error
())
...
...
plugin/dapp/privacy/wallet/privacy.go
View file @
e0449943
...
...
@@ -1008,8 +1008,6 @@ func (policy *privacyPolicy) buildAndStoreWalletTxDetail(param *buildStoreWallet
func
(
policy
*
privacyPolicy
)
checkExpireFTXOOnTimer
()
{
operater
:=
policy
.
getWalletOperate
()
operater
.
GetMutex
()
.
Lock
()
defer
operater
.
GetMutex
()
.
Unlock
()
header
:=
operater
.
GetLastHeader
()
if
header
==
nil
{
...
...
plugin/dapp/privacy/wallet/privacybizpolicy_test.go
View file @
e0449943
...
...
@@ -119,9 +119,6 @@ func (mock *testDataMock) initMember() {
func
(
mock
*
testDataMock
)
importPrivateKey
(
PrivKey
*
types
.
ReqWalletImportPrivkey
)
{
wallet
:=
mock
.
wallet
wallet
.
GetMutex
()
.
Lock
()
defer
wallet
.
GetMutex
()
.
Unlock
()
ok
,
err
:=
wallet
.
CheckWalletStatus
()
if
!
ok
||
err
!=
nil
{
return
...
...
plugin/dapp/ticket/executor/ticket_test.go
View file @
e0449943
...
...
@@ -84,22 +84,23 @@ func TestTicket(t *testing.T) {
//fmt.Println(string(js))
_
,
err
=
mock33
.
GetAPI
()
.
ExecWalletFunc
(
"ticket"
,
"WalletAutoMiner"
,
&
ty
.
MinerFlag
{
Flag
:
0
})
assert
.
Nil
(
t
,
err
)
status
,
err
:=
mock33
.
GetAPI
()
.
GetWalletStatus
(
)
status
,
err
:=
mock33
.
GetAPI
()
.
ExecWalletFunc
(
"wallet"
,
"GetWalletStatus"
,
&
types
.
ReqNil
{}
)
assert
.
Nil
(
t
,
err
)
assert
.
Equal
(
t
,
false
,
status
.
IsAutoMining
)
assert
.
Equal
(
t
,
false
,
status
.
(
*
types
.
WalletStatus
)
.
IsAutoMining
)
assert
.
Equal
(
t
,
int32
(
2
),
detail
.
Receipt
.
Ty
)
_
,
err
=
mock33
.
GetAPI
()
.
ExecWalletFunc
(
"ticket"
,
"WalletAutoMiner"
,
&
ty
.
MinerFlag
{
Flag
:
1
})
assert
.
Nil
(
t
,
err
)
status
,
err
=
mock33
.
GetAPI
()
.
GetWalletStatus
(
)
status
,
err
=
mock33
.
GetAPI
()
.
ExecWalletFunc
(
"wallet"
,
"GetWalletStatus"
,
&
types
.
ReqNil
{}
)
assert
.
Nil
(
t
,
err
)
assert
.
Equal
(
t
,
true
,
status
.
IsAutoMining
)
assert
.
Equal
(
t
,
true
,
status
.
(
*
types
.
WalletStatus
)
.
IsAutoMining
)
for
i
:=
mock33
.
GetLastBlock
()
.
Height
;
i
<
100
;
i
++
{
err
=
mock33
.
WaitHeight
(
i
)
assert
.
Nil
(
t
,
err
)
//查询票是否自动close,并且购买了新的票
req
:=
&
types
.
ReqWalletTransactionList
{
Count
:
1000
}
list
,
err
:=
mock33
.
GetAPI
()
.
WalletTransactionList
(
req
)
resp
,
err
:=
mock33
.
GetAPI
()
.
ExecWalletFunc
(
"wallet"
,
"WalletTransactionList"
,
req
)
assert
.
Nil
(
t
,
err
)
list
:=
resp
.
(
*
types
.
WalletTxDetails
)
hastclose
:=
false
hastopen
:=
false
for
_
,
tx
:=
range
list
.
TxDetails
{
...
...
plugin/dapp/ticket/wallet/ticket.go
View file @
e0449943
...
...
@@ -448,8 +448,7 @@ func (policy *ticketPolicy) getTicketsByStatus(status int32) ([]*ty.Ticket, [][]
if
err
!=
nil
{
return
nil
,
nil
,
err
}
operater
.
GetMutex
()
.
Lock
()
defer
operater
.
GetMutex
()
.
Unlock
()
ok
,
err
:=
operater
.
CheckWalletStatus
()
if
!
ok
&&
err
!=
types
.
ErrOnlyTicketUnLocked
{
return
nil
,
nil
,
err
...
...
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