Skip to content

Commit

Permalink
use length rather than static 4 for hex2bin func of extranonce2_generate
Browse files Browse the repository at this point in the history
  • Loading branch information
adammwest committed Jan 16, 2025
1 parent f1c0128 commit 833d2af
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion components/stratum/mining.c
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ char *extranonce_2_generate(uint32_t extranonce_2, uint32_t length)
char *extranonce_2_str = malloc(length * 2 + 1);
memset(extranonce_2_str, '0', length * 2);
extranonce_2_str[length * 2] = '\0';
bin2hex((uint8_t *)&extranonce_2, sizeof(extranonce_2), extranonce_2_str, length * 2 + 1);
bin2hex((uint8_t *)&extranonce_2, length, extranonce_2_str, length * 2 + 1);
if (length > 4)
{
extranonce_2_str[8] = '0';
Expand Down

0 comments on commit 833d2af

Please sign in to comment.