set pow variants

This commit is contained in:
wowario 2023-01-31 10:24:03 +03:00
parent 9c3fb6c243
commit a04690c66b
No known key found for this signature in database
GPG Key ID: 793504B449C69220
2 changed files with 5 additions and 5 deletions

View File

@ -699,7 +699,7 @@ namespace cryptonote
} }
rx_slow_hash(hash.data, bd.data(), bd.size(), res.data); rx_slow_hash(hash.data, bd.data(), bd.size(), res.data);
} else { } else {
const int pow_variant = major_version >= 7 ? major_version - 6 : 0; const int pow_variant = major_version >= 11 ? 4 : major_version >= 9 ? 2 : 1;
crypto::cn_slow_hash(bd.data(), bd.size(), res, pow_variant, height); crypto::cn_slow_hash(bd.data(), bd.size(), res, pow_variant, height);
} }
return true; return true;

View File

@ -1460,15 +1460,15 @@ namespace cryptonote
if (lMiner.is_mining() || lMiner.get_is_background_mining_enabled()) if (lMiner.is_mining() || lMiner.get_is_background_mining_enabled())
res.address = get_account_address_as_str(nettype(), false, lMiningAdr); res.address = get_account_address_as_str(nettype(), false, lMiningAdr);
const uint8_t major_version = m_core.get_blockchain_storage().get_current_hard_fork_version(); const uint8_t major_version = m_core.get_blockchain_storage().get_current_hard_fork_version();
const unsigned variant = major_version >= 7 ? major_version - 6 : 0; const unsigned variant = major_version >= 13 ? 6 : major_version >= 11 && major_version <= 12 ? 4 : 2;
switch (variant) switch (variant)
{ {
case 0: res.pow_algorithm = "Cryptonight"; break; case 0: res.pow_algorithm = "Cryptonight"; break;
case 1: res.pow_algorithm = "CNv1 (Cryptonight variant 1)"; break; case 1: res.pow_algorithm = "CNv1 (Cryptonight variant 1)"; break;
case 2: case 3: res.pow_algorithm = "CNv2 (Cryptonight variant 2)"; break; case 2: case 3: res.pow_algorithm = "CNv2 (Cryptonight variant 2)"; break;
case 4: case 5: res.pow_algorithm = "CNv4 (Cryptonight variant 4)"; break; case 4: case 5: res.pow_algorithm = "CN/WOW"; break;
case 6: case 7: case 8: case 9: res.pow_algorithm = "RandomX"; break; case 6: case 7: case 8: case 9: res.pow_algorithm = "RandomWOW"; break;
default: res.pow_algorithm = "RandomX"; break; // assumed default: res.pow_algorithm = "RandomWOW"; break; // assumed
} }
if (res.is_background_mining_enabled) if (res.is_background_mining_enabled)
{ {