I reply to all queries on the forums and via email, once per day, Monday to Friday (not weekends).

If you are new here, please see some information on how to ask for support. Thank you!

Reply To: Coin Transaction Failed but ..

dashed-slug.net Forums TurtleCoin Adapter extension support Coin Transaction Failed but .. Reply To: Coin Transaction Failed but ..



Thank you for your detailed response.

The error code I asked for is 28 (curl timeout). This is the root cause of this issue, and also of the problems you report in this other thread. Here’s what happened:

Currently the scalability of all the blockchains is being stress-tested due to the current market conditions. First Bitcoin, then Ethereum, and now it seems many cryptonote chains are also being affected. This is reflected mostly in network congestion and high fees.

Recently someone had the same problem with Monero. The command that issues a transaction takes longer than 30 seconds to complete. Therefore, the curl call from the plugin to the wallet never gets back the TXID.

I am guessing that this is due to network congestion. Another possibility is that, cryptonote transactions wait for more transactions to occur on the network, to do coinjoins and ensure anonymity. If there are too few transactions on the network, this may also be a reason why transaction execution is slow. The NimbusCoin developers should know more about this.

Normally the plugin expects this situation:
– A withdrawal is first marked as succeeded (done) on the DB.
– Then the transaction is attempted on the wallet
– Finally the plugin receives the result of the transaction. If successful, the TXID is updated on the DB. If the wallet responds with an error, the withdrawal is marked as failed.

This is so as to ensure that, if the PHP thread running the withdrawals cron somehow crashes, the withdrawal is not re-attempted.

However in this case, the adapter responds with an Exception, due to an HTTP timeout coming from curl. The plugin thinks that the wallet did not execute the transaction, and reattempts it. The wallet continues to reattempt the transaction, and this is how a double spend occurs.

Several things need to be done here:

– Since the wallet takes so long to place the transaction, you should increase the HTTP timeout beyond 30 seconds in the coin adapter settings. Go to Wallets -> Adapters -> (Your adapter) -> Settings -> HTTP adapter settings -> HTTP request timeout (seconds).
– You should also increase the PHP execution timeout accordingly. How long the wallet needs to perform a transaction is beyond my control.
– It’s a good idea to set the withdrawal attempts to 1 as extra safety. See Wallets -> Cron job -> Max retries for failed withdrawals.

I will soon release a patch that will mitigate this risk. I am still evaluating the correct course of action, but basically, if there is a timeout, the plugin should assume that the transaction is succeeded, not failed. Better to err on the safe side! Then, in case of a timeout, the user balance will be updated correctly. The only problem will then be that the TXID will not be recorded in the DB, but this can be fixed.

In any case, since the wallet takes longer than 30 seconds to place a transaction and respond with a TXID, you should let withdrawals run for 60 seconds, or however long it takes.

I will contact you again here on this thread once I release the aforementioned patch.

with regards