diff --git a/cmd/config.go b/cmd/config.go index 2966d3fef99..8f4c7cdec13 100644 --- a/cmd/config.go +++ b/cmd/config.go @@ -362,7 +362,7 @@ func validateConfig(c *Config) error { } for _, i := range c.Chains { - if err := i.Init(homePath, to, debug); err != nil { + if err := i.Init(homePath, to, nil, debug); err != nil { return fmt.Errorf("did you remember to run 'rly config init' error:%w", err) } } diff --git a/relayer/chain.go b/relayer/chain.go index 0d4ac41993e..044a5e5151c 100644 --- a/relayer/chain.go +++ b/relayer/chain.go @@ -195,7 +195,7 @@ func (c *Chain) listenLoop(doneChan chan struct{}, tx, block, data bool) { // Init initializes the pieces of a chain that aren't set when it parses a config // NOTE: All validation of the chain should happen here. -func (c *Chain) Init(homePath string, timeout time.Duration, debug bool) error { +func (c *Chain) Init(homePath string, timeout time.Duration, logger log.Logger, debug bool) error { keybase, err := keys.New(c.ChainID, "test", keysDir(homePath, c.ChainID), nil) if err != nil { return err @@ -222,10 +222,15 @@ func (c *Chain) Init(homePath string, timeout time.Duration, debug bool) error { c.Client = client c.HomePath = homePath c.Encoding = encodingConfig - c.logger = defaultChainLogger() + c.logger = logger c.timeout = timeout c.debug = debug c.faucetAddrs = make(map[string]time.Time) + + if c.logger == nil { + c.logger = defaultChainLogger() + } + return nil } diff --git a/test/test_setup.go b/test/test_setup.go index 173e51ed4d6..ed4565b4bad 100644 --- a/test/test_setup.go +++ b/test/test_setup.go @@ -121,7 +121,7 @@ func spinUpTestContainer(t *testing.T, rchan chan<- *dockertest.Resource, } // initialize the chain - require.NoError(t, c.Init(dir, tc.t.timeout, debug)) + require.NoError(t, c.Init(dir, tc.t.timeout, nil, debug)) // create the test key require.NoError(t, c.CreateTestKey())