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
7bce9c1a
Commit
7bce9c1a
authored
Aug 10, 2021
by
jzhe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:handle ibtp-2.0
parent
4e3c0b70
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
323 additions
and
172 deletions
+323
-172
.gitignore
.gitignore
+3
-3
client.go
client.go
+0
-0
config.go
config.go
+32
-17
fabric.toml
config/fabric.toml
+13
-2
event.go
event.go
+25
-30
contracts.zip
example/contracts.zip
+0
-0
broker.go
example/contracts/src/broker/broker.go
+134
-57
go.mod
example/contracts/src/broker/go.mod
+23
-0
helper.go
example/contracts/src/broker/helper.go
+0
-21
meta.go
example/contracts/src/broker/meta.go
+22
-8
data_swapper.go
example/contracts/src/data_swapper/data_swapper.go
+2
-2
go.mod
example/contracts/src/data_swapper/go.mod
+23
-0
go.mod
example/contracts/src/transfer/go.mod
+23
-0
transfer.go
example/contracts/src/transfer/transfer.go
+2
-3
go.mod
go.mod
+4
-9
go.sum
go.sum
+0
-0
receipt.go
receipt.go
+17
-20
No files found.
.gitignore
View file @
7bce9c1a
...
...
@@ -8,6 +8,6 @@ bin
cover.out
cover.html
coverage.txt
/
example/contracts/src/broker/vendor/
/
example/contracts/src/data_swapper/vendor/
/
example/contracts/src/transfer/vendor/
example/contracts/src/broker/vendor/
example/contracts/src/data_swapper/vendor/
example/contracts/src/transfer/vendor/
client.go
View file @
7bce9c1a
This diff is collapsed.
Click to expand it.
config.go
View file @
7bce9c1a
...
...
@@ -11,29 +11,44 @@ const (
ConfigName
=
"fabric.toml"
)
type
Config
struct
{
Fabric
Fabric
`toml:"fabric" json:"fabric"`
Services
[]
Service
`mapstructure:"services" json:"services"`
}
type
Fabric
struct
{
Addr
string
`toml:"addr" json:"addr"`
Name
string
`toml:"name" json:"name"`
EventFilter
string
`mapstructure:"event_filter" toml:"event_filter" json:"event_filter"`
Username
string
`toml:"username" json:"username"`
CCID
string
`toml:"ccid" json:"ccid"`
ChannelId
string
`mapstructure:"channel_id" toml:"channel_id" json:"channel_id"`
Org
string
`toml:"org" json:"org"`
Addr
string
`toml:"addr" json:"addr"`
Name
string
`toml:"name" json:"name"`
EventFilter
string
`mapstructure:"event_filter" toml:"event_filter" json:"event_filter"`
Username
string
`toml:"username" json:"username"`
CCID
string
`toml:"ccid" json:"ccid"`
ChannelId
string
`mapstructure:"channel_id" toml:"channel_id" json:"channel_id"`
Org
string
`toml:"org" json:"org"`
TimeoutHeight
int64
`mapstructure:"timeout_height" json:"timeout_height"`
ChainID
string
`mapstructure:"chain_id" json:"chain_id"`
}
type
Service
struct
{
ID
string
`toml:"id" json:"id"`
Name
string
`toml:"name" json:"name"`
Type
string
`toml:"type" json:"type"`
}
func
DefaultConfig
()
*
Fabric
{
return
&
Fabric
{
Addr
:
"40.125.164.122:10053"
,
Name
:
"fabric"
,
EventFilter
:
"CrosschainEventName"
,
Username
:
"Admin"
,
CCID
:
"Broker-001"
,
ChannelId
:
"mychannel"
,
Org
:
"org2"
,
func
DefaultConfig
()
*
Config
{
return
&
Config
{
Fabric
:
Fabric
{
Addr
:
"40.125.164.122:10053"
,
Name
:
"fabric"
,
EventFilter
:
"CrosschainEventName"
,
Username
:
"Admin"
,
CCID
:
"Broker-001"
,
ChannelId
:
"mychannel"
,
Org
:
"org2"
,
},
Services
:
nil
,
}
}
func
UnmarshalConfig
(
configPath
string
)
(
*
Fabric
,
error
)
{
func
UnmarshalConfig
(
configPath
string
)
(
*
Config
,
error
)
{
viper
.
SetConfigFile
(
filepath
.
Join
(
configPath
,
ConfigName
))
viper
.
SetConfigType
(
"toml"
)
viper
.
AutomaticEnv
()
...
...
config/fabric.toml
View file @
7bce9c1a
[fabric]
addr
=
"host.docker.internal:7053"
event_filter
=
"interchain-event-name"
username
=
"Admin"
ccid
=
"broker"
channel_id
=
"mychannel"
org
=
"org2"
\ No newline at end of file
org
=
"org2"
timeout_height
=
10
chain_id
=
"3"
[[services]]
id
=
"mychannel&transfer"
name
=
"transfer"
[[services]]
id
=
"mychannel&data_swapper"
name
=
"data_swapper"
\ No newline at end of file
event.go
View file @
7bce9c1a
package
main
import
(
"fmt"
"strings"
"time"
"github.com/cloudflare/cfssl/log"
"github.com/meshplus/bitxhub-model/pb"
"github.com/meshplus/bitxid"
)
type
Event
struct
{
Index
uint64
`json:"index"`
DstContractDID
string
`json:"dst_contract_did"`
SrcContractID
string
`json:"src_contract_id"`
Func
string
`json:"func"`
Args
string
`json:"args"`
Callback
string
`json:"callback"`
Argscb
string
`json:"argscb"`
Rollback
string
`json:"rollback"`
Argsrb
string
`json:"argsrb"`
Proof
[]
byte
`json:"proof"`
Extra
[]
byte
`json:"extra"`
Index
uint64
`json:"index"`
DstFullID
string
`json:"dst_full_id"`
SrcFullID
string
`json:"src_full_id"`
Func
string
`json:"func"`
Args
string
`json:"args"`
Argscb
string
`json:"argscb"`
Argsrb
string
`json:"argsrb"`
}
func
(
ev
*
Event
)
Convert2IBTP
(
srcMethod
string
,
ibtpType
pb
.
IBTP_Type
)
*
pb
.
IBTP
{
func
(
ev
*
Event
)
Convert2IBTP
(
timeoutHeight
int64
,
ibtpType
pb
.
IBTP_Type
)
*
pb
.
IBTP
{
pd
,
err
:=
ev
.
encryptPayload
()
if
err
!=
nil
{
log
.
Fatalf
(
"Get ibtp payload :%s"
,
err
)
}
return
&
pb
.
IBTP
{
From
:
srcMethod
,
To
:
string
(
bitxid
.
DID
(
ev
.
DstContractDID
)
.
GetChainDID
()),
Index
:
ev
.
Index
,
Type
:
ibtpType
,
Timestamp
:
time
.
Now
()
.
UnixNano
(),
Proof
:
ev
.
Proof
,
Payload
:
pd
,
Extra
:
ev
.
Extra
,
From
:
ev
.
SrcFullID
,
To
:
ev
.
DstFullID
,
Index
:
ev
.
Index
,
Type
:
ibtpType
,
TimeoutHeight
:
timeoutHeight
,
Payload
:
pd
,
}
}
...
...
@@ -51,15 +44,17 @@ func handleArgs(args string) [][]byte {
}
func
(
ev
*
Event
)
encryptPayload
()
([]
byte
,
error
)
{
funcSplit
:=
strings
.
Split
(
ev
.
Func
,
","
)
if
len
(
funcSplit
)
!=
3
{
return
nil
,
fmt
.
Errorf
(
"ibtp func not is (func, callback,rollback)"
)
}
content
:=
&
pb
.
Content
{
SrcContractId
:
ev
.
SrcContractID
,
DstContractId
:
bitxid
.
DID
(
ev
.
DstContractDID
)
.
GetAddress
(),
Func
:
ev
.
Func
,
Args
:
handleArgs
(
ev
.
Args
),
Callback
:
ev
.
Callback
,
ArgsCb
:
handleArgs
(
ev
.
Argscb
),
Rollback
:
ev
.
Rollback
,
ArgsRb
:
handleArgs
(
ev
.
Argsrb
),
Func
:
funcSplit
[
0
],
Args
:
handleArgs
(
ev
.
Args
),
Callback
:
funcSplit
[
1
],
ArgsCb
:
handleArgs
(
ev
.
Argscb
),
Rollback
:
funcSplit
[
2
],
ArgsRb
:
handleArgs
(
ev
.
Argsrb
),
}
data
,
err
:=
content
.
Marshal
()
if
err
!=
nil
{
...
...
example/contracts.zip
View file @
7bce9c1a
No preview for this file type
example/contracts/src/broker/broker.go
View file @
7bce9c1a
This diff is collapsed.
Click to expand it.
example/contracts/src/broker/go.mod
0 → 100644
View file @
7bce9c1a
module github.com/meshplus/broker
go 1.13
require (
github.com/Knetic/govaluate v3.0.0+incompatible // indirect
github.com/Shopify/sarama v1.29.1 // indirect
github.com/fsouza/go-dockerclient v1.7.3 // indirect
github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 // indirect
github.com/hashicorp/go-version v1.3.0 // indirect
github.com/hyperledger/fabric v1.4.3
github.com/hyperledger/fabric-amcl v0.0.0-20210603140002-2670f91851c8 // indirect
github.com/miekg/pkcs11 v1.0.3 // indirect
github.com/onsi/gomega v1.14.0 // indirect
github.com/op/go-logging v0.0.0-20160315200505-970db520ece7 // indirect
github.com/spf13/viper v1.8.1 // indirect
github.com/sykesm/zap-logfmt v0.0.4 // indirect
go.uber.org/zap v1.18.1 // indirect
golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97 // indirect
google.golang.org/grpc v1.39.0 // indirect
)
replace github.com/golang/protobuf => github.com/golang/protobuf v1.3.2
example/contracts/src/broker/helper.go
View file @
7bce9c1a
...
...
@@ -5,7 +5,6 @@ import (
"encoding/json"
"fmt"
"strconv"
"strings"
"github.com/golang/protobuf/proto"
"github.com/hyperledger/fabric/core/chaincode/shim"
...
...
@@ -201,23 +200,3 @@ func (broker *Broker) checkWhitelist(stub shim.ChaincodeStubInterface, function
return
broker
.
onlyWhitelist
(
stub
)
}
func
(
broker
*
Broker
)
validDID
(
did
string
)
bool
{
s
:=
strings
.
Split
(
did
,
":"
)
if
len
(
s
)
!=
4
||
s
[
0
]
!=
"did"
||
s
[
1
]
==
""
||
s
[
2
]
==
""
||
s
[
3
]
==
""
{
return
false
}
return
true
}
func
parseMethod
(
did
string
)
string
{
s
:=
strings
.
Split
(
did
,
":"
)
if
len
(
s
)
!=
4
||
s
[
0
]
!=
"did"
||
s
[
1
]
==
""
||
s
[
2
]
==
""
||
s
[
3
]
==
""
{
return
""
}
return
fmt
.
Sprintf
(
"%s:%s:%s:."
,
s
[
0
],
s
[
1
],
s
[
2
])
}
func
ErrInvalidDID
(
did
string
)
pb
.
Response
{
return
errorResponse
(
fmt
.
Sprintf
(
"Invalid did format for %s"
,
did
))
}
example/contracts/src/broker/meta.go
View file @
7bce9c1a
...
...
@@ -21,9 +21,6 @@ func (broker *Broker) getOutMessage(stub shim.ChaincodeStubInterface, args []str
}
destChainMethod
:=
args
[
0
]
sequenceNum
:=
args
[
1
]
if
!
broker
.
validDID
(
destChainMethod
)
{
return
ErrInvalidDID
(
destChainMethod
)
}
key
:=
broker
.
outMsgKey
(
destChainMethod
,
sequenceNum
)
v
,
err
:=
stub
.
GetState
(
key
)
if
err
!=
nil
{
...
...
@@ -45,12 +42,9 @@ func (broker *Broker) getInMessage(stub shim.ChaincodeStubInterface, args []stri
if
len
(
args
)
<
2
{
return
shim
.
Error
(
"incorrect number of arguments, expecting 2"
)
}
sourceChainMethod
:=
args
[
0
]
inServicePair
:=
args
[
0
]
sequenceNum
:=
args
[
1
]
if
!
broker
.
validDID
(
sourceChainMethod
)
{
return
ErrInvalidDID
(
sourceChainMethod
)
}
key
:=
broker
.
inMsgKey
(
sourceChainMethod
,
sequenceNum
)
key
:=
broker
.
inMsgKey
(
inServicePair
,
sequenceNum
)
v
,
err
:=
stub
.
GetState
(
key
)
if
err
!=
nil
{
return
shim
.
Error
(
err
.
Error
())
...
...
@@ -66,6 +60,14 @@ func (broker *Broker) getCallbackMeta(stub shim.ChaincodeStubInterface) pb.Respo
return
shim
.
Success
(
v
)
}
func
(
broker
*
Broker
)
getDstRollbackMeta
(
stub
shim
.
ChaincodeStubInterface
)
pb
.
Response
{
v
,
err
:=
stub
.
GetState
(
dstRollbackMeta
)
if
err
!=
nil
{
return
shim
.
Error
(
err
.
Error
())
}
return
shim
.
Success
(
v
)
}
func
(
broker
*
Broker
)
markInCounter
(
stub
shim
.
ChaincodeStubInterface
,
from
string
)
error
{
inMeta
,
err
:=
broker
.
getMap
(
stub
,
innerMeta
)
if
err
!=
nil
{
...
...
@@ -86,3 +88,15 @@ func (broker *Broker) markCallbackCounter(stub shim.ChaincodeStubInterface, from
return
broker
.
putMap
(
stub
,
callbackMeta
,
meta
)
}
func
(
broker
*
Broker
)
markDstRollbackCounter
(
stub
shim
.
ChaincodeStubInterface
,
from
string
,
index
uint64
)
error
{
meta
,
err
:=
broker
.
getMap
(
stub
,
dstRollbackMeta
)
if
err
!=
nil
{
return
err
}
meta
[
from
]
=
index
return
broker
.
putMap
(
stub
,
dstRollbackMeta
,
meta
)
}
example/contracts/src/data_swapper/data_swapper.go
View file @
7bce9c1a
...
...
@@ -62,9 +62,9 @@ func (s *DataSwapper) get(stub shim.ChaincodeStubInterface, args []string) pb.Re
return
shim
.
Success
(
value
)
case
2
:
// args[0]: destination
appchain contract d
id
// args[0]: destination
service
id
// args[1]: key
b
:=
util
.
ToChaincodeArgs
(
emitInterchainEventFunc
,
args
[
0
],
"interchainGet
"
,
args
[
2
],
"interchainSet"
,
args
[
2
],
""
,
""
)
b
:=
util
.
ToChaincodeArgs
(
emitInterchainEventFunc
,
args
[
0
],
"interchainGet
,interchainSet,"
,
args
[
1
],
args
[
1
]
,
""
)
response
:=
stub
.
InvokeChaincode
(
brokerContractName
,
b
,
channelID
)
if
response
.
Status
!=
shim
.
OK
{
return
shim
.
Error
(
fmt
.
Errorf
(
"invoke broker chaincode %s error: %s"
,
brokerContractName
,
response
.
Message
)
.
Error
())
...
...
example/contracts/src/data_swapper/go.mod
0 → 100644
View file @
7bce9c1a
module github.com/meshplus/data_swapper
go 1.13
require (
github.com/Knetic/govaluate v3.0.0+incompatible // indirect
github.com/Shopify/sarama v1.29.1 // indirect
github.com/fsouza/go-dockerclient v1.7.3 // indirect
github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 // indirect
github.com/hashicorp/go-version v1.3.0 // indirect
github.com/hyperledger/fabric v1.4.3
github.com/hyperledger/fabric-amcl v0.0.0-20210603140002-2670f91851c8 // indirect
github.com/miekg/pkcs11 v1.0.3 // indirect
github.com/onsi/gomega v1.14.0 // indirect
github.com/op/go-logging v0.0.0-20160315200505-970db520ece7 // indirect
github.com/spf13/viper v1.8.1 // indirect
github.com/sykesm/zap-logfmt v0.0.4 // indirect
go.uber.org/zap v1.18.1 // indirect
golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97 // indirect
google.golang.org/grpc v1.39.0 // indirect
)
replace github.com/golang/protobuf => github.com/golang/protobuf v1.3.2
example/contracts/src/transfer/go.mod
0 → 100644
View file @
7bce9c1a
module github.com/meshplus/transfer
go 1.13
require (
github.com/Knetic/govaluate v3.0.0+incompatible // indirect
github.com/Shopify/sarama v1.29.1 // indirect
github.com/fsouza/go-dockerclient v1.7.3 // indirect
github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 // indirect
github.com/hashicorp/go-version v1.3.0 // indirect
github.com/hyperledger/fabric v1.4.3
github.com/hyperledger/fabric-amcl v0.0.0-20210603140002-2670f91851c8 // indirect
github.com/miekg/pkcs11 v1.0.3 // indirect
github.com/onsi/gomega v1.14.0 // indirect
github.com/op/go-logging v0.0.0-20160315200505-970db520ece7 // indirect
github.com/spf13/viper v1.8.1 // indirect
github.com/sykesm/zap-logfmt v0.0.4 // indirect
go.uber.org/zap v1.18.1 // indirect
golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97 // indirect
google.golang.org/grpc v1.39.0 // indirect
)
replace github.com/golang/protobuf => github.com/golang/protobuf v1.3.2
example/contracts/src/transfer/transfer.go
View file @
7bce9c1a
...
...
@@ -92,8 +92,7 @@ func (t *Transfer) transfer(stub shim.ChaincodeStubInterface, args []string) pb.
return
shim
.
Success
(
nil
)
case
4
:
// args[0]: destination appchain contract did
destContractDID
:=
args
[
0
]
dstServiceID
:=
args
[
0
]
sender
:=
args
[
1
]
receiver
:=
args
[
2
]
amountArg
:=
args
[
3
]
...
...
@@ -121,7 +120,7 @@ func (t *Transfer) transfer(stub shim.ChaincodeStubInterface, args []string) pb.
args
:=
strings
.
Join
([]
string
{
sender
,
receiver
,
amountArg
},
","
)
argsRb
:=
strings
.
Join
([]
string
{
sender
,
amountArg
},
","
)
b
:=
util
.
ToChaincodeArgs
(
emitInterchainEventFunc
,
d
estContractDID
,
"interchainCharge"
,
args
,
""
,
""
,
"interchainRollback
"
,
argsRb
)
b
:=
util
.
ToChaincodeArgs
(
emitInterchainEventFunc
,
d
stServiceID
,
"interchainCharge,,interchainRollback"
,
args
,
"
"
,
argsRb
)
response
:=
stub
.
InvokeChaincode
(
brokerContractName
,
b
,
channelID
)
if
response
.
Status
!=
shim
.
OK
{
return
shim
.
Error
(
fmt
.
Errorf
(
"invoke broker chaincode %s"
,
response
.
Message
)
.
Error
())
...
...
go.mod
View file @
7bce9c1a
...
...
@@ -3,26 +3,22 @@ module github.com/meshplus/pier-client-fabric
go 1.13
require (
github.com/OneOfOne/xxhash v1.2.5 // indirect
github.com/Rican7/retry v0.1.0
github.com/VividCortex/gohistogram v1.0.0 // indirect
github.com/cloudflare/cfssl v0.0.0-20190409034051-768cd563887f
github.com/elastic/gosigar v0.8.1-0.20180330100440-37f05ff46ffa // indirect
github.com/go-logfmt/logfmt v0.4.0 // indirect
github.com/golang/protobuf v1.
4.3
github.com/golang/protobuf v1.
5.2
github.com/google/certificate-transparency-go v1.1.0 // indirect
github.com/hashicorp/go-hclog v0.0.0-20180709165350-ff2cf002a8dd
github.com/hashicorp/go-plugin v1.3.0
github.com/hyperledger/fabric v2.0.1+incompatible
github.com/hyperledger/fabric-chaincode-go v0.0.0-20200511190512-bcfeb58dd83a
github.com/hyperledger/fabric-lib-go v1.0.0 // indirect
github.com/hyperledger/fabric-protos-go v0.0.0-2020
0330074707-cfe579e86986
github.com/hyperledger/fabric-protos-go v0.0.0-2020
1028172056-a3136dde2354
github.com/hyperledger/fabric-sdk-go v1.0.0-alpha5
github.com/meshplus/bitxhub-model v1.2.1-0.20210524073042-f243c2fee25b
github.com/meshplus/bitxid v0.0.0-20210412025850-e0eaf0f9063a
github.com/meshplus/pier v1.7.1-0.20210524093640-1337e0a53318
github.com/meshplus/bitxhub-model v1.2.1-0.20210805064451-03258148acad
github.com/meshplus/pier v1.11.1-0.20210809064238-de527e06d443
github.com/spf13/viper v1.7.0
sigs.k8s.io/yaml v1.2.0 // indirect
)
replace (
...
...
@@ -30,5 +26,4 @@ replace (
github.com/golang/protobuf => github.com/golang/protobuf v1.3.2
github.com/prometheus/client_golang => github.com/prometheus/client_golang v0.9.3
google.golang.org/genproto => google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884
google.golang.org/protobuf => google.golang.org/protobuf v1.21.0
)
go.sum
View file @
7bce9c1a
This diff is collapsed.
Click to expand it.
receipt.go
View file @
7bce9c1a
...
...
@@ -2,14 +2,13 @@ package main
import
(
"fmt"
"time"
"github.com/meshplus/bitxhub-model/pb"
)
func
(
c
*
Client
)
generateCallback
(
original
*
pb
.
IBTP
,
args
[][]
byte
,
proof
[]
byte
,
status
bool
)
(
result
*
pb
.
IBTP
,
err
error
)
{
func
(
c
*
Client
)
generateCallback
(
original
*
pb
.
IBTP
,
args
[][]
byte
,
status
bool
)
(
result
*
pb
.
IBTP
,
err
error
)
{
if
original
==
nil
{
return
nil
,
fmt
.
Errorf
(
"got nil ibtp
t
o generate receipt: %w"
,
err
)
return
nil
,
fmt
.
Errorf
(
"got nil ibtp
T
o generate receipt: %w"
,
err
)
}
pd
:=
&
pb
.
Payload
{}
if
err
:=
pd
.
Unmarshal
(
original
.
Payload
);
err
!=
nil
{
...
...
@@ -20,10 +19,9 @@ func (c *Client) generateCallback(original *pb.IBTP, args [][]byte, proof []byte
if
err
:=
originalContent
.
Unmarshal
(
pd
.
Content
);
err
!=
nil
{
return
nil
,
fmt
.
Errorf
(
"ibtp payload unmarshal: %w"
,
err
)
}
content
:=
&
pb
.
Content
{
SrcContractId
:
originalContent
.
DstContractId
,
DstContractId
:
originalContent
.
SrcContractId
,
}
content
:=
&
pb
.
Content
{}
typ
:=
pb
.
IBTP_RECEIPT_SUCCESS
if
status
{
content
.
Func
=
originalContent
.
Callback
...
...
@@ -31,6 +29,11 @@ func (c *Client) generateCallback(original *pb.IBTP, args [][]byte, proof []byte
}
else
{
content
.
Func
=
originalContent
.
Rollback
content
.
Args
=
originalContent
.
ArgsRb
typ
=
pb
.
IBTP_RECEIPT_FAILURE
}
if
original
.
Type
==
pb
.
IBTP_ROLLBACK
{
typ
=
pb
.
IBTP_RECEIPT_ROLLBACK
}
b
,
err
:=
content
.
Marshal
()
...
...
@@ -46,19 +49,13 @@ func (c *Client) generateCallback(original *pb.IBTP, args [][]byte, proof []byte
return
nil
,
err
}
typ
:=
pb
.
IBTP_RECEIPT_SUCCESS
if
!
status
{
typ
=
pb
.
IBTP_RECEIPT_FAILURE
}
return
&
pb
.
IBTP
{
From
:
original
.
From
,
To
:
original
.
To
,
Index
:
original
.
Index
,
Type
:
typ
,
Timestamp
:
time
.
Now
()
.
UnixNano
(),
Proof
:
proof
,
Payload
:
pdb
,
Version
:
original
.
Version
,
From
:
original
.
From
,
To
:
original
.
To
,
Index
:
original
.
Index
,
Type
:
typ
,
Proof
:
original
.
Proof
,
Payload
:
pdb
,
Version
:
original
.
Version
,
},
nil
}
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