Use randomxInput = blake2b(randomXkey || ac_name)
This commit is contained in:
@@ -1134,7 +1134,7 @@ void static RandomXMiner()
|
|||||||
hashTarget = HASHTarget;
|
hashTarget = HASHTarget;
|
||||||
|
|
||||||
char randomxHash[RANDOMX_HASH_SIZE];
|
char randomxHash[RANDOMX_HASH_SIZE];
|
||||||
// TODO: decide on real RandomX key and input
|
// Initial randomx key is chain magic + first letter of chain name which is 2^40 bits of entropy
|
||||||
char randomxKey[5];
|
char randomxKey[5];
|
||||||
randomxKey[0] = ASSETCHAINS_MAGIC & 0xff;
|
randomxKey[0] = ASSETCHAINS_MAGIC & 0xff;
|
||||||
randomxKey[1] = (ASSETCHAINS_MAGIC >> 8) & 0xff;
|
randomxKey[1] = (ASSETCHAINS_MAGIC >> 8) & 0xff;
|
||||||
@@ -1142,19 +1142,18 @@ void static RandomXMiner()
|
|||||||
randomxKey[3] = (ASSETCHAINS_MAGIC >> 24) & 0xff;
|
randomxKey[3] = (ASSETCHAINS_MAGIC >> 24) & 0xff;
|
||||||
randomxKey[4] = SMART_CHAIN_SYMBOL[0];
|
randomxKey[4] = SMART_CHAIN_SYMBOL[0];
|
||||||
|
|
||||||
// crypto_generichash_blake2b_state state;
|
crypto_generichash_blake2b_state state;
|
||||||
// CDataStream ss(SER_NETWORK, PROTOCOL_VERSION);
|
// Hash = blake2b( key || ac_name)
|
||||||
// ss << randomxKey;
|
crypto_generichash_blake2b_update(&state, (unsigned char*)&randomxKey[0], 5);
|
||||||
// ss << SMART_CHAIN_SYMBOL;
|
crypto_generichash_blake2b_update(&state, (unsigned char*)&SMART_CHAIN_SYMBOL[0], strlen(SMART_CHAIN_SYMBOL));
|
||||||
// crypto_generichash_blake2b_update(&state, (unsigned char*)&ss[0], ss.size());
|
uchar randomxInput[32];
|
||||||
// char blakehash[32];
|
crypto_generichash_blake2b_final(&state, randomxInput, 32);
|
||||||
// crypto_generichash_blake2b_final(&state, blakehash, 32);
|
|
||||||
|
|
||||||
const char randomxInput[] = "testing"; // blakehash[32];
|
|
||||||
randomx_flags flags = randomx_get_flags();
|
randomx_flags flags = randomx_get_flags();
|
||||||
randomx_cache *randomxCache = randomx_alloc_cache(flags);
|
randomx_cache *randomxCache = randomx_alloc_cache(flags);
|
||||||
|
|
||||||
if(Mining_height > 1) {
|
if(Mining_height > 1024 && (Mining_height % 1024 == 64)) {
|
||||||
|
// At block height 1024*N+64 we should use the blockhash of block 1024*N as key
|
||||||
// use blockchain data to set a new key+input for a group of blocks
|
// use blockchain data to set a new key+input for a group of blocks
|
||||||
// randomxKey = ...
|
// randomxKey = ...
|
||||||
// randomxInput = ...
|
// randomxInput = ...
|
||||||
|
|||||||
Reference in New Issue
Block a user