Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: delete lockBech32Prefix cosmosclient #4487

Closed
wants to merge 6 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 0 additions & 15 deletions ignite/pkg/cosmosclient/cosmosclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (
"path/filepath"
"strconv"
"strings"
"sync"
"time"

"github.com/cenkalti/backoff"
Expand Down Expand Up @@ -443,8 +442,6 @@ func (c Client) WaitForTx(ctx context.Context, hash string) (*ctypes.ResultTx, e

// Account returns the account with name or address equal to nameOrAddress.
func (c Client) Account(nameOrAddress string) (cosmosaccount.Account, error) {
defer c.lockBech32Prefix()()

acc, err := c.AccountRegistry.GetByName(nameOrAddress)
if err == nil {
return acc, nil
Expand Down Expand Up @@ -523,16 +520,6 @@ func (c Client) Status(ctx context.Context) (*ctypes.ResultStatus, error) {
return c.RPC.Status(ctx)
}

// protects sdktypes.Config.
var mconf sync.Mutex

func (c Client) lockBech32Prefix() (unlockFn func()) {
mconf.Lock()
config := sdktypes.GetConfig()
config.SetBech32PrefixForAccount(c.addressPrefix, c.addressPrefix+"pub")
return mconf.Unlock
}

func (c Client) BroadcastTx(ctx context.Context, account cosmosaccount.Account, msgs ...transaction.Msg) (Response, error) {
txService, err := c.CreateTx(ctx, account, msgs...)
if err != nil {
Expand All @@ -545,8 +532,6 @@ func (c Client) BroadcastTx(ctx context.Context, account cosmosaccount.Account,
// CreateTxWithOptions creates a transaction with the given options.
// Options override global client options.
func (c Client) CreateTxWithOptions(ctx context.Context, account cosmosaccount.Account, options TxOptions, msgs ...transaction.Msg) (TxService, error) {
defer c.lockBech32Prefix()()

if c.useFaucet && !c.generateOnly {
addr, err := account.Address(c.addressPrefix)
if err != nil {
Expand Down
Loading