From 13063cc595b1eb98323f124c58976ed6e1a967a4 Mon Sep 17 00:00:00 2001 From: Joel Smith Date: Tue, 29 Oct 2024 16:07:34 -0500 Subject: [PATCH] Reset Lookup Time --- node/pkg/wormconn/send_tx.go | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/node/pkg/wormconn/send_tx.go b/node/pkg/wormconn/send_tx.go index f12ad63c31..cf5391ee48 100644 --- a/node/pkg/wormconn/send_tx.go +++ b/node/pkg/wormconn/send_tx.go @@ -107,29 +107,20 @@ func (c *ClientConn) SignAndBroadcastTx(ctx context.Context, msg sdktypes.Msg) ( // waitForBlockInclusion waits for the tx to be included in a block, or times out after a given duration. func waitForBlockInclusion(ctx context.Context, client sdktx.ServiceClient, txHash string, waitTimeout time.Duration) (*sdktx.GetTxResponse, error) { - - now := time.Now() - exitAfter := time.After(waitTimeout) for { select { // check if wait timeout is exceeded case <-exitAfter: - fmt.Println("JOEL - TIMED OUT ", txHash) return nil, fmt.Errorf("timed out after: %d; wait for tx %s to be included in a block", waitTimeout, txHash) // check if in block every second - case <-time.After(3000 * time.Millisecond): + case <-time.After(100 * time.Millisecond): res, err := client.GetTx(ctx, &sdktx.GetTxRequest{Hash: txHash}) if err == nil { - took := time.Since(now) - fmt.Println("JOEL - FOUND TX IN BLOCK", txHash, " after ", took.Milliseconds(), "ms") return res, nil - } else { - fmt.Println("JOEL - NO TX YET IN BLOCK ", txHash) } // check if context is done case <-ctx.Done(): - fmt.Println("JOEL - CONTEXT DONE ", txHash, ctx.Err()) return nil, ctx.Err() } }