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

txnNotFound issue #312

Closed
aditya-stb opened this issue Nov 18, 2021 · 9 comments
Closed

txnNotFound issue #312

aditya-stb opened this issue Nov 18, 2021 · 9 comments

Comments

@aditya-stb
Copy link

When using send_reliable_submission , xrpl it sometimes returns txnNotFound error. This is due to the fact that it calls submit transaction and fetch result by hash in quick succession which fails to find that transaction sometimes ( XRPLF/rippled#2828 )

@JST5000
Copy link
Collaborator

JST5000 commented Nov 18, 2021

Do you happen to have a stack trace of the error or code snippet which can reproduce the problem?

@mvadari
Copy link
Collaborator

mvadari commented Nov 23, 2021

It doesn't actually call in quick succession - there is a 4-second delay between submitting the transaction and retrieving it for the first time.

@mvadari mvadari linked a pull request Nov 29, 2021 that will close this issue
7 tasks
@JST5000
Copy link
Collaborator

JST5000 commented Jan 14, 2022

Closing as unable to reproduce - if you manage to reproduce happy to reopen! :)

@JST5000 JST5000 closed this as completed Jan 14, 2022
@mvadari mvadari reopened this Jan 14, 2022
@mvadari
Copy link
Collaborator

mvadari commented Jan 14, 2022

Reopening because this is a race condition issue, and thus hard to reproduce. Here is the PR that fixes it in xrpl.js: XRPLF/xrpl.js#1883

@brokeharvard
Copy link

Would be great if we could get a fix for this incorporated into xrpl.py. I'm receiving the txnNotFound error for every OfferCreate transaction I submit notwithstanding them actually showing up on the ledger.

@hammertoe
Copy link
Collaborator

I'm getting this same failure too. Code that reproduces it:

from xrpl.clients import JsonRpcClient
from xrpl.wallet.main import Wallet
from xrpl.models.requests import AccountNFTs
from xrpl.models.transactions import Memo, NFTokenCancelOffer, NFTokenMint
from xrpl.transaction import safe_sign_and_autofill_transaction
from xrpl.transaction import send_reliable_submission
from xrpl.utils import drops_to_xrp, hex_to_str, str_to_hex


client = JsonRpcClient("http://xls20-sandbox.rippletest.net:51234")

# rBYSPwS3zvB2wu1nb5rxvU5gSuh5qgYW8V                                                                                                                           
wallet = Wallet("sh69ae5M5k7JhYpMmCoPVAz27456p", 0)

mint_args = {
    "account": "rBYSPwS3zvB2wu1nb5rxvU5gSuh5qgYW8V",
    "flags": 8,
    "uri": "",
    "memos": [Memo.from_dict({"memo_data": str_to_hex("Minted by Dealer")})],
    "transfer_fee": 0,
    "token_taxon": 0,
}

mint = NFTokenMint.from_dict(mint_args)
my_tx_payment_signed = safe_sign_and_autofill_transaction(mint, wallet, client)
tx_response = send_reliable_submission(my_tx_payment_signed, client)

pprint(tx_response)

Traceback:

Traceback (most recent call last):
  File "cards-dealer.py", line 27, in <module>
    tx_response = send_reliable_submission(my_tx_payment_signed, client)
  File "/Users/mhamilton/Development/demos/venv/lib/python3.8/site-packages/xrpl/transaction/reliable_submission.py", line 32, in send_reliable_submission
    return asyncio.run(async_send_reliable_submission(transaction, client))
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/asyncio/runners.py", line 43, in run
    return loop.run_until_complete(main)
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete
    return future.result()
  File "/Users/mhamilton/Development/demos/venv/lib/python3.8/site-packages/xrpl/asyncio/transaction/reliable_submission.py", line 93, in send_reliable_submission
    return await _wait_for_final_transaction_outcome(
  File "/Users/mhamilton/Development/demos/venv/lib/python3.8/site-packages/xrpl/asyncio/transaction/reliable_submission.py", line 37, in _wait_for_final_transaction_outcome
    transaction_response = await get_transaction_from_hash(transaction_hash, client)
  File "/Users/mhamilton/Development/demos/venv/lib/python3.8/site-packages/xrpl/asyncio/transaction/ledger.py", line 50, in get_transaction_from_hash
    raise XRPLRequestFailureException(response.result)
xrpl.asyncio.clients.exceptions.XRPLRequestFailureException: Request failed, txnNotFound: Transaction not found.

@khancode
Copy link
Collaborator

khancode commented Apr 25, 2022

I'm getting this same failure too. Code that reproduces it:

from xrpl.clients import JsonRpcClient
from xrpl.wallet.main import Wallet
from xrpl.models.requests import AccountNFTs
from xrpl.models.transactions import Memo, NFTokenCancelOffer, NFTokenMint
from xrpl.transaction import safe_sign_and_autofill_transaction
from xrpl.transaction import send_reliable_submission
from xrpl.utils import drops_to_xrp, hex_to_str, str_to_hex


client = JsonRpcClient("http://xls20-sandbox.rippletest.net:51234")

# rBYSPwS3zvB2wu1nb5rxvU5gSuh5qgYW8V                                                                                                                           
wallet = Wallet("sh69ae5M5k7JhYpMmCoPVAz27456p", 0)

mint_args = {
    "account": "rBYSPwS3zvB2wu1nb5rxvU5gSuh5qgYW8V",
    "flags": 8,
    "uri": "",
    "memos": [Memo.from_dict({"memo_data": str_to_hex("Minted by Dealer")})],
    "transfer_fee": 0,
    "token_taxon": 0,
}

mint = NFTokenMint.from_dict(mint_args)
my_tx_payment_signed = safe_sign_and_autofill_transaction(mint, wallet, client)
tx_response = send_reliable_submission(my_tx_payment_signed, client)

pprint(tx_response)

Traceback:

Traceback (most recent call last):
  File "cards-dealer.py", line 27, in <module>
    tx_response = send_reliable_submission(my_tx_payment_signed, client)
  File "/Users/mhamilton/Development/demos/venv/lib/python3.8/site-packages/xrpl/transaction/reliable_submission.py", line 32, in send_reliable_submission
    return asyncio.run(async_send_reliable_submission(transaction, client))
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/asyncio/runners.py", line 43, in run
    return loop.run_until_complete(main)
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete
    return future.result()
  File "/Users/mhamilton/Development/demos/venv/lib/python3.8/site-packages/xrpl/asyncio/transaction/reliable_submission.py", line 93, in send_reliable_submission
    return await _wait_for_final_transaction_outcome(
  File "/Users/mhamilton/Development/demos/venv/lib/python3.8/site-packages/xrpl/asyncio/transaction/reliable_submission.py", line 37, in _wait_for_final_transaction_outcome
    transaction_response = await get_transaction_from_hash(transaction_hash, client)
  File "/Users/mhamilton/Development/demos/venv/lib/python3.8/site-packages/xrpl/asyncio/transaction/ledger.py", line 50, in get_transaction_from_hash
    raise XRPLRequestFailureException(response.result)
xrpl.asyncio.clients.exceptions.XRPLRequestFailureException: Request failed, txnNotFound: Transaction not found.

@hammertoe I debugged your code and found the submitted transaction's engine_result is temMALFORMED; so it looks like your transaction was malformed. I changed the uri param to be non-empty string and it worked:

"uri": str_to_hex("NFT mint test")

@aditya-stb Therefore, I believe this bug is reproduced when waiting for the final outcome on a submitted malformed transaction. Going to create a PR that verifies a submitted transaction is valid (not malformed) before waiting for its final outcome.

@khancode
Copy link
Collaborator

Closing this issue. Feel free to reopen if you can still reproduce this issue.

@jonathanlei
Copy link
Collaborator

race condition issue checked and solved (4 api calls till raising error) #500

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

Successfully merging a pull request may close this issue.

7 participants