Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SendRequestAndWaitForReceiptAsync Method Hangs Indefinitely Without Returning transactionReceipt #1028

Open
marcelocamargosjr opened this issue May 14, 2024 · 1 comment

Comments

@marcelocamargosjr
Copy link

Description:

The SendRequestAndWaitForReceiptAsync method in the following code is hanging indefinitely and does not return the transactionReceipt.

Code Snippet:

var mintFunction = new MintWithCustomerIdAndTransactionIdFunction
{
    To = mint.RecipientAddress,
    Amount = new BigInteger(mint.Amount * (decimal)Math.Pow(10, 18)),
    CustomerId = mint.Transaction.CustomerId.ToString(),
    TransactionId = mint.Transaction.Id.ToString()
};

var transactionReceipt = await contractHandler.SendRequestAndWaitForReceiptAsync(mintFunction);

Steps to Reproduce:

  1. Execute the above code in the project.
  2. Observe that the call to SendRequestAndWaitForReceiptAsync does not return and hangs indefinitely.

Expected Behavior:

The SendRequestAndWaitForReceiptAsync method should return a transactionReceipt after the transaction is processed.

Actual Behavior:

The SendRequestAndWaitForReceiptAsync method hangs indefinitely and does not return a transactionReceipt.

Environment:

  • .NET version: net6.0
  • Nethereum version: 4.20.0

Possible Cause:

This issue might be related to network connectivity, incorrect contract address, or issues with the blockchain node. Further investigation is required to pinpoint the exact cause.

Suggested Solutions:

  1. Verify the network connectivity and ensure that the blockchain node is reachable.
  2. Check the contract address and other parameters passed to the mintFunction.
  3. Consider adding a timeout to the SendRequestAndWaitForReceiptAsync method call to avoid indefinite hanging.
  4. Enable logging to capture more details about the transaction process.

Additional Information:

Any additional information or logs that can help in diagnosing the issue.

@morda21
Copy link

morda21 commented May 24, 2024

according to your MintWithCustomerIdAndTransactionIdFunction it's a FunctionMessage which derives from ContractMessageBase. If You don't set required properties such Nonce it will never receive receipt.
In your request var transactionReceipt = await contractHandler.SendRequestAndWaitForReceiptAsync(mintFunction); you didn't set cancellation token with any timeout wich is an optional parameter when calling this (Task<TransactionReceipt> SendRequestAndWaitForReceiptAsync(string contractAddress, TContractMessage functionMessage, CancellationToken cancellationToken);)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants