From 829911cce95ed3aef4cc5eebf07117681df02941 Mon Sep 17 00:00:00 2001 From: moneroexamples Date: Sat, 5 Oct 2019 13:46:59 +0800 Subject: [PATCH] code cleaning --- src/crypto/CMakeLists.txt | 3 --- src/page.h | 22 ++++++++-------------- 2 files changed, 8 insertions(+), 17 deletions(-) diff --git a/src/crypto/CMakeLists.txt b/src/crypto/CMakeLists.txt index e2bff10..fe7f03c 100644 --- a/src/crypto/CMakeLists.txt +++ b/src/crypto/CMakeLists.txt @@ -5,9 +5,6 @@ project(mycrypto) set(SOURCE_FILES rx-slow-hash.c) -#include_directories( -# /home/mwo2/monero/external/randomx/src) - # make static library called libmyxrm # that we are going to link to # in the root CMakeLists.txt file diff --git a/src/page.h b/src/page.h index 40b5f14..9cfbf5d 100644 --- a/src/page.h +++ b/src/page.h @@ -36,14 +36,14 @@ #include "../ext/vpetrigocaches/fifo_cache_policy.hpp" #include "../ext/mstch/src/visitor/render_node.hpp" -extern "C" bool me_rx_needhash(const uint64_t height, uint64_t *seedheight); -extern "C" void me_rx_seedhash(const uint64_t seedheight, const char *hash, const int miners); extern "C" uint64_t me_rx_seedheight(const uint64_t height); + +// forked version of the rx_slow_hash from monero extern "C" void me_rx_slow_hash(const uint64_t mainheight, const uint64_t seedheight, const char *seedhash, const void *data, size_t length, char *hash, int miners, int is_alt); -extern "C" void me_rx_reorg(const uint64_t split_height); +//extern "C" void me_rx_reorg(const uint64_t split_height); extern __thread randomx_vm *rx_vm; @@ -302,6 +302,8 @@ struct randomx_status } }; +// modified version of the get_block_longhash +// from monero to use me_rx_slow_hash bool me_get_block_longhash(const Blockchain *pbc, const block& b, @@ -7270,12 +7272,6 @@ get_randomx_code(uint64_t blk_height, rx_vm->initScratchpad(&tempHash); rx_vm->resetRoundingMode(); - // randomx::Program* prg - // = reinterpret_cast( - // reinterpret_cast(rx_vm) + 64); - // - - for (int chain = 0; chain < RANDOMX_PROGRAM_COUNT - 1; ++chain) { rx_vm->run(&tempHash); @@ -7297,11 +7293,9 @@ get_randomx_code(uint64_t blk_height, rx_code.back().prog = rx_vm->getProgram(); rx_code.back().reg_file = *(rx_vm->getRegisterFile()); - - // crypto::hash res2; - // rx_vm->getFinalResult(res2.data, RANDOMX_HASH_SIZE); - - // cout << "pow2: " << pod_to_hex(res2) << endl; + //crypto::hash res2; + //rx_vm->getFinalResult(res2.data, RANDOMX_HASH_SIZE); + //cout << "pow2: " << pod_to_hex(res2) << endl; return rx_code; }