Skip to content

Commit

Permalink
fix: fix issue where icon to icon bridge does not start if one icon n…
Browse files Browse the repository at this point in the history
…ode is already running
  • Loading branch information
riyasng12 committed Dec 22, 2023
1 parent ed1d61a commit ca97893
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions cli/cmd/bridge/btp/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ func RunBtpSetup(cli *common.Cli, chains *utils.Chains, bridge bool) (string, er

func runBtpSetupWhenChainsAreIcon(cli *common.Cli, chains *utils.Chains, enclaveContext *enclaves.EnclaveContext, bridge bool) (string, error) {

if chains.ChainAServiceName != "" && chains.ChainBServiceName == "" {
if chains.ChainAServiceName != "" && chains.ChainBServiceName != "" {
srcChainServiceResponse, dstChainServiceResponse, err := chains.GetServicesResponse(cli)
if err != nil {
return "", common.WrapMessageToError(err, "BTP Setup run Failed For Icon Chains")
Expand All @@ -82,6 +82,12 @@ func runBtpSetupWhenChainsAreIcon(cli *common.Cli, chains *utils.Chains, enclave
return "", common.WrapMessageToError(err, "BTP Setup run Failed For Icon Chains")
}
return response, nil
} else if (chains.ChainAServiceName == "" && chains.ChainBServiceName != "") || (chains.ChainAServiceName != "" && chains.ChainBServiceName == "") {
response, err := runBtpSetupWhenSingleChainRunning(cli, enclaveContext, chains, bridge)
if err != nil {
return "", common.WrapMessageToError(err, fmt.Sprintf("BTP Setup Failed For ChainA %s and ChainB %s", chains.ChainA, chains.ChainB))
}
return response, nil
} else {
response, err := runBtpSetupByRunningNodes(cli, enclaveContext, chains, bridge)
if err != nil {
Expand Down Expand Up @@ -180,7 +186,12 @@ func runBtpSetupWhenSingleChainRunning(cli *common.Cli, enclaveContext *enclaves

}

if chains.ChainB == "icon" {
if chains.AreChainsIcon() {
response, err = runBtpSetupForAlreadyRunningNodes(cli, enclaveContext, runBridgeIcon2icon, chains.ChainA, chains.ChainB, bridge, chainAServiceResponse, chainBServiceResponse)
if err != nil {
return "", common.WrapMessageToError(err, fmt.Sprintf("BTP Setup Failed For ChainA %s and ChainB %s", chains.ChainA, chains.ChainB))
}
} else if chains.ChainB == "icon" {
response, err = runBtpSetupForAlreadyRunningNodes(cli, enclaveContext, runBridgeIcon2EthHardhat, chains.ChainB, chains.ChainA, bridge, chainBServiceResponse, chainAServiceResponse)
if err != nil {
return "", common.WrapMessageToError(err, fmt.Sprintf("BTP Setup Failed For ChainA %s and ChainB %s", chains.ChainA, chains.ChainB))
Expand Down

0 comments on commit ca97893

Please sign in to comment.