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
aedc77fd
Commit
aedc77fd
authored
Sep 04, 2019
by
linj
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
impl retrieve more assets
parent
8b7bea5a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
42 additions
and
1 deletion
+42
-1
retrievedb.go
plugin/dapp/retrieve/executor/retrievedb.go
+42
-1
No files found.
plugin/dapp/retrieve/executor/retrievedb.go
View file @
aedc77fd
...
@@ -116,7 +116,7 @@ func (action *Action) RetrieveBackup(backupRet *rt.BackupRetrieve) (*types.Recei
...
@@ -116,7 +116,7 @@ func (action *Action) RetrieveBackup(backupRet *rt.BackupRetrieve) (*types.Recei
var
receipt
*
types
.
Receipt
var
receipt
*
types
.
Receipt
var
r
*
DB
var
r
*
DB
var
newRetrieve
=
false
var
newRetrieve
=
false
if
types
.
IsDappFork
(
action
.
height
,
rt
.
RetrieveX
,
"ForkRetrive"
)
{
if
types
.
IsDappFork
(
action
.
height
,
rt
.
RetrieveX
,
rt
.
ForkRetriveX
)
{
if
err
:=
address
.
CheckAddress
(
backupRet
.
BackupAddress
);
err
!=
nil
{
if
err
:=
address
.
CheckAddress
(
backupRet
.
BackupAddress
);
err
!=
nil
{
rlog
.
Debug
(
"retrieve checkaddress"
)
rlog
.
Debug
(
"retrieve checkaddress"
)
return
nil
,
err
return
nil
,
err
...
@@ -203,6 +203,43 @@ func (action *Action) RetrievePrepare(preRet *rt.PrepareRetrieve) (*types.Receip
...
@@ -203,6 +203,43 @@ func (action *Action) RetrievePrepare(preRet *rt.PrepareRetrieve) (*types.Receip
return
receipt
,
nil
return
receipt
,
nil
}
}
// RetrievePerformAssets Action
func
(
action
*
Action
)
RetrievePerformAssets
(
perfRet
*
rt
.
PerformRetrieve
,
defaultAddress
string
)
(
*
types
.
Receipt
,
error
)
{
var
logs
[]
*
types
.
ReceiptLog
var
kv
[]
*
types
.
KeyValue
var
receipt
*
types
.
Receipt
// 兼容原来的找回, 在不指定的情况下,找回主币
if
len
(
perfRet
.
Assets
)
==
0
{
perfRet
.
Assets
=
append
(
perfRet
.
Assets
,
&
types
.
Asset
{
Exec
:
"coins"
,
Symbol
:
types
.
GetCoinSymbol
()})
//return nil, nil
}
for
_
,
asset
:=
range
perfRet
.
Assets
{
accdb
,
err
:=
account
.
NewAccountDB
(
asset
.
Exec
,
asset
.
Symbol
,
action
.
db
)
if
err
!=
nil
{
rlog
.
Error
(
"RetrievePerform"
,
"NewAccountDB"
,
err
)
return
nil
,
err
}
acc
:=
accdb
.
LoadExecAccount
(
defaultAddress
,
action
.
execaddr
)
rlog
.
Debug
(
"RetrievePerform"
,
"acc.Balance"
,
acc
.
Balance
)
if
acc
.
Balance
>
0
{
receipt
,
err
=
action
.
coinsAccount
.
ExecTransfer
(
defaultAddress
,
perfRet
.
BackupAddress
,
action
.
execaddr
,
acc
.
Balance
)
if
err
!=
nil
{
rlog
.
Debug
(
"RetrievePerform"
,
"ExecTransfer"
,
err
)
return
nil
,
err
}
logs
=
append
(
logs
,
receipt
.
Logs
...
)
kv
=
append
(
kv
,
receipt
.
KV
...
)
}
else
{
return
nil
,
rt
.
ErrRetrieveNoBalance
}
}
receipt
=
&
types
.
Receipt
{
Ty
:
types
.
ExecOk
,
KV
:
kv
,
Logs
:
logs
}
return
receipt
,
nil
}
// RetrievePerform Action
// RetrievePerform Action
func
(
action
*
Action
)
RetrievePerform
(
perfRet
*
rt
.
PerformRetrieve
)
(
*
types
.
Receipt
,
error
)
{
func
(
action
*
Action
)
RetrievePerform
(
perfRet
*
rt
.
PerformRetrieve
)
(
*
types
.
Receipt
,
error
)
{
var
logs
[]
*
types
.
ReceiptLog
var
logs
[]
*
types
.
ReceiptLog
...
@@ -239,6 +276,10 @@ func (action *Action) RetrievePerform(perfRet *rt.PerformRetrieve) (*types.Recei
...
@@ -239,6 +276,10 @@ func (action *Action) RetrievePerform(perfRet *rt.PerformRetrieve) (*types.Recei
return
nil
,
rt
.
ErrRetrievePeriodLimit
return
nil
,
rt
.
ErrRetrievePeriodLimit
}
}
if
types
.
IsDappFork
(
action
.
height
,
rt
.
RetrieveX
,
rt
.
ForkRetriveAssetX
)
{
return
action
.
RetrievePerformAssets
(
perfRet
,
r
.
RetPara
[
index
]
.
DefaultAddress
)
}
acc
=
action
.
coinsAccount
.
LoadExecAccount
(
r
.
RetPara
[
index
]
.
DefaultAddress
,
action
.
execaddr
)
acc
=
action
.
coinsAccount
.
LoadExecAccount
(
r
.
RetPara
[
index
]
.
DefaultAddress
,
action
.
execaddr
)
rlog
.
Debug
(
"RetrievePerform"
,
"acc.Balance"
,
acc
.
Balance
)
rlog
.
Debug
(
"RetrievePerform"
,
"acc.Balance"
,
acc
.
Balance
)
if
acc
.
Balance
>
0
{
if
acc
.
Balance
>
0
{
...
...
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