Add support for default stratum split#137
Conversation
Add support for default stratum split
luke-jr
left a comment
There was a problem hiding this comment.
Seems like it would be better to just pass modname_len as 0?
|
Also, this means the username mod stuff is always enabled... Probably should have a bool on |
Doesn't |
|
Ok, now I got it. I made the changes to skip the new logic if there is no default mod in the configuration. |
I've now modified the existing code to remove the caution above and pass a len of 0. |
|
Can somebody move this forward? |
| const char *modname, *addr; | ||
| json_t *moddefn, *proportion_j; | ||
| bool at_least_one_mod = false; | ||
| datum_config.stratum_default_mod_present = false; |
There was a problem hiding this comment.
This function shouldn't have side effects / be accessing globals.
| const char * const tilde = &modname[-1]; | ||
| const char * const tilde = strchr(username_s, '~'); |
There was a problem hiding this comment.
Rather not do this strchr twice... Kinda ugly, but maybe just pass modname=&username_s[json_string_length(username) + 1] in client_mining_submit? (Since length is zero, it should be safe?)
| const size_t modname_len = json_string_length(username) - (modname - username_s); | ||
| if (tilde || datum_config.stratum_default_mod_present) { | ||
| const char * const modname = tilde? &tilde[1]: ""; | ||
| const size_t modname_len = strlen(modname); |
There was a problem hiding this comment.
strlen should be unnecessary
The intention of this PR is to add support for a default stratum split. If no tilde is present in the stratum username,
one is automatically added at the end of the usernameit behaves as with a blank modname. If a blank modname exists in the configuration, it will then serve as the default stratum split.