diff --git a/src/cryptonote_core/cryptonote_tx_utils.cpp b/src/cryptonote_core/cryptonote_tx_utils.cpp index 7f821135e..bc38c767d 100644 --- a/src/cryptonote_core/cryptonote_tx_utils.cpp +++ b/src/cryptonote_core/cryptonote_tx_utils.cpp @@ -1440,16 +1440,24 @@ namespace cryptonote bool get_block_longhash(const Blockchain *pbc, const blobdata& bd, crypto::hash& res, const uint64_t height, const int major_version, const crypto::hash *seed_hash, const int miners) { - crypto::hash hash; if (pbc != NULL) { + crypto::hash hash; const uint64_t seed_height = rx_seedheight(height); hash = seed_hash ? *seed_hash : pbc->get_pending_block_id_by_height(seed_height); + rx_slow_hash(hash.data, bd.data(), bd.size(), res.data); } else { - memset(&hash, 0, sizeof(hash)); // only happens when generating genesis block + // only happens when generating genesis block + // Hardcoded genesis for ios compat + const char* hex = "4ade63d5ccb8cfae075e8b882514c471f35da95f85dd1b20fdcd6f3a95caabc5"; + char bytes[32]; + for (int i = 0; i < 32; i++) { + char byte_str[3] = { hex[i * 2], hex[i * 2 + 1], '\0' }; + bytes[i] = (char)strtol(byte_str, NULL, 16); + } + memcpy(res.data, bytes, sizeof(bytes)); } - rx_slow_hash(hash.data, bd.data(), bd.size(), res.data); return true; }