From dcaf083ccf880deed0a9866d51c90bd77f867a05 Mon Sep 17 00:00:00 2001 From: Tanguy Pruvot Date: Sun, 23 Apr 2017 16:12:40 +0200 Subject: [PATCH] decred: handle new block header stake version in coinb2 --- stratum/client_submit.cpp | 5 +++-- stratum/coind_template.cpp | 6 ++++-- stratum/config.sample/decred.conf | 4 ++-- web/yaamp/core/functions/yaamp.php | 2 +- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/stratum/client_submit.cpp b/stratum/client_submit.cpp index af631ed..224a062 100644 --- a/stratum/client_submit.cpp +++ b/stratum/client_submit.cpp @@ -74,13 +74,14 @@ static void create_decred_header(YAAMP_JOB_TEMPLATE *templ, YAAMP_JOB_VALUES *ou uint32_t size; uint32_t ntime; uint32_t nonce; - unsigned char extra[36]; + unsigned char extra[32]; + uint32_t stakever; uint32_t hashtag[3]; } header; memcpy(&header, templ->header, sizeof(header)); - memset(header.extra, 0, 36); + memset(header.extra, 0, 32); sscanf(nonce, "%08x", &header.nonce); if (strcmp(vote, "")) { diff --git a/stratum/coind_template.cpp b/stratum/coind_template.cpp index ec2139c..fea6d7f 100644 --- a/stratum/coind_template.cpp +++ b/stratum/coind_template.cpp @@ -114,7 +114,8 @@ static int decred_parse_header(YAAMP_JOB_TEMPLATE *templ, const char *header_hex uint32_t size; uint32_t ntime; uint32_t nonce; - unsigned char extra[36]; + unsigned char extra[32]; + uint32_t stakever; uint32_t hashtag[3]; } header; @@ -195,7 +196,8 @@ retry: // bypass coinbase and merkle for now... send without nonce/extradata const unsigned char *hdr = (unsigned char *) &templ->header[36]; hexlify(templ->coinb1, hdr, 192 - 80); - strcpy(templ->coinb2, ""); + const unsigned char *sfx = (unsigned char *) &templ->header[176]; + hexlify(templ->coinb2, sfx, 180 - 176); // stake version vector txhashes; txhashes.push_back(""); diff --git a/stratum/config.sample/decred.conf b/stratum/config.sample/decred.conf index 96c34f6..f397789 100644 --- a/stratum/config.sample/decred.conf +++ b/stratum/config.sample/decred.conf @@ -1,6 +1,6 @@ [TCP] server = yaamp.com -port = 5744 +port = 3252 password = tu8tu5 [SQL] @@ -11,6 +11,6 @@ password = patofpaq [STRATUM] algo = decred -difficulty = 0.5 +difficulty = 1 max_ttf = 1000000000 diff --git a/web/yaamp/core/functions/yaamp.php b/web/yaamp/core/functions/yaamp.php index b11cdf9..d4dd69f 100755 --- a/web/yaamp/core/functions/yaamp.php +++ b/web/yaamp/core/functions/yaamp.php @@ -205,7 +205,7 @@ function getAlgoPort($algo) // 5555 to 5683 reserved 'blake' => 5733, 'blakecoin' => 5743, - 'decred' => 5744, + 'decred' => 3252, 'vanilla' => 5755, 'blake2s' => 5766, 'penta' => 5833,