Skip to content

Commit

Permalink
update init cb (#788)
Browse files Browse the repository at this point in the history
  • Loading branch information
AdityaSripal authored Jul 11, 2022
1 parent e07a666 commit 88b20a1
Showing 1 changed file with 28 additions and 19 deletions.
47 changes: 28 additions & 19 deletions spec/app/ics-029-fee-payment/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -251,27 +251,36 @@ function onChanOpenInit(
counterpartyPortIdentifier: Identifier,
counterpartyChannelIdentifier: Identifier,
version: string): (version: string, err: Error) {
// try to unmarshal JSON-encoded version string and pass
// the app-specific version to app callback.
// otherwise, pass version directly to app callback.
metadata, err = UnmarshalJSON(version)
if err != nil {
// call the underlying application's OnChanOpenInit callback
return app.onChanOpenInit(
order,
connectionHops,
portIdentifier,
channelIdentifier,
counterpartyPortIdentifier,
counterpartyChannelIdentifier,
version,
)
if version != "" {
// try to unmarshal JSON-encoded version string and pass
// the app-specific version to app callback.
// otherwise, pass version directly to app callback.
metadata, err = UnmarshalJSON(version)
if err != nil {
// call the underlying applications OnChanOpenInit callback
return app.onChanOpenInit(
order,
connectionHops,
portIdentifier,
channelIdentifier,
counterpartyPortIdentifier,
counterpartyChannelIdentifier,
version,
)
}
// check that feeVersion is supported
if !isSupported(metadata.feeVersion) {
return "", error
}
} else {
// enable fees by default if relayer does not specify otherwise
metadata = {
feeVersion: "ics29-1",
appVersion: "",
}
}
// check that feeVersion is supported
if !isSupported(metadata.feeVersion) {
return "", error
}
// call the underlying application's OnChanOpenInit callback.
// if the version string is empty, OnChanOpenInit is expected to return
// a default version string representing the version(s) it supports
Expand Down

0 comments on commit 88b20a1

Please sign in to comment.