Skip to content

Commit

Permalink
comment
Browse files Browse the repository at this point in the history
  • Loading branch information
lumtis committed Nov 16, 2021
1 parent d8360dc commit 141e5d0
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 18 deletions.
12 changes: 0 additions & 12 deletions starport/cmd/account.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,15 +116,3 @@ func getPassphrase(cmd *cobra.Command) (string, error) {

return pass, nil
}

func checkAccountExist(cmd *cobra.Command, name string) error {
ca, err := cosmosaccount.New(
cosmosaccount.WithKeyringBackend(getKeyringBackend(cmd)),
)
if err != nil {
return err
}

_, err = ca.GetByName(name)
return err
}
10 changes: 5 additions & 5 deletions starport/cmd/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,10 @@ var cosmos *cosmosclient.Client

// initializeNetwork initializes event bus, CLIn components such as spinner and returns a new network builder
func initializeNetwork(cmd *cobra.Command) (
*network.Builder,
*clispinner.Spinner,
func(),
error,
nb *network.Builder,
spinner *clispinner.Spinner,
cleanup func(),
err error,
) {
var (
wg sync.WaitGroup
Expand All @@ -91,7 +91,7 @@ func initializeNetwork(cmd *cobra.Command) (
wg.Wait()
}

nb, err := newNetwork(cmd, network.CollectEvents(ev))
nb, err = newNetwork(cmd, network.CollectEvents(ev))
if err != nil {
shutdown()
}
Expand Down
3 changes: 2 additions & 1 deletion starport/cmd/network_chain_init.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ func networkChainInitHandler(cmd *cobra.Command, args []string) error {

// check if the provided account for the validator exists
validatorAccount, _ := cmd.Flags().GetString(flagValidatorAccount)
if err := checkAccountExist(cmd, validatorAccount); err != nil {
_, err = nb.AccountRegistry().GetByName(validatorAccount)
if err != nil {
return err
}

Expand Down
5 changes: 5 additions & 0 deletions starport/services/network/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,11 @@ func InitializationKeyringBackend(keyringBackend chaincmd.KeyringBackend) InitOp
}
}

// AccountRegistry returns the account registry used by the network builder
func (b Builder) AccountRegistry() cosmosaccount.Registry {
return b.cosmos.AccountRegistry
}

// Blockchain initializes a blockchain from source and options.
func (b *Builder) Blockchain(ctx context.Context, source SourceOption, options ...InitOption) (*Blockchain, error) {
var o initOptions
Expand Down

0 comments on commit 141e5d0

Please sign in to comment.