From 85fb80493d4b898a9cd46b3db5e78beddf9a1275 Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Wed, 10 Jan 2018 18:14:26 +1100 Subject: [PATCH] Simplify endian correction of version_mask. --- src/stratifier.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/stratifier.c b/src/stratifier.c index d1ba67e0..e579ea26 100644 --- a/src/stratifier.c +++ b/src/stratifier.c @@ -1862,7 +1862,7 @@ static void add_node_base(ckpool_t *ckp, json_t *val, bool trusted, int64_t clie /* Calculate share diff and fill in hash and swap. Need to hold workbase read count */ static double share_diff(char *coinbase, const uchar *enonce1bin, const workbase_t *wb, const char *nonce2, - const uint32_t ntime32, const uint32_t version_mask, const char *nonce, + const uint32_t ntime32, uint32_t version_mask, const char *nonce, uchar *hash, uchar *swap, int *cblen) { unsigned char merkle_root[32], merkle_sha[64]; @@ -1897,13 +1897,9 @@ share_diff(char *coinbase, const uchar *enonce1bin, const workbase_t *wb, const /* Update nVersion when version_mask is in use */ if (version_mask) { - uint32_t version; - + version_mask = htobe32(version_mask); data32 = (uint32_t *)data; - version = be32toh(*data32); - version |= version_mask; - LOGDEBUG("Vmask %u version changed to %08x", version_mask, version); - *data32 = htobe32(version); + *data32 |= version_mask; } /* Insert the nonce value into the data */