Skip to content

Commit

Permalink
Fix for wallet error in v0.1.9.8
Browse files Browse the repository at this point in the history
  • Loading branch information
who-biz committed Jul 12, 2019
1 parent 5d8bf22 commit d5cabf9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
11 changes: 5 additions & 6 deletions src/crypto/slow-hash.c
Original file line number Diff line number Diff line change
Expand Up @@ -772,7 +772,7 @@ void cn_slow_hash(const void *data, size_t length, char *hash, int variant, int
// the useAes test is only performed once, not every iteration.
if(useAes)
{
for(i = 0; i < iters; i++)
for(i = 0; i < (iters >> 1); i++)
{
pre_aes();
_c = _mm_aesenc_si128(_c, _a);
Expand All @@ -781,7 +781,7 @@ void cn_slow_hash(const void *data, size_t length, char *hash, int variant, int
}
else
{
for(i = 0; i < iters; i++)
for(i = 0; i < (iters >> 1); i++)
{
pre_aes();
aesb_single_round((uint8_t *) &_c, (uint8_t *) &_c, (uint8_t *) &_a);
Expand Down Expand Up @@ -1124,8 +1124,7 @@ void cn_slow_hash(const void *data, size_t length, char *hash, int variant, int
_b = vld1q_u8((const uint8_t *)b);
_b1 = vld1q_u8(((const uint8_t *)b) + AES_BLOCK_SIZE);


for(i = 0; i < iters; i++)
for(i = 0; i < (iters >> 1); i++)
{
pre_aes();
_c = vaeseq_u8(_c, zero);
Expand Down Expand Up @@ -1332,7 +1331,7 @@ void cn_slow_hash(const void *data, size_t length, char *hash, int variant, int
U64(b)[0] = U64(&state.k[16])[0] ^ U64(&state.k[48])[0];
U64(b)[1] = U64(&state.k[16])[1] ^ U64(&state.k[48])[1];

for(i = 0; i < iters; i++)
for(i = 0; i < (iters >> 1); i++)
{
#define MASK ((uint32_t)(((MEMORY / AES_BLOCK_SIZE) - 1) << 4))
#define state_index(x) ((*(uint32_t *) x) & MASK)
Expand Down Expand Up @@ -1519,7 +1518,7 @@ void cn_slow_hash(const void *data, size_t length, char *hash, int variant, int
b[i] = state.k[AES_BLOCK_SIZE + i] ^ state.k[AES_BLOCK_SIZE * 3 + i];
}

for(i = 0; i < iters; i++) {
for (i = 0; i < (iters >> 1); i++) {
/* Dependency chain: address -> read value ------+
* written value <-+ hard function (AES or MUL) <+
* next address <-+
Expand Down
5 changes: 1 addition & 4 deletions src/cryptonote_basic/cryptonote_format_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -925,17 +925,16 @@ namespace cryptonote
if (b.major_version <= 7)
{
cn_iters += ((height + 1) & 0x3FF);
cn_iters <<= 1;
}
else if (b.major_version == 8)
{
cn_iters += ((height + 1) & 0x3FF);
cn_iters >>= 1;
}
else if (b.major_version == 9)
{
const uint64_t stamp = b.timestamp;
cn_iters += (((stamp % height) + (height + 1)) & 0xFFF);
cn_iters >>= 1;
}
else if (b.major_version >= 10)
{
Expand All @@ -958,8 +957,6 @@ namespace cryptonote
else if (!two) {
cn_iters += (((stamp % id_num) + height) & 0x7FFF); }

cn_iters >>= 1;

LOG_PRINT_L2("\nIterations : "<< cn_iters);

}
Expand Down

0 comments on commit d5cabf9

Please sign in to comment.