contexts: remove all TODO instances (#7466)

This commit is contained in:
Sam Kleinman
2021-12-16 15:15:26 -05:00
committed by GitHub
parent 184b105509
commit bef120dadf
27 changed files with 129 additions and 129 deletions
+3 -3
View File
@@ -39,10 +39,10 @@ func initFiles(cmd *cobra.Command, args []string) error {
return errors.New("must specify a node type: tendermint init [validator|full|seed]")
}
config.Mode = args[0]
return initFilesWithConfig(config)
return initFilesWithConfig(cmd.Context(), config)
}
func initFilesWithConfig(config *cfg.Config) error {
func initFilesWithConfig(ctx context.Context, config *cfg.Config) error {
var (
pv *privval.FilePV
err error
@@ -98,7 +98,7 @@ func initFilesWithConfig(config *cfg.Config) error {
}
}
ctx, cancel := context.WithTimeout(context.TODO(), ctxTimeout)
ctx, cancel := context.WithTimeout(ctx, ctxTimeout)
defer cancel()
// if this is a validator we add it to genesis
+4 -3
View File
@@ -25,13 +25,14 @@ func showValidator(cmd *cobra.Command, args []string) error {
var (
pubKey crypto.PubKey
err error
bctx = cmd.Context()
)
//TODO: remove once gRPC is the only supported protocol
protocol, _ := tmnet.ProtocolAndAddress(config.PrivValidator.ListenAddr)
switch protocol {
case "grpc":
pvsc, err := tmgrpc.DialRemoteSigner(
bctx,
config.PrivValidator,
config.ChainID(),
logger,
@@ -41,7 +42,7 @@ func showValidator(cmd *cobra.Command, args []string) error {
return fmt.Errorf("can't connect to remote validator %w", err)
}
ctx, cancel := context.WithTimeout(context.TODO(), ctxTimeout)
ctx, cancel := context.WithTimeout(bctx, ctxTimeout)
defer cancel()
pubKey, err = pvsc.GetPubKey(ctx)
@@ -60,7 +61,7 @@ func showValidator(cmd *cobra.Command, args []string) error {
return err
}
ctx, cancel := context.WithTimeout(context.TODO(), ctxTimeout)
ctx, cancel := context.WithTimeout(bctx, ctxTimeout)
defer cancel()
pubKey, err = pv.GetPubKey(ctx)
+4 -4
View File
@@ -122,7 +122,7 @@ func testnetFiles(cmd *cobra.Command, args []string) error {
}
genVals := make([]types.GenesisValidator, nValidators)
ctx := cmd.Context()
for i := 0; i < nValidators; i++ {
nodeDirName := fmt.Sprintf("%s%d", nodeDirPrefix, i)
nodeDir := filepath.Join(outputDir, nodeDirName)
@@ -139,7 +139,7 @@ func testnetFiles(cmd *cobra.Command, args []string) error {
return err
}
if err := initFilesWithConfig(config); err != nil {
if err := initFilesWithConfig(ctx, config); err != nil {
return err
}
@@ -150,7 +150,7 @@ func testnetFiles(cmd *cobra.Command, args []string) error {
return err
}
ctx, cancel := context.WithTimeout(context.TODO(), ctxTimeout)
ctx, cancel := context.WithTimeout(ctx, ctxTimeout)
defer cancel()
pubKey, err := pv.GetPubKey(ctx)
@@ -181,7 +181,7 @@ func testnetFiles(cmd *cobra.Command, args []string) error {
return err
}
if err := initFilesWithConfig(config); err != nil {
if err := initFilesWithConfig(ctx, config); err != nil {
return err
}
}