Skip to content

Commit

Permalink
Update Check Rate
Browse files Browse the repository at this point in the history
  • Loading branch information
joelsmith-2019 committed Oct 28, 2024
1 parent a8d4598 commit 24ee846
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions node/pkg/wormconn/send_tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,8 @@ func (c *ClientConn) SignAndBroadcastTx(ctx context.Context, msg sdktypes.Msg) (
if err != nil {
return nil, fmt.Errorf("failed to wait for tx inclusion: %w", err)
} else {

fmt.Println("JOEL - TX BROADCASTED BEFORE", txResp.TxResponse)

// update the response with the final result
txResp.TxResponse = res.TxResponse

fmt.Println("JOEL - TX BROADCASTED AFTER", txResp.TxResponse)
}

return txResp, nil
Expand All @@ -117,18 +112,18 @@ func waitForBlockInclusion(ctx context.Context, client sdktx.ServiceClient, txHa
select {
// check if wait timeout is exceeded
case <-exitAfter:
fmt.Println("JOEL - TIMED OUT", txHash)
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(100 * time.Millisecond):
case <-time.After(1000 * time.Millisecond):
res, err := client.GetTx(ctx, &sdktx.GetTxRequest{Hash: txHash})
if err == nil {
fmt.Print("JOEL - FOUND TX IN BLOCK", txHash)
fmt.Print("JOEL - FOUND TX IN BLOCK ", txHash)
return res, nil
}
// check if context is done
case <-ctx.Done():
fmt.Println("JOEL - CONTEXT DONE", txHash, ctx.Err())
fmt.Println("JOEL - CONTEXT DONE ", txHash, ctx.Err())
return nil, ctx.Err()
}
}
Expand Down

0 comments on commit 24ee846

Please sign in to comment.