diff --git a/src/miner.cpp b/src/miner.cpp index 9b5ad0392..a4c8c2e14 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -1146,24 +1146,31 @@ void static RandomXMiner() fprintf(stderr,"RandomXMiner: created randomxHash of size %d\n", RANDOMX_HASH_SIZE); // Initial randomx key is chain magic || ac_name which is >= 2^40 bits of entropy assuming strlen(ac_name) >= 1 // For ac_name=DRAGONX we have 4 + 7 = 11 bytes or 2^88 bits of entropy - char randomxKey[4 + strlen(SMART_CHAIN_SYMBOL)]; - fprintf(stderr,"RandomXMiner: creating randomxKey of size %d\n", 4 + strlen(SMART_CHAIN_SYMBOL)); + //int randomxKeySize = sizeof(randomxKey); // 4 + strlen(SMART_CHAIN_SYMBOL)]; + char randomxKey[] = "RANDOMX"; + //fprintf(stderr,"RandomXMiner: creating randomxKey of size %d\n", randomxKeySize); + /* randomxKey[0] = ASSETCHAINS_MAGIC & 0xff; randomxKey[1] = (ASSETCHAINS_MAGIC >> 8) & 0xff; randomxKey[2] = (ASSETCHAINS_MAGIC >> 16) & 0xff; randomxKey[3] = (ASSETCHAINS_MAGIC >> 24) & 0xff; - + for(int i=0; i++; iGetBlockHash(); crypto_generichash_blake2b_state new_state; crypto_generichash_blake2b_update(&state, (unsigned char *)&randomxBlockKey, 32); crypto_generichash_blake2b_final(&state, randomxInput, 32); randomx_init_cache(randomxCache, &randomxBlockKey, sizeof randomxKey); + fprintf(stderr,"RandomXMiner: initialized cache\n"); } randomx_vm *myVM = randomx_create_vm(flags, randomxCache, NULL); @@ -1200,10 +1210,13 @@ void static RandomXMiner() LogPrintf("Cannot create RandomX VM, aborting!\n"); return; } + fprintf(stderr,"RandomXMiner: created VM\n"); randomx_calculate_hash(myVM, &randomxInput, sizeof randomxInput, randomxHash); + fprintf(stderr,"RandomXMiner: calculated randomx hash\n"); randomx_destroy_vm(myVM); + fprintf(stderr,"RandomXMiner: destroyed VM\n"); randomx_release_cache(randomxCache); printf("RandomX Hash: ");