Skip to content

Commit

Permalink
fix: Fix relayer start (#320)
Browse files Browse the repository at this point in the history
  • Loading branch information
mtsitrin authored Jul 28, 2023
1 parent 1044fd6 commit 2cbbc6c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
10 changes: 8 additions & 2 deletions relayer/channels.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ func (r *Relayer) LoadChannels() (string, string, error) {
return "", "", err
}

if output.Len() == 0 {
return "", "", nil
}

// While there are JSON objects in the stream...
var outputStruct RollappQueryResult
dec := json.NewDecoder(&output)
Expand All @@ -28,7 +32,8 @@ func (r *Relayer) LoadChannels() (string, string, error) {
}

if outputStruct.State != "STATE_OPEN" {
return "", "", fmt.Errorf("channel %s is not STATE_OPEN (%s)", outputStruct.ChannelID, outputStruct.State)
r.logger.Printf("channel %s is not STATE_OPEN (%s)", outputStruct.ChannelID, outputStruct.State)
return "", "", nil
}

// Check if the channel is open on the hub
Expand All @@ -43,9 +48,10 @@ func (r *Relayer) LoadChannels() (string, string, error) {
}

if res.Channel.State != "STATE_OPEN" {
return "", "", fmt.Errorf("channel %s is STATE_OPEN on the rollapp, but channel %s is %s on the hub",
r.logger.Printf("channel %s is STATE_OPEN on the rollapp, but channel %s is %s on the hub",
outputStruct.ChannelID, outputStruct.Counterparty.ChannelID, res.Channel.State,
)
return "", "", nil
}

r.SrcChannel = outputStruct.ChannelID
Expand Down
2 changes: 2 additions & 0 deletions relayer/relayer_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package relayer

import (
"fmt"
"io"
"log"

"github.com/dymensionxyz/roller/config"
Expand All @@ -21,6 +22,7 @@ func NewRelayer(home, rollappID, hubID string) *Relayer {
Home: home,
RollappID: rollappID,
HubID: hubID,
logger: log.New(io.Discard, "", 0),
}
}

Expand Down

0 comments on commit 2cbbc6c

Please sign in to comment.