Skip to content
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

fixed function hex_to_int does not exists, add schema to wizstats tables, and many other fixes. #64

Open
wants to merge 28 commits into
base: master
Choose a base branch
from

Conversation

encorehu
Copy link

@encorehu encorehu commented Apr 7, 2014

select users.id as user_id from users table, i didnt know how to select user_id form shares, @wizkid057 didnot give us the shares table schema, if add user_id field to shares table, the eloipool pool server will not fill this field, so i use this method to fix user_id is null or empty.

encorehu added 19 commits April 4, 2014 16:49
…shares and get user_id from users table again, wtf!
…ct user_id form shares, @wizkid057 didnot give us the shares table schema, if add user_id field to shares table, the eloipool pool server will not fill this field, so i use this method to fix user_id is null or empty.
…_query" does not exist LINE 1: ...ect count(*) as check from pg_stat_activity where current_qu... ^ in instant_livedata.php on line 127

$link = pg_Connect("dbname=$psqldb user=$psqluser password='$psqlpass' host=$psqlhost", PGSQL_CONNECT_FORCE_NEW );
$link2 = pg_Connect("dbname=$psqldb user=$psqluser password='$psqlpass' host=$psqlhost", PGSQL_CONNECT_FORCE_NEW );

### OPTIMIZE THIS TO KNOW WHEN THE LAST BLOCK WAS?!
$sql = "INSERT INTO $psqlschema.stats_blocks (server, orig_id, time, user_id, solution, network_difficulty) select server, id, time, user_id, solution, (pow(10,((29-hex_to_int(substr(encode(solution,'hex'),145,2)))::double precision*2.4082399653118495617099111577959::double precision)+log( (65535::double precision / hex_to_int(substr(encode(solution,'hex'),147,6)))::double precision )::double precision))::double precision as network_difficulty from shares where upstream_result=true and solution NOT IN (select solution from $psqlschema.stats_blocks);";
$sql = "INSERT INTO $psqlschema.stats_blocks (server, orig_id, time, user_id, solution, network_difficulty) select shares.server, shares.id, shares.time, users.id as user_id, shares.solution, (pow(10,((29-$psqlschema.hex_to_int(substr(encode(shares.solution,'hex'),145,2)))::double precision*2.4082399653118495617099111577959::double precision)+log( (65535::double precision / $psqlschema.hex_to_int(substr(encode(shares.solution,'hex'),147,6)))::double precision )::double precision))::double precision as network_difficulty from shares left join users on shares.username= users.username where upstream_result=true and solution NOT IN (select solution from $psqlschema.stats_blocks);";
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

user_id is a sequence number for users.id in the users table. there is no shares.username.

should be:
left join users on users.id = shares.user_id

IIRC... from the old wiki: http://eligius.st/wiki/index.php/PostgreSQL_Schema

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

emm....I looked through all eloipool's code, the shares table has username field. at the shareslogging config settings. if there is no username field in shares table, how does eloipool know to adding user_id into shares table? eloipool only doing the logging things, it just know only the minner's bitcoin address as username.

thank you for give me the wiki page, but it is generated on 2011, maybe things are changed, but eloipool's code still remained.

encorehu added 7 commits April 8, 2014 14:22
… select id,(pow(10,((29-hex_to_int(substr(encode(solution,'he... ^ HINT: No function matches the given name and argument types. You might need to add explicit type casts. in userstats.php on line 570
… to stats_sharesagg.time(time without time zone)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants