-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Add MPOS SSO DB Compatibility #612
base: master
Are you sure you want to change the base?
Conversation
@HashUnlimited @zone117x merge? |
There’s a problem with MPOS always taking the diff from pool_workers and using it for hashrate calculations. Seb is out of the game already so we need to take care. |
This PR just sticks with the current behaviour in regards to the diff. Lets work through it step by step. This would fix the SSO Support. and then we can fix MPOS's hashrate calcs in another PR |
So what issue do you see in SSO? Maybe I don’t get it Edit: for my understanding you would update the shared db on worker diff change. That’d be good for single pools on pushpoold but on setups like ours just letting MPOS handle the frontend it would basically result in altered dashboard values? |
MPOS Supports SSO for accounts and workers correct? So the problem lies here: MPOS set to SSO on workers will add all the workers to the SSO db but expect shares in the normal DB. So NOMP will either submit shares to the wrong db or look for workers in the wrong db. Another one is accounts. If NOMP is set to auto create workers it'll look in the db specified in the config which wont be the SSO db for the reasons specified above. So it'll think the user doesnt exist and wont create the account. |
@@ -5,14 +5,22 @@ module.exports = function(logger, poolConfig){ | |||
var mposConfig = poolConfig.mposMode; | |||
var coin = poolConfig.coin.name; | |||
|
|||
var connection = mysql.createPool({ | |||
var mainDBConnection = mysql.createPool({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Per Coin DB Connection details to be specified in config to be used here
port: mposConfig.port, | ||
user: mposConfig.user, | ||
password: mposConfig.password, | ||
database: mposConfig.shared_database |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shared SSO DB to be specified here
@@ -26,7 +34,7 @@ module.exports = function(logger, poolConfig){ | |||
return; | |||
} | |||
|
|||
connection.query( | |||
sharedDBConnection.query( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Look for Workers in SSO DB rather than per coin db
@@ -89,7 +97,7 @@ module.exports = function(logger, poolConfig){ | |||
typeof(shareData.error) === 'undefined' ? null : shareData.error, | |||
shareData.blockHash ? shareData.blockHash : (shareData.blockHashInvalid ? shareData.blockHashInvalid : '') | |||
]; | |||
connection.query( | |||
mainDBConnection.query( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Insert Shares into Coin DB
@@ -103,14 +111,14 @@ module.exports = function(logger, poolConfig){ | |||
|
|||
this.handleDifficultyUpdate = function(workerName, diff){ | |||
|
|||
connection.query( | |||
'UPDATE `pool_worker` SET `difficulty` = ' + diff + ' WHERE `username` = ' + connection.escape(workerName), | |||
sharedDBConnection.query( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update difficulty in Share DB not worker DB.
(This is what we need to get rid of soon but until we come up with a way to handle the issues caused by this, let's not remove it yet)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now here's the issue I was referring to. For payouts, MPOS is using the share DB but for stats it's looking into the worker DB
Check the Comments on the commit. I've described the changes there |
Exactly. So for SSO to function correctly, the way is to set up the MPOS config for shared but leave out the workers table. That’s tbd by user. Was playing with the topic just yesterday, Seb isn’t totally aware. Going to update the wiki and a PR removing the workers example. Clean up and remove the code as well. |
It also means disabling the autoCreateWorkers option of NOMP |
So what is the approach? I still don’t get it. Do you simply want workers getting copied across the pools? |
I guess we both are just thinking from different sides, you might want to find a solution so MPOS is handling the worker updates when configured as SSO and I am thinking from the MPOS side |
Okay lets step through it. What's the issue with MPOS? |
I am not 100% sure about the dashboard but the admin panel and statistics are checking the worker table for update.
Is there on the other side any useful aspect in sharing workers nowadays? |
The idea behind it when it was developed was that someone could use the same worker on various different pools. a common concept was that people used the .1 worker on every pool they were using. One of the other main reasons for this is "multipools" many of which are based on MPOS. The only exceptions i know of are YIIMP based ones which seem extremely popular. and Multipool.us and IPOMiner which are based on an ancient software called simplecoin which they updated themselves. The way they work is having the central db contain the workers and then just working round robin between the stratum instances based on the profitability. Updating a worker on one pool shouldn't disconnect a worker on any other pool. |
Sorry, I have been busy recently.... how about we create a dev_dev branch and check the things through? |
sure thats fine by me |
After long long time working on main net, we finally found some time to test this on a test pool :-) |
Doesn't this need some checks for the new mposMode configuration property so existing setups aren't broken? |
Existing installations would need to add the [edit:] We might also keep in mind, that MPOS allows the configuration of the shared DB per table, it would probably be a good idea to go with that flexibility as well so it's up to the user if he wants to work with shared accounts only or workers as well. |
I'll try and find some time to get this done |
It doesn't work :( |
No description provided.