dashed-slug.net › Forums › General discussion › Pending transactions causing wallet to keep sending money out in 6.0.0 RC
Tagged: double spend, negative balance, withdrawal
- This topic has 5 replies, 2 voices, and was last updated 1 year, 10 months ago by
alexg.
-
AuthorPosts
-
October 20, 2022 at 12:49 pm #12220
Anonymous
InactiveA pending transactions causing wallet keep sending money out
also can I disable negative balance?
October 21, 2022 at 7:30 am #12227alexg
KeymasterOh no, this sounds rather serious. I’m sorry about that. I hope you only lost Litecoin testnet coins or a small amount of funds.
Normally the plugin has protections against this kind of thing.
Did you manage to gather logs? To do this, please enable logging in: Settings → Bitcoin and Altcoin Wallets → Cron tasks → Verbose logging. When a withdrawal next occurs, this is the log output that will tell us what happened.
I have a theory for why this happened, but I’m not sure without looking at logs: The plugin first checks for sufficient balance, then proceeds to withdraw. If you got a negative balance out of this, then that means multiple cron tasks ran concurrently. Normally the plugin guards against this with semaphores: https://github.com/dashed-slug/wallets/blob/6.0.0-RC4/cron/abstract-task.php#L204-L220
However the semaphores are implemented as transients. Depending on your cache settings, transients may be unreliable, and I may need to change them to options.
Can you please tell me the following:
1. Did the negative balance occur on the user who owns the withdrawal and for the currency of the withdrawal? Or is this an unrelated incident?
2. Do you have verbose logs from a withdrawal run (while there are still funds to withdraw)?
3. What server-side caching plugin do you use?
You can “fix” the negative balance for the user if you create a new “deposit” or “move” transaction for that user (Transactions → New). The transaction needs to be created in two steps. First create and save the transaction with the desired user and currency, then set the amount to add to the user’s balance, and save again. However this will not return the funds to your site, it will only amend the user’s balance.
Remember, this is an RC version and issues are to be expected. It’s not yet suitable for production. Thank you for reporting this.
P.S. I have moved your post in a new thread since it is unrelated to your previous query.
October 22, 2022 at 2:51 am #12247Anonymous
Inactive[22-Oct-2022 02:48:41 UTC] [1666406921] Bitcoin and Altcoin Wallets: DSWallets\Withdrawals_Task: Task started.
[22-Oct-2022 02:48:41 UTC] [1666406921] Bitcoin and Altcoin Wallets: DSWallets\Withdrawals_Task: Starting withdrawals for currency 25335 (Napocoin)
[22-Oct-2022 02:48:41 UTC] [1666406921] Bitcoin and Altcoin Wallets: DSWallets\Withdrawals_Task: 1 candidate withdrawals for currency 25335 (Napocoin) are being double-checked
[22-Oct-2022 02:48:41 UTC] [1666406921] Bitcoin and Altcoin Wallets: DSWallets\Withdrawals_Task: User 2 starts off with a balance of 262484982900 NAP.
[22-Oct-2022 02:48:41 UTC] [1666406921] Bitcoin and Altcoin Wallets: DSWallets\Withdrawals_Task: User 2 wants to withdraw -100000000000 NAP, plus -20000000000 NAP as fee. Balance remaining for user will be 142484982900
[22-Oct-2022 02:48:41 UTC] [1666406921] Bitcoin and Altcoin Wallets: DSWallets\Withdrawals_Task: Deleting withdrawal counters for user 2 from
[22-Oct-2022 02:48:41 UTC] [1666406921] Bitcoin and Altcoin Wallets: DSWallets\Withdrawals_Task: 1 candidate withdrawals for currency 25335 (Napocoin) have been cleared for execution
[22-Oct-2022 02:48:41 UTC] [1666406921] Bitcoin and Altcoin Wallets: DSWallets\Withdrawals_Task: Batch of 1 withdrawals of currency Napocoin failed due to: DSWallets\Bitcoin_Core_Like_Wallet_Adapter: JSON-RPC command walletlock failed with: Returned HTTP status code 500: Error: running with an unencrypted wallet, but walletlock was called.October 22, 2022 at 2:52 am #12248Anonymous
Inactive[22-Oct-2022 02:49:31 UTC] [1666406971] Bitcoin and Altcoin Wallets: DSWallets\Withdrawals_Task: Task started.
[22-Oct-2022 02:49:31 UTC] [1666406971] Bitcoin and Altcoin Wallets: DSWallets\Withdrawals_Task: Starting withdrawals for currency 25335 (Napocoin)
[22-Oct-2022 02:49:31 UTC] [1666406971] Bitcoin and Altcoin Wallets: DSWallets\Withdrawals_Task: 1 candidate withdrawals for currency 25335 (Napocoin) are being double-checked
[22-Oct-2022 02:49:31 UTC] [1666406971] Bitcoin and Altcoin Wallets: DSWallets\Withdrawals_Task: User 2 starts off with a balance of 262484982900 NAP.
[22-Oct-2022 02:49:31 UTC] [1666406971] Bitcoin and Altcoin Wallets: DSWallets\Withdrawals_Task: User 2 wants to withdraw -100000000000 NAP, plus -20000000000 NAP as fee. Balance remaining for user will be 142484982900
[22-Oct-2022 02:49:31 UTC] [1666406971] Bitcoin and Altcoin Wallets: DSWallets\Withdrawals_Task: Deleting withdrawal counters for user 2 from
[22-Oct-2022 02:49:31 UTC] [1666406971] Bitcoin and Altcoin Wallets: DSWallets\Withdrawals_Task: 1 candidate withdrawals for currency 25335 (Napocoin) have been cleared for execution
[22-Oct-2022 02:49:32 UTC] [1666406972] Bitcoin and Altcoin Wallets: DSWallets\Withdrawals_Task: Batch of 1 withdrawals of currency Napocoin failed due to: DSWallets\Bitcoin_Core_Like_Wallet_Adapter: JSON-RPC command walletlock failed with: Returned HTTP status code 500: Error: running with an unencrypted wallet, but walletlock was called.October 22, 2022 at 2:57 am #12249Anonymous
Inactivethe negative balance occur when user exchanging currency, not withdrawing, the plugin just keep starting money out. i am using LiteSpeed Cache
October 24, 2022 at 7:39 am #12252alexg
KeymasterHello,
Thank you for the logs. The issue is unrelated to your cache.
The plugin is trying to lock the wallet after the withdrawals. But it is not encrypted, and for that reason the plugin is failing to lock the wallet. It then assumes that the withdrawal failed. I will patch this for the next release. Thank you for reporting this issue.
It is not recommended to use an unencrypted wallet. It’s better to encrypt your wallet and give the passphrase to the plugin. This way, if the wallet file is stolen from your server, it cannot be opened, unless the attacker has also obtained the passphrase from the WordPress DB. If you set a passphrase this issue will not occur.
You can use the “encryptwallet” CLI command to encrypt your wallet with a passphrase. Then, enter this passphrase in the wallet adapter.
Regarding the negative balance arising from using the exchange: I will need a lot more information than that. Please open a new thread in the Exchange forum, or email me with more details.
Was this a test you did? What trades did you perform? What do the user transactions look like, user trades, order history, etc.
Thank you.
with regards
-
AuthorPosts
- You must be logged in to reply to this topic.