henrytirla / Decentralized-Exchange-Trading-Scripts

Useful scripts to automate trading on different DEX
https://t.me/dexpnl_bot
MIT License
377 stars 155 forks source link

solana.rpc.core.RPCException: SendTransactionPreflightFailureMessage #12

Closed dekacypher closed 5 months ago

dekacypher commented 6 months ago

I get this error when trying to running Solana/Trade/sell_swap.py. How to fix this?

`Traceback (most recent call last):
  File "/Users/anon/Desktop/LOB-bot/Solana/solana_script.py", line 106, in sell
    txn = solana_client.send_transaction(swap_tx, *signers)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Caskroom/miniforge/base/envs/freqtrade/lib/python3.11/site-packages/solana/rpc/api.py", line 1059, in send_transaction
    txn_resp = self.send_raw_transaction(txn.serialize(), opts=opts_to_use)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Caskroom/miniforge/base/envs/freqtrade/lib/python3.11/site-packages/solana/rpc/api.py", line 993, in send_raw_transaction
    resp = self._provider.make_request(body, SendTransactionResp)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Caskroom/miniforge/base/envs/freqtrade/lib/python3.11/site-packages/solana/exceptions.py", line 43, in argument_decorator
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Caskroom/miniforge/base/envs/freqtrade/lib/python3.11/site-packages/solana/rpc/providers/http.py", line 49, in make_request
    return _parse_raw(raw, parser=parser)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Caskroom/miniforge/base/envs/freqtrade/lib/python3.11/site-packages/solana/rpc/providers/core.py", line 97, in _parse_raw
    raise RPCException(parsed)
solana.rpc.core.RPCException: SendTransactionPreflightFailureMessage { message: "Transaction simulation failed: Blockhash not found", data: RpcSimulateTransactionResult(RpcSimulateTransactionResult { err: Some(BlockhashNotFound), logs: Some([]), accounts: None, units_consumed: Some(0), return_data: None, inner_instructions: None }) }

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/anon/Desktop/LOB-bot/Solana/solana_script.py", line 162, in <module>
    sell(solana_client,token_toSell,payer, amount_to_sell)
  File "/Users/anon/Desktop/LOB-bot/Solana/solana_script.py", line 145, in sell
    time.sleep(60)
KeyboardInterrupt`

Versions: solana 0.34.0 solders 0.21.0 python 3.11.7

henrytirla commented 6 months ago

Refer to my other repo on buying and selling