Browse Source

Merge pull request #59 from notgiven688/bigblocks

added support for blocks with more than 256 transactions
pull/123/head
notgiven688 3 years ago
committed by GitHub
parent
commit
601e84f121
5 changed files with 16 additions and 13 deletions
  1. +1
    -1
      SDK/miner_compressed/webmr.js
  2. +1
    -1
      SDK/miner_raw/miner/cn.js
  3. +6
    -6
      hash_cn/webassembly/cryptonight.c
  4. +7
    -4
      hash_cn/webassembly/main.c
  5. +1
    -1
      server/Server/PoolConnection.cs

+ 1
- 1
SDK/miner_compressed/webmr.js
File diff suppressed because it is too large
View File


+ 1
- 1
SDK/miner_raw/miner/cn.js
File diff suppressed because it is too large
View File


+ 6
- 6
hash_cn/webassembly/cryptonight.c View File

@ -372,12 +372,12 @@ void SubAndShiftAndMixAddRoundInPlace(uint32_t *temp, uint32_t *AesEncKey)
temp[3] = TestTable2[saved[3]] ^ TestTable3[saved[4]] ^ TestTable4[saved[5]] ^ TestTable1[state[12]] ^ AesEncKey[3];
}
void cryptonight_hash_ctx(void *output, const void *input, struct cryptonight_ctx *ctx, int variant)
void cryptonight_hash_ctx(void *output, const void *input, size_t len, struct cryptonight_ctx *ctx, int variant)
{
ctx->aes_ctx = (oaes_ctx *)oaes_alloc();
size_t i, j;
//hash_process(&ctx->state.hs, (const uint8_t*) input, 76);
keccak((const uint8_t *)input, 76, ctx->state.hs.b, 200);
keccak((const uint8_t *)input, len, ctx->state.hs.b, 200);
memcpy(ctx->text, ctx->state.init, INIT_SIZE_BYTE);
//int variant = ((const uint8_t *)input)[0] >= 7 ? ((const uint8_t *)input)[0] - 6 : 0;
@ -491,12 +491,12 @@ void cryptonight_hash_ctx(void *output, const void *input, struct cryptonight_ct
oaes_free((OAES_CTX **)&ctx->aes_ctx);
}
void cryptonight_hash_ctx_lite(void *output, const void *input, struct cryptonight_ctx_lite *ctx, int variant)
void cryptonight_hash_ctx_lite(void *output, const void *input, size_t len, struct cryptonight_ctx_lite *ctx, int variant)
{
ctx->aes_ctx = (oaes_ctx *)oaes_alloc();
size_t i, j;
//hash_process(&ctx->state.hs, (const uint8_t*) input, 76);
keccak((const uint8_t *)input, 76, ctx->state.hs.b, 200);
keccak((const uint8_t *)input, len, ctx->state.hs.b, 200);
memcpy(ctx->text, ctx->state.init, INIT_SIZE_BYTE);
VARIANT1_INIT();
@ -612,13 +612,13 @@ void cryptonight(void *output, const void *input, size_t len, int lite, int vari
if(lite)
{
struct cryptonight_ctx_lite *ctx = (struct cryptonight_ctx_lite *)malloc(sizeof(struct cryptonight_ctx_lite));
cryptonight_hash_ctx_lite(output, input, ctx, variant);
cryptonight_hash_ctx_lite(output, input, len, ctx, variant);
free(ctx);
}
else
{
struct cryptonight_ctx *ctx = (struct cryptonight_ctx *)malloc(sizeof(struct cryptonight_ctx));
cryptonight_hash_ctx(output, input, ctx, variant);
cryptonight_hash_ctx(output, input, len, ctx, variant);
free(ctx);
}

+ 7
- 4
hash_cn/webassembly/main.c View File

@ -25,21 +25,24 @@ char* tohex(unsigned char * in)
char* hash_cn(char* hex, char* nonce,int lite, int variant)
{
unsigned char inp[76];
int len = strlen(hex) / 2;
unsigned char inp[len];
char *pos = hex;
for( size_t i = 0; i < 76; i++) { sscanf(pos, "%2hhx", &inp[i]); pos += 2; }
for( size_t i = 0; i < len; i++) { sscanf(pos, "%2hhx", &inp[i]); pos += 2; }
pos = nonce;
for(size_t i = 39; i < 43; i++) { sscanf(pos, "%2hhx", &inp[i]); pos += 2; }
unsigned char hash[76];
unsigned char hash[32];
if(variant == -1)
variant = ((const uint8_t *)inp)[0] >= 7 ? ((const uint8_t *)inp)[0] - 6 : 0;
cryptonight(hash, inp, 76, lite, variant);
cryptonight(hash, inp, len, lite, variant);
return tohex(hash);
}

+ 1
- 1
server/Server/PoolConnection.cs View File

@ -100,7 +100,7 @@ namespace Server {
string blob = data["blob"].GetString ();
string target = data["target"].GetString ();
if (blob.Length != 152) return false;
if (blob.Length < 152 || blob.Length > 180) return false;
if (target.Length != 8) return false;
if (!Regex.IsMatch (blob, MainClass.RegexIsHex)) return false;

Loading…
Cancel
Save