oliverw / miningcore

Miningcore is a high-performance Mining Pool Software for Linux and Windows.
https://store.miningcore.pro
MIT License
730 stars 674 forks source link

Zcash payout error, duplicate payment, waiting for wrong opid #244

Closed Gadflyii closed 6 years ago

Gadflyii commented 6 years ago

I have an interesting issue.

The pool processed payments correctly, and I started seeing:

[ZCash Payout Handler] Waiting for completion: opid-original

Then sadly, while this z_sendmany operation was in the "executing" status, MiningCore was restarted.

During the restart the pool processed payments again, and submitted a new z_sendmany which was a duplicate of the original. At this point the logs stop tracking "opid-original" and start tracking "opid-duplicate"

At this point I could see both of the operations on the daemon, the original in "executing" status, and the new duplicate as "queued".

After about 30 seconds the "opid-orginal" completed, and sent payments to miners, and opid-duplicate was then dropped by the daemon as the wallet no longer had a sufficient balance to process the duplicate z_sendmany operation.

Now the pool is still logging that it is tracking "[ZCash Payout Handler] Waiting for completion: opid-duplicate" and the original payment operation operation, which was successful, is no longer tracked by the payment process. Thus it still shows that miners have a pending balance and the successful payment was not persisted into the payments table.

Any idea how to fix this? Where are pending opid's stored? I could not find them in the database.

Thanks in advance @oliverw

oliverw commented 6 years ago

opids are currently not tracked in the database. This could and probably should be enhanced. One problem with this is that the ZCash daemon will no longer report about opids which completed (success or failure) and where the completion status was queried by RPC at least once (you get the result and then they are gone).

lucas556 commented 6 years ago

This is good issue.

Gadflyii commented 6 years ago

@oliverw @lucas556 I can work on this if you would like, and submit a PR for your review later.

In the mean time, I suppose my options are to manually reduce the balance due to miners by the paid amount in the balance table(?) or to fund the pull wallet and allow it to make a duplicate payment?

oliverw commented 6 years ago

@Gadflyii Get used to hitting the database prompt. You'll need it a lot. Not due to bugs in miningcore (they some of course) but due to stuff like early payout request by miners etc.

Gadflyii commented 6 years ago

Yep... all too familiar. Luckily this DB is really simple and clean. I like it a lot better than the redis found on Nomp.

I pulled a branch to work on a few things that we will merge back in once they are working properly:

One other quick question that might save me a bunch of time, In nomp/znomp there is a field in the transactions.js (node.js) where you can enter a hex string to identify the pool so it shows up on explorers. (think the default is "Someone Running Znomp!").

Does such a field already exist in MiningCore?

Gadflyii commented 6 years ago

Before I open a new issue, we also see this error that results in MiningCore to crash from time to time:

[2018-03-08 18:15:18.7410] [E] [Program] System.AggregateException: One or more errors occurred. (A task was canceled.) ---> System.Threading.Tasks.TaskCanceledException: A task was canceled. --- End of inner exception stack trace --- at System.Threading.Tasks.Task1.GetResultCore(Boolean waitCompletionNotification) at MiningCore.DaemonInterface.DaemonClient.MapDaemonBatchResponse(Int32 i, Task1 x) in C:\miningcore-cp-master\src\MiningCore\DaemonInterface\DaemonClient.cs:line 402 at MiningCore.DaemonInterface.DaemonClient.d14.MoveNext() in C:\miningcore-cp-master\src\MiningCore\DaemonInterface\DaemonClient.cs:line 216 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at MiningCore.Blockchain.Bitcoin.BitcoinJobManager`2.d26.MoveNext() in C:\miningcore-cp-master\src\MiningCore\Blockchain\Bitcoin\BitcoinJobManager.cs:line 241 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at MiningCore.Blockchain.Bitcoin.BitcoinJobManager2.<RunUpdates>d__60.MoveNext() in C:\miningcore-cp-master\src\MiningCore\Blockchain\Bitcoin\BitcoinJobManager.cs:line 795 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at MiningCore.Blockchain.JobManagerBase1.d__18.MoveNext() in C:\miningcore-cp-master\src\MiningCore\Blockchain\JobManagerBase.cs:line 86 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ThreadPoolWorkQueue.Dispatch() ---> (Inner Exception #0) System.Threading.Tasks.TaskCanceledException: A task was canceled.<---

Any idea on this one?

oliverw commented 6 years ago

Not really, unfortunately.

oliverw commented 6 years ago

Closing due to inactivity.