From 76a82190a710a6aeef66cc58c00053c6f192dccb Mon Sep 17 00:00:00 2001 From: Julian Toledano Date: Mon, 11 Mar 2024 17:50:40 +0100 Subject: [PATCH] fixes + changelog --- CHANGELOG.md | 4 ++++ config.go | 8 +++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f14e690..b75e966 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -36,6 +36,10 @@ Ref: https://keepachangelog.com/en/1.0.0/ ## [Unreleased] +### Bug Fixes + +* [99](https://github.com/cosmos/rosetta/pull/99) Rosetta now can connect to cometBFT over https. + ### Improvements * [93](https://github.com/cosmos/rosetta/pull/93) Removes the use of `LegacyMsg.GetSigners()` in favor of `codec.GetMsgV1Signers`. diff --git a/config.go b/config.go index a5bc522..67f44ce 100644 --- a/config.go +++ b/config.go @@ -22,6 +22,8 @@ const ( HTTP = "http" HTTPS = "https" TCP = "tcp" + + HTTPSPORT = "443" ) // configuration defaults constants @@ -156,7 +158,7 @@ func (c *Config) validate() error { if c.TendermintRPC == "" { return crgerrs.WrapError(crgerrs.ErrConfig, "cometbft rpc not provided") } - validatedURL, err := c.validateUrl(c.TendermintRPC) + validatedURL, err := c.validateURL(c.TendermintRPC) if err != nil { return err } @@ -165,13 +167,13 @@ func (c *Config) validate() error { return nil } -func (c *Config) validateUrl(tendermintRPC string) (string, error) { +func (c *Config) validateURL(tendermintRPC string) (string, error) { u, err := url.Parse(tendermintRPC) if err != nil { return "", crgerrs.WrapError(crgerrs.ErrConfig, err.Error()) } - if u.Port() == "443" && u.Scheme != HTTPS { + if u.Port() == HTTPSPORT && u.Scheme != HTTPS { u.Scheme = HTTPS }