context: cleaning up context dead ends (#7963)

This commit is contained in:
Sam Kleinman
2022-02-22 15:04:16 -05:00
committed by GitHub
parent 912751cf93
commit 2ffb262600
9 changed files with 15 additions and 17 deletions

View File

@@ -175,7 +175,7 @@ func startLightNode(ctx context.Context, cfg *Config) error {
providers := rpcEndpoints(tmcfg.P2P.PersistentPeers)
c, err := light.NewHTTPClient(
context.Background(),
ctx,
cfg.ChainID,
light.TrustOptions{
Period: tmcfg.StateSync.TrustPeriod,

View File

@@ -43,7 +43,7 @@ func Benchmark(ctx context.Context, testnet *e2e.Testnet, benchmarkLength int64)
logger.Info("Ending benchmark period", "height", block.Height)
// fetch a sample of blocks
blocks, err := fetchBlockChainSample(testnet, benchmarkLength)
blocks, err := fetchBlockChainSample(ctx, testnet, benchmarkLength)
if err != nil {
return err
}
@@ -128,7 +128,7 @@ func (t *testnetStats) String() string {
// fetchBlockChainSample waits for `benchmarkLength` amount of blocks to pass, fetching
// all of the headers for these blocks from an archive node and returning it.
func fetchBlockChainSample(testnet *e2e.Testnet, benchmarkLength int64) ([]*types.BlockMeta, error) {
func fetchBlockChainSample(ctx context.Context, testnet *e2e.Testnet, benchmarkLength int64) ([]*types.BlockMeta, error) {
var blocks []*types.BlockMeta
// Find the first archive node
@@ -139,7 +139,6 @@ func fetchBlockChainSample(testnet *e2e.Testnet, benchmarkLength int64) ([]*type
}
// find the latest height
ctx := context.Background()
s, err := c.Status(ctx)
if err != nil {
return nil, err