Skip to content

Commit

Permalink
add debug logs
Browse files Browse the repository at this point in the history
  • Loading branch information
vgonkivs committed Aug 6, 2024
1 parent a7ae113 commit 7f49843
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
15 changes: 13 additions & 2 deletions nodebuilder/p2p/tls.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,13 @@ var tlsPath = "CELESTIA_TLS_PATH"
// and an error.
func tlsEnabled() (*tls.Config, bool, error) {
path := os.Getenv(tlsPath)
if path == "" {
log.Debug("the CELESTIA_TLS_PATH was not set")
return nil, false, nil
}

certPath := filepath.Join(path, cert)
keyPath := filepath.Join(path, key)

exist := utils.Exists(certPath) && utils.Exists(keyPath)
if !exist {
return nil, false, nil
Expand All @@ -37,15 +41,22 @@ func tlsEnabled() (*tls.Config, bool, error) {
return nil, false, err
}
certificates = append(certificates, cert)
return &tls.Config{MinVersion: tls.VersionTLS12, Certificates: certificates}, true, nil

return &tls.Config{
MinVersion: tls.VersionTLS12,
Certificates: certificates,
}, true, nil
}

// wsTransport enables a support for the secure websocket connection
// using the passed tls config. The connection will be insecure in case
// config is empty.
func wsTransport(config *tls.Config) libp2p.Option {
if config == nil {
log.Info("using a default ws transport")
return libp2p.Transport(ws.New)
}

log.Info("using a wss transport with tlsConfig")
return libp2p.Transport(ws.New, ws.WithTLSConfig(config))
}
2 changes: 1 addition & 1 deletion state/core_access.go
Original file line number Diff line number Diff line change
Expand Up @@ -594,7 +594,7 @@ func (ca *CoreAccessor) setupTxClient(ctx context.Context, keyName string) (*use
}
ca.defaultSignerAddress = addr
return user.SetupTxClient(ctx, ca.keyring, ca.coreConn, encCfg,
user.WithDefaultAccount(keyName),
user.WithDefaultAccount(keyName), user.WithDefaultAddress(addr),
)
}

Expand Down

0 comments on commit 7f49843

Please sign in to comment.