Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
sidecar-client-fabric
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
sidecar-client-fabric
Commits
26463b82
Unverified
Commit
26463b82
authored
Sep 04, 2020
by
Alexader
Committed by
GitHub
Sep 04, 2020
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #23 from meshplus/fix/modify-asset-exchange-callback-index
fix(contracts): fix an index error in assets exchange
parents
f9ba0931
02effabf
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
2 deletions
+36
-2
contracts.zip
example/contracts.zip
+0
-0
broker.go
example/contracts/src/broker/broker.go
+36
-2
No files found.
example/contracts.zip
View file @
26463b82
No preview for this file type
example/contracts/src/broker/broker.go
View file @
26463b82
...
...
@@ -197,7 +197,8 @@ func (broker *Broker) InterchainAssetExchangeRedeemInvoke(stub shim.ChaincodeStu
newArgs
:=
make
([]
string
,
0
)
newArgs
=
append
(
newArgs
,
args
[
0
],
cid
,
args
[
1
],
"interchainAssetExchangeRedeem"
,
args
[
2
],
"interchainAssetExchangeConfirm"
)
return
broker
.
InterchainInvoke
(
stub
,
newArgs
)
resp
:=
broker
.
InterchainInvoke
(
stub
,
newArgs
)
return
broker
.
modifyIndex
(
stub
,
args
,
newArgs
,
resp
)
}
func
(
broker
*
Broker
)
InterchainAssetExchangeRefundInvoke
(
stub
shim
.
ChaincodeStubInterface
,
args
[]
string
)
pb
.
Response
{
...
...
@@ -212,7 +213,40 @@ func (broker *Broker) InterchainAssetExchangeRefundInvoke(stub shim.ChaincodeStu
newArgs
:=
make
([]
string
,
0
)
newArgs
=
append
(
newArgs
,
args
[
0
],
cid
,
args
[
1
],
"interchainAssetExchangeRefund"
,
args
[
2
],
"interchainAssetExchangeConfirm"
)
return
broker
.
InterchainInvoke
(
stub
,
newArgs
)
resp
:=
broker
.
InterchainInvoke
(
stub
,
newArgs
)
return
broker
.
modifyIndex
(
stub
,
args
,
newArgs
,
resp
)
}
func
(
broker
*
Broker
)
modifyIndex
(
stub
shim
.
ChaincodeStubInterface
,
args
[]
string
,
newArgs
[]
string
,
resp
pb
.
Response
)
pb
.
Response
{
if
resp
.
Status
==
shim
.
OK
{
meta
,
err
:=
broker
.
getMap
(
stub
,
callbackMeta
)
if
err
!=
nil
{
return
shim
.
Error
(
err
.
Error
())
}
outMeta
,
err
:=
broker
.
getMap
(
stub
,
outterMeta
)
if
err
!=
nil
{
return
shim
.
Error
(
err
.
Error
())
}
inMeta
,
err
:=
broker
.
getMap
(
stub
,
innerMeta
)
if
err
!=
nil
{
return
shim
.
Error
(
err
.
Error
())
}
if
outMeta
[
args
[
0
]]
>
inMeta
[
args
[
0
]]
{
meta
[
args
[
0
]]
=
outMeta
[
args
[
0
]]
-
1
}
else
{
meta
[
args
[
0
]]
=
inMeta
[
args
[
0
]]
-
1
}
err
=
broker
.
putMap
(
stub
,
callbackMeta
,
meta
)
if
err
!=
nil
{
return
shim
.
Error
(
err
.
Error
())
}
}
return
resp
}
// InterchainInvoke
...
...
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