diff --git a/src/blockchain_utilities/CMakeLists.txt b/src/blockchain_utilities/CMakeLists.txt index b57dcb361..a9163072b 100644 --- a/src/blockchain_utilities/CMakeLists.txt +++ b/src/blockchain_utilities/CMakeLists.txt @@ -133,59 +133,59 @@ monero_private_headers(blockchain_stats ${blockchain_stats_private_headers}) -#monero_add_executable(blockchain_import -# ${blockchain_import_sources} -# ${blockchain_import_private_headers}) +monero_add_executable(blockchain_import + ${blockchain_import_sources} + ${blockchain_import_private_headers}) -#target_link_libraries(blockchain_import -# PRIVATE -# crypto -# cncrypto -# cryptonote_core -# blockchain_db -# oracle -# version -# epee -# ${Boost_FILESYSTEM_LIBRARY} -# ${Boost_SYSTEM_LIBRARY} -# ${Boost_THREAD_LIBRARY} -# ${CMAKE_THREAD_LIBS_INIT} -# ${EXTRA_LIBRARIES} -# ${Blocks}) +target_link_libraries(blockchain_import + PRIVATE + crypto + cncrypto + cryptonote_core + blockchain_db + oracle + version + epee + ${Boost_FILESYSTEM_LIBRARY} + ${Boost_SYSTEM_LIBRARY} + ${Boost_THREAD_LIBRARY} + ${CMAKE_THREAD_LIBS_INIT} + ${EXTRA_LIBRARIES} + ${Blocks}) -#if(ARCH_WIDTH) -# target_compile_definitions(blockchain_import -# PUBLIC -DARCH_WIDTH=${ARCH_WIDTH}) -#endif() +if(ARCH_WIDTH) + target_compile_definitions(blockchain_import + PUBLIC -DARCH_WIDTH=${ARCH_WIDTH}) +endif() -#set_property(TARGET blockchain_import -# PROPERTY -# OUTPUT_NAME "salvium-blockchain-import") -#install(TARGETS blockchain_import DESTINATION bin) +set_property(TARGET blockchain_import + PROPERTY + OUTPUT_NAME "salvium-blockchain-import") +install(TARGETS blockchain_import DESTINATION bin) -#monero_add_executable(blockchain_export -# ${blockchain_export_sources} -# ${blockchain_export_private_headers}) +monero_add_executable(blockchain_export + ${blockchain_export_sources} + ${blockchain_export_private_headers}) -#target_link_libraries(blockchain_export -# PRIVATE -# crypto -# cncrypto -# cryptonote_core -# blockchain_db -# oracle -# version -# epee -# ${Boost_FILESYSTEM_LIBRARY} -# ${Boost_SYSTEM_LIBRARY} -# ${Boost_THREAD_LIBRARY} -# ${CMAKE_THREAD_LIBS_INIT} -# ${EXTRA_LIBRARIES}) +target_link_libraries(blockchain_export + PRIVATE + crypto + cncrypto + cryptonote_core + blockchain_db + oracle + version + epee + ${Boost_FILESYSTEM_LIBRARY} + ${Boost_SYSTEM_LIBRARY} + ${Boost_THREAD_LIBRARY} + ${CMAKE_THREAD_LIBS_INIT} + ${EXTRA_LIBRARIES}) -#set_property(TARGET blockchain_export -# PROPERTY -# OUTPUT_NAME "salvium-blockchain-export") -#install(TARGETS blockchain_export DESTINATION bin) +set_property(TARGET blockchain_export + PROPERTY + OUTPUT_NAME "salvium-blockchain-export") +install(TARGETS blockchain_export DESTINATION bin) monero_add_executable(blockchain_blackball ${blockchain_blackball_sources} @@ -213,95 +213,95 @@ set_property(TARGET blockchain_blackball install(TARGETS blockchain_blackball DESTINATION bin) -#monero_add_executable(blockchain_usage -# ${blockchain_usage_sources} -# ${blockchain_usage_private_headers}) +monero_add_executable(blockchain_usage + ${blockchain_usage_sources} + ${blockchain_usage_private_headers}) -#target_link_libraries(blockchain_usage -# PRIVATE -# crypto -# cncrypto -# cryptonote_core -# blockchain_db -# oracle -# version -# epee -# ${Boost_FILESYSTEM_LIBRARY} -# ${Boost_SYSTEM_LIBRARY} -# ${Boost_THREAD_LIBRARY} -# ${CMAKE_THREAD_LIBS_INIT} -# ${EXTRA_LIBRARIES}) +target_link_libraries(blockchain_usage + PRIVATE + crypto + cncrypto + cryptonote_core + blockchain_db + oracle + version + epee + ${Boost_FILESYSTEM_LIBRARY} + ${Boost_SYSTEM_LIBRARY} + ${Boost_THREAD_LIBRARY} + ${CMAKE_THREAD_LIBS_INIT} + ${EXTRA_LIBRARIES}) -#set_property(TARGET blockchain_usage -# PROPERTY -# OUTPUT_NAME "salvium-blockchain-usage") -#nstall(TARGETS blockchain_usage DESTINATION bin) +set_property(TARGET blockchain_usage + PROPERTY + OUTPUT_NAME "salvium-blockchain-usage") +install(TARGETS blockchain_usage DESTINATION bin) -#monero_add_executable(blockchain_ancestry -# ${blockchain_ancestry_sources} -# ${blockchain_ancestry_private_headers}) +monero_add_executable(blockchain_ancestry + ${blockchain_ancestry_sources} + ${blockchain_ancestry_private_headers}) -#target_link_libraries(blockchain_ancestry -# PRIVATE -# cryptonote_core -# blockchain_db -# oracle -# version -# epee -# ${Boost_FILESYSTEM_LIBRARY} -# ${Boost_SYSTEM_LIBRARY} -# ${Boost_THREAD_LIBRARY} -# ${CMAKE_THREAD_LIBS_INIT} -# ${EXTRA_LIBRARIES}) +target_link_libraries(blockchain_ancestry + PRIVATE + cryptonote_core + blockchain_db + oracle + version + epee + ${Boost_FILESYSTEM_LIBRARY} + ${Boost_SYSTEM_LIBRARY} + ${Boost_THREAD_LIBRARY} + ${CMAKE_THREAD_LIBS_INIT} + ${EXTRA_LIBRARIES}) -#set_property(TARGET blockchain_ancestry -# PROPERTY -# OUTPUT_NAME "salvium-blockchain-ancestry") -#install(TARGETS blockchain_ancestry DESTINATION bin) +set_property(TARGET blockchain_ancestry + PROPERTY + OUTPUT_NAME "salvium-blockchain-ancestry") +install(TARGETS blockchain_ancestry DESTINATION bin) -# monero_add_executable(blockchain_depth -# ${blockchain_depth_sources} -# ${blockchain_depth_private_headers}) +monero_add_executable(blockchain_depth + ${blockchain_depth_sources} + ${blockchain_depth_private_headers}) -#target_link_libraries(blockchain_depth -# PRIVATE -# cryptonote_core -# blockchain_db -# oracle -# version -# epee -# ${Boost_FILESYSTEM_LIBRARY} -# ${Boost_SYSTEM_LIBRARY} -# ${Boost_THREAD_LIBRARY} -# ${CMAKE_THREAD_LIBS_INIT} -# ${EXTRA_LIBRARIES}) +target_link_libraries(blockchain_depth + PRIVATE + cryptonote_core + blockchain_db + oracle + version + epee + ${Boost_FILESYSTEM_LIBRARY} + ${Boost_SYSTEM_LIBRARY} + ${Boost_THREAD_LIBRARY} + ${CMAKE_THREAD_LIBS_INIT} + ${EXTRA_LIBRARIES}) -#set_property(TARGET blockchain_depth -# PROPERTY -# OUTPUT_NAME "salvium-blockchain-depth") -#install(TARGETS blockchain_depth DESTINATION bin) +set_property(TARGET blockchain_depth + PROPERTY + OUTPUT_NAME "salvium-blockchain-depth") +install(TARGETS blockchain_depth DESTINATION bin) -#monero_add_executable(blockchain_stats -# ${blockchain_stats_sources} -# ${blockchain_stats_private_headers}) +monero_add_executable(blockchain_stats + ${blockchain_stats_sources} + ${blockchain_stats_private_headers}) -#target_link_libraries(blockchain_stats -# PRIVATE -# cryptonote_core -# blockchain_db -# oracle -# version -# epee -# ${Boost_FILESYSTEM_LIBRARY} -# ${Boost_SYSTEM_LIBRARY} -# ${Boost_THREAD_LIBRARY} -# ${CMAKE_THREAD_LIBS_INIT} -# ${EXTRA_LIBRARIES}) +target_link_libraries(blockchain_stats + PRIVATE + cryptonote_core + blockchain_db + oracle + version + epee + ${Boost_FILESYSTEM_LIBRARY} + ${Boost_SYSTEM_LIBRARY} + ${Boost_THREAD_LIBRARY} + ${CMAKE_THREAD_LIBS_INIT} + ${EXTRA_LIBRARIES}) -#set_property(TARGET blockchain_stats -# PROPERTY -# OUTPUT_NAME "salvium-blockchain-stats") -#install(TARGETS blockchain_stats DESTINATION bin) +set_property(TARGET blockchain_stats + PROPERTY + OUTPUT_NAME "salvium-blockchain-stats") +install(TARGETS blockchain_stats DESTINATION bin) monero_add_executable(blockchain_prune_known_spent_data ${blockchain_prune_known_spent_data_sources} diff --git a/src/crypto/CMakeLists.txt b/src/crypto/CMakeLists.txt index 595c7f966..102ffe41a 100644 --- a/src/crypto/CMakeLists.txt +++ b/src/crypto/CMakeLists.txt @@ -71,7 +71,7 @@ target_link_libraries(cncrypto epee randomx ${Boost_SYSTEM_LIBRARY} - ${SODIUM_LIBRARY} + ${sodium_LIBRARIES} PRIVATE ${EXTRA_LIBRARIES}) diff --git a/src/ringct/CMakeLists.txt b/src/ringct/CMakeLists.txt index d415e6409..1f3d1913f 100644 --- a/src/ringct/CMakeLists.txt +++ b/src/ringct/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (c) 2016-2022, The Monero Project +# Copyright (c) 2016-2023, The Monero Project # # All rights reserved. # diff --git a/src/ringct/bulletproofs.cc b/src/ringct/bulletproofs.cc index ba7ab2c0d..2cfaf18c0 100644 --- a/src/ringct/bulletproofs.cc +++ b/src/ringct/bulletproofs.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2022, The Monero Project +// Copyright (c) 2017-2023, The Monero Project // // All rights reserved. // diff --git a/src/ringct/bulletproofs.h b/src/ringct/bulletproofs.h index c3fe6f8b9..7ff47e8a0 100644 --- a/src/ringct/bulletproofs.h +++ b/src/ringct/bulletproofs.h @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2022, The Monero Project +// Copyright (c) 2017-2023, The Monero Project // // All rights reserved. // diff --git a/src/ringct/bulletproofs_plus.cc b/src/ringct/bulletproofs_plus.cc index 77b800064..0619811cb 100644 --- a/src/ringct/bulletproofs_plus.cc +++ b/src/ringct/bulletproofs_plus.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2022, The Monero Project +// Copyright (c) 2017-2023, The Monero Project // // All rights reserved. // diff --git a/src/ringct/bulletproofs_plus.h b/src/ringct/bulletproofs_plus.h index 861c54f4f..80a8de8fb 100644 --- a/src/ringct/bulletproofs_plus.h +++ b/src/ringct/bulletproofs_plus.h @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2022, The Monero Project +// Copyright (c) 2017-2023, The Monero Project // // All rights reserved. // diff --git a/src/ringct/multiexp.cc b/src/ringct/multiexp.cc index 67814682a..5e241f2cc 100644 --- a/src/ringct/multiexp.cc +++ b/src/ringct/multiexp.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2022, The Monero Project +// Copyright (c) 2017-2023, The Monero Project // // All rights reserved. @@ -57,28 +57,28 @@ extern "C" // 1 1 52.8 70.4 70.2 // Pippenger: -// 1 2 3 4 5 6 7 8 9 bestN -// 2 555 598 621 804 1038 1733 2486 5020 8304 1 -// 4 783 747 800 1006 1428 2132 3285 5185 9806 2 -// 8 1174 1071 1095 1286 1640 2398 3869 6378 12080 2 -// 16 2279 1874 1745 1739 2144 2831 4209 6964 12007 4 -// 32 3910 3706 2588 2477 2782 3467 4856 7489 12618 4 -// 64 7184 5429 4710 4368 4010 4672 6027 8559 13684 5 -// 128 14097 10574 8452 7297 6841 6718 8615 10580 15641 6 -// 256 27715 20800 16000 13550 11875 11400 11505 14090 18460 6 -// 512 55100 41250 31740 26570 22030 19830 20760 21380 25215 6 -// 1024 111520 79000 61080 49720 43080 38320 37600 35040 36750 8 -// 2048 219480 162680 122120 102080 83760 70360 66600 63920 66160 8 -// 4096 453320 323080 247240 210200 180040 150240 132440 114920 110560 9 +// 1 2 3 4 5 6 7 8 9 bestN +// 2 555 598 621 804 1038 1733 2486 5020 8304 1 +// 4 783 747 800 1006 1428 2132 3285 5185 9806 2 +// 8 1174 1071 1095 1286 1640 2398 3869 6378 12080 2 +// 16 2279 1874 1745 1739 2144 2831 4209 6964 12007 4 +// 32 3910 3706 2588 2477 2782 3467 4856 7489 12618 4 +// 64 7184 5429 4710 4368 4010 4672 6027 8559 13684 5 +// 128 14097 10574 8452 7297 6841 6718 8615 10580 15641 6 +// 256 27715 20800 16000 13550 11875 11400 11505 14090 18460 6 +// 512 55100 41250 31740 26570 22030 19830 20760 21380 25215 6 +// 1024 111520 79000 61080 49720 43080 38320 37600 35040 36750 8 +// 2048 219480 162680 122120 102080 83760 70360 66600 63920 66160 8 +// 4096 453320 323080 247240 210200 180040 150240 132440 114920 110560 9 -// 2 4 8 16 32 64 128 256 512 1024 2048 4096 -// Bos Coster 858 994 1316 1949 3183 5512 9865 17830 33485 63160 124280 246320 -// Straus 226 341 548 980 1870 3538 7039 14490 29020 57200 118640 233640 -// Straus/cached 226 315 485 785 1514 2858 5753 11065 22970 45120 98880 194840 -// Pippenger 555 747 1071 1739 2477 4010 6718 11400 19830 35040 63920 110560 +// 2 4 8 16 32 64 128 256 512 1024 2048 4096 +// Bos Coster 858 994 1316 1949 3183 5512 9865 17830 33485 63160 124280 246320 +// Straus 226 341 548 980 1870 3538 7039 14490 29020 57200 118640 233640 +// Straus/cached 226 315 485 785 1514 2858 5753 11065 22970 45120 98880 194840 +// Pippenger 555 747 1071 1739 2477 4010 6718 11400 19830 35040 63920 110560 -// Best/cached Straus Straus Straus Straus Straus Straus Straus Straus Pip Pip Pip Pip -// Best/uncached Straus Straus Straus Straus Straus Straus Pip Pip Pip Pip Pip Pip +// Best/cached Straus Straus Straus Straus Straus Straus Straus Straus Pip Pip Pip Pip +// Best/uncached Straus Straus Straus Straus Straus Straus Pip Pip Pip Pip Pip Pip // New timings: // Pippenger: @@ -443,7 +443,7 @@ size_t straus_get_cache_size(const std::shared_ptr &cache) return sz; } -rct::key straus(const std::vector &data, const std::shared_ptr &cache, size_t STEP) +ge_p3 straus_p3(const std::vector &data, const std::shared_ptr &cache, size_t STEP) { CHECK_AND_ASSERT_THROW_MES(cache == NULL || cache->size >= data.size(), "Cache is too small"); MULTIEXP_PERF(PERF_TIMER_UNIT(straus, 1000000)); @@ -554,7 +554,13 @@ skipfirst: ge_p1p1_to_p3(&res_p3, &p1); } + return res_p3; +} + +rct::key straus(const std::vector &data, const std::shared_ptr &cache, size_t STEP) +{ rct::key res; + const ge_p3 res_p3 = straus_p3(data, cache, STEP); ge_p3_tobytes(res.bytes, &res_p3); return res; } @@ -571,14 +577,6 @@ size_t get_pippenger_c(size_t N) return 9; } -struct pippenger_cached_data -{ - size_t size; - ge_cached *cached; - pippenger_cached_data(): size(0), cached(NULL) {} - ~pippenger_cached_data() { aligned_free(cached); } -}; - std::shared_ptr pippenger_init_cache(const std::vector &data, size_t start_offset, size_t N) { MULTIEXP_PERF(PERF_TIMER_START_UNIT(pippenger_init_cache, 1000000)); @@ -586,13 +584,11 @@ std::shared_ptr pippenger_init_cache(const std::vector cache(new pippenger_cached_data()); + std::shared_ptr cache = std::make_shared(); - cache->size = N; - cache->cached = (ge_cached*)aligned_realloc(cache->cached, N * sizeof(ge_cached), 4096); - CHECK_AND_ASSERT_THROW_MES(cache->cached, "Out of memory"); + cache->resize(N); for (size_t i = 0; i < N; ++i) - ge_p3_to_cached(&cache->cached[i], &data[i+start_offset].point); + ge_p3_to_cached(&(*cache)[i], &data[i+start_offset].point); MULTIEXP_PERF(PERF_TIMER_STOP(pippenger_init_cache)); return cache; @@ -600,14 +596,14 @@ std::shared_ptr pippenger_init_cache(const std::vector &cache) { - return cache->size * sizeof(*cache->cached); + return cache->size() * sizeof(ge_cached); } -rct::key pippenger(const std::vector &data, const std::shared_ptr &cache, size_t cache_size, size_t c) +ge_p3 pippenger_p3(const std::vector &data, const std::shared_ptr &cache, size_t cache_size, size_t c) { if (cache != NULL && cache_size == 0) - cache_size = cache->size; - CHECK_AND_ASSERT_THROW_MES(cache == NULL || cache_size <= cache->size, "Cache is too small"); + cache_size = cache->size(); + CHECK_AND_ASSERT_THROW_MES(cache == NULL || cache_size <= cache->size(), "Cache is too small"); if (c == 0) c = get_pippenger_c(data.size()); CHECK_AND_ASSERT_THROW_MES(c <= 9, "c is too large"); @@ -661,9 +657,9 @@ rct::key pippenger(const std::vector &data, const std::shared_ptr< if (buckets_init[bucket]) { if (i < cache_size) - add(buckets[bucket], local_cache->cached[i]); + add(buckets[bucket], (*local_cache)[i]); else - add(buckets[bucket], local_cache_2->cached[i - cache_size]); + add(buckets[bucket], (*local_cache_2)[i - cache_size]); } else { @@ -700,8 +696,14 @@ rct::key pippenger(const std::vector &data, const std::shared_ptr< } } + return result; +} + +rct::key pippenger(const std::vector &data, const std::shared_ptr &cache, const size_t cache_size, const size_t c) +{ rct::key res; - ge_p3_tobytes(res.bytes, &result); + const ge_p3 result_p3 = pippenger_p3(data, cache, cache_size, c); + ge_p3_tobytes(res.bytes, &result_p3); return res; } diff --git a/src/ringct/multiexp.h b/src/ringct/multiexp.h index 788516c0b..ae10fcc8e 100644 --- a/src/ringct/multiexp.h +++ b/src/ringct/multiexp.h @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2022, The Monero Project +// Copyright (c) 2017-2023, The Monero Project // // All rights reserved. @@ -35,10 +35,16 @@ #define MULTIEXP_H #include +extern "C" +{ +#include "crypto/crypto-ops.h" +} #include "crypto/crypto.h" #include "rctTypes.h" #include "misc_log_ex.h" +#include + namespace rct { @@ -55,17 +61,19 @@ struct MultiexpData { }; struct straus_cached_data; -struct pippenger_cached_data; +using pippenger_cached_data = std::vector>; rct::key bos_coster_heap_conv(std::vector data); rct::key bos_coster_heap_conv_robust(std::vector data); std::shared_ptr straus_init_cache(const std::vector &data, size_t N =0); size_t straus_get_cache_size(const std::shared_ptr &cache); +ge_p3 straus_p3(const std::vector &data, const std::shared_ptr &cache = NULL, size_t STEP = 0); rct::key straus(const std::vector &data, const std::shared_ptr &cache = NULL, size_t STEP = 0); std::shared_ptr pippenger_init_cache(const std::vector &data, size_t start_offset = 0, size_t N =0); size_t pippenger_get_cache_size(const std::shared_ptr &cache); size_t get_pippenger_c(size_t N); -rct::key pippenger(const std::vector &data, const std::shared_ptr &cache = NULL, size_t cache_size = 0, size_t c = 0); +ge_p3 pippenger_p3(const std::vector &data, const std::shared_ptr &cache = NULL, size_t cache_size = 0, size_t c = 0); +rct::key pippenger(const std::vector &data, const std::shared_ptr &cache = NULL, const size_t cache_size = 0, const size_t c = 0); } diff --git a/src/ringct/rctCryptoOps.c b/src/ringct/rctCryptoOps.c index a2bb68665..b4fcc64bd 100644 --- a/src/ringct/rctCryptoOps.c +++ b/src/ringct/rctCryptoOps.c @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2022, The Monero Project +// Copyright (c) 2014-2023, The Monero Project // // All rights reserved. // diff --git a/src/ringct/rctCryptoOps.h b/src/ringct/rctCryptoOps.h index 2d6e13bb7..ec5708818 100644 --- a/src/ringct/rctCryptoOps.h +++ b/src/ringct/rctCryptoOps.h @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2022, The Monero Project +// Copyright (c) 2014-2023, The Monero Project // // All rights reserved. // diff --git a/src/ringct/rctOps.cpp b/src/ringct/rctOps.cpp index 245a3f477..56dd53b2c 100644 --- a/src/ringct/rctOps.cpp +++ b/src/ringct/rctOps.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2016, Monero Research Labs +// Copyright (c) 2016-2023, Monero Research Labs // // Author: Shen Noether // @@ -671,7 +671,7 @@ namespace rct { //Elliptic Curve Diffie Helman: encodes and decodes the amount b and mask a // where C= aG + bH - static key ecdhHash(const key &k) + key genAmountEncodingFactor(const key &k) { char data[38]; rct::key hash; @@ -700,7 +700,7 @@ namespace rct { if (v2) { unmasked.mask = zero(); - xor8(unmasked.amount, ecdhHash(sharedSec)); + xor8(unmasked.amount, genAmountEncodingFactor(sharedSec)); } else { @@ -715,7 +715,7 @@ namespace rct { if (v2) { masked.mask = genCommitmentMask(sharedSec); - xor8(masked.amount, ecdhHash(sharedSec)); + xor8(masked.amount, genAmountEncodingFactor(sharedSec)); } else { diff --git a/src/ringct/rctOps.h b/src/ringct/rctOps.h index 679ed1441..eaab998cb 100644 --- a/src/ringct/rctOps.h +++ b/src/ringct/rctOps.h @@ -1,5 +1,5 @@ //#define DBG -// Copyright (c) 2016, Monero Research Labs +// Copyright (c) 2016-2023, Monero Research Labs // // Author: Shen Noether // @@ -184,6 +184,7 @@ namespace rct { //Elliptic Curve Diffie Helman: encodes and decodes the amount b and mask a // where C= aG + bH + key genAmountEncodingFactor(const key &k); key genCommitmentMask(const key &sk); void ecdhEncode(ecdhTuple & unmasked, const key & sharedSec, bool v2); void ecdhDecode(ecdhTuple & masked, const key & sharedSec, bool v2); diff --git a/src/rpc/core_rpc_server.cpp b/src/rpc/core_rpc_server.cpp index d57115d5c..777593320 100644 --- a/src/rpc/core_rpc_server.cpp +++ b/src/rpc/core_rpc_server.cpp @@ -2982,13 +2982,13 @@ namespace cryptonote return true; } //------------------------------------------------------------------------------------------------------------------------------ - bool core_rpc_server::on_get_circulating_supply(const COMMAND_RPC_GET_CIRCULATING_SUPPLY::request& req, COMMAND_RPC_GET_CIRCULATING_SUPPLY::response& res, epee::json_rpc::error& error_resp, const connection_context *ctx) + bool core_rpc_server::on_get_supply_info(const COMMAND_RPC_GET_SUPPLY_INFO::request& req, COMMAND_RPC_GET_SUPPLY_INFO::response& res, epee::json_rpc::error& error_resp, const connection_context *ctx) { - PERF_TIMER(on_get_circulating_supply); + PERF_TIMER(on_get_supply_info); std::map amounts = m_core.get_blockchain_storage().get_db().get_circulating_supply(); for (const auto &i: amounts) { - COMMAND_RPC_GET_CIRCULATING_SUPPLY::supply_entry se(i.first, std::to_string(i.second)); + COMMAND_RPC_GET_SUPPLY_INFO::supply_entry se(i.first, std::to_string(i.second)); res.supply_tally.push_back(se); } res.height = m_core.get_current_blockchain_height(); diff --git a/src/rpc/core_rpc_server.h b/src/rpc/core_rpc_server.h index fe8f8a75b..a763ccd7e 100644 --- a/src/rpc/core_rpc_server.h +++ b/src/rpc/core_rpc_server.h @@ -174,7 +174,7 @@ namespace cryptonote MAP_JON_RPC_WE("get_output_histogram", on_get_output_histogram, COMMAND_RPC_GET_OUTPUT_HISTOGRAM) MAP_JON_RPC_WE("get_version", on_get_version, COMMAND_RPC_GET_VERSION) MAP_JON_RPC_WE_IF("get_coinbase_tx_sum", on_get_coinbase_tx_sum, COMMAND_RPC_GET_COINBASE_TX_SUM, !m_restricted) - MAP_JON_RPC_WE("get_circulating_supply", on_get_circulating_supply, COMMAND_RPC_GET_CIRCULATING_SUPPLY) + MAP_JON_RPC_WE("get_supply_info", on_get_supply_info, COMMAND_RPC_GET_SUPPLY_INFO) MAP_JON_RPC_WE("get_yield_info", on_get_yield_info, COMMAND_RPC_GET_YIELD_INFO) MAP_JON_RPC_WE("get_fee_estimate", on_get_base_fee_estimate, COMMAND_RPC_GET_BASE_FEE_ESTIMATE) MAP_JON_RPC_WE_IF("get_alternate_chains",on_get_alternate_chains, COMMAND_RPC_GET_ALTERNATE_CHAINS, !m_restricted) @@ -253,7 +253,7 @@ namespace cryptonote bool on_get_output_histogram(const COMMAND_RPC_GET_OUTPUT_HISTOGRAM::request& req, COMMAND_RPC_GET_OUTPUT_HISTOGRAM::response& res, epee::json_rpc::error& error_resp, const connection_context *ctx = NULL); bool on_get_version(const COMMAND_RPC_GET_VERSION::request& req, COMMAND_RPC_GET_VERSION::response& res, epee::json_rpc::error& error_resp, const connection_context *ctx = NULL); bool on_get_coinbase_tx_sum(const COMMAND_RPC_GET_COINBASE_TX_SUM::request& req, COMMAND_RPC_GET_COINBASE_TX_SUM::response& res, epee::json_rpc::error& error_resp, const connection_context *ctx = NULL); - bool on_get_circulating_supply(const COMMAND_RPC_GET_CIRCULATING_SUPPLY::request& req, COMMAND_RPC_GET_CIRCULATING_SUPPLY::response& res, epee::json_rpc::error& error_resp, const connection_context *ctx = NULL); + bool on_get_supply_info(const COMMAND_RPC_GET_SUPPLY_INFO::request& req, COMMAND_RPC_GET_SUPPLY_INFO::response& res, epee::json_rpc::error& error_resp, const connection_context *ctx = NULL); bool on_get_yield_info(const COMMAND_RPC_GET_YIELD_INFO::request& req, COMMAND_RPC_GET_YIELD_INFO::response& res, epee::json_rpc::error& error_resp, const connection_context *ctx = NULL); bool on_get_base_fee_estimate(const COMMAND_RPC_GET_BASE_FEE_ESTIMATE::request& req, COMMAND_RPC_GET_BASE_FEE_ESTIMATE::response& res, epee::json_rpc::error& error_resp, const connection_context *ctx = NULL); bool on_get_alternate_chains(const COMMAND_RPC_GET_ALTERNATE_CHAINS::request& req, COMMAND_RPC_GET_ALTERNATE_CHAINS::response& res, epee::json_rpc::error& error_resp, const connection_context *ctx = NULL); diff --git a/src/rpc/core_rpc_server_commands_defs.h b/src/rpc/core_rpc_server_commands_defs.h index 2ec24c354..a6584c5b1 100644 --- a/src/rpc/core_rpc_server_commands_defs.h +++ b/src/rpc/core_rpc_server_commands_defs.h @@ -1440,7 +1440,7 @@ namespace cryptonote typedef epee::misc_utils::struct_init response; }; - struct COMMAND_RPC_GET_CIRCULATING_SUPPLY + struct COMMAND_RPC_GET_SUPPLY_INFO { struct request_t { diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp index b6f3f720f..218f62bba 100644 --- a/src/wallet/wallet2.cpp +++ b/src/wallet/wallet2.cpp @@ -2323,10 +2323,10 @@ bool wallet2::get_pricing_record(oracle::pricing_record& pr, const uint64_t heig bool wallet2::get_circulating_supply(std::vector> &amounts) { // Issue an RPC call to get the block header (and thus the pricing record) at the specified height - cryptonote::COMMAND_RPC_GET_CIRCULATING_SUPPLY::request req = AUTO_VAL_INIT(req); - cryptonote::COMMAND_RPC_GET_CIRCULATING_SUPPLY::response res = AUTO_VAL_INIT(res); + cryptonote::COMMAND_RPC_GET_SUPPLY_INFO::request req = AUTO_VAL_INIT(req); + cryptonote::COMMAND_RPC_GET_SUPPLY_INFO::response res = AUTO_VAL_INIT(res); m_daemon_rpc_mutex.lock(); - bool r = invoke_http_json_rpc("/json_rpc", "get_circulating_supply", req, res, rpc_timeout); + bool r = invoke_http_json_rpc("/json_rpc", "get_supply_info", req, res, rpc_timeout); m_daemon_rpc_mutex.unlock(); if (r && res.status == CORE_RPC_STATUS_OK) { @@ -2338,7 +2338,7 @@ bool wallet2::get_circulating_supply(std::vectorbalance_all(req.strict, asset) : m_wallet->balance(req.account_index, asset, req.strict); if (!balance_info.balance) continue; - balance_info.unlocked_balance = req.all_accounts ? m_wallet->unlocked_balance_all(req.strict, asset, &balance_info.blocks_to_unlock, &balance_info.time_to_unlock) : m_wallet->unlocked_balance(req.account_index, "XHV", req.strict, &balance_info.blocks_to_unlock, &balance_info.time_to_unlock); + balance_info.unlocked_balance = req.all_accounts ? m_wallet->unlocked_balance_all(req.strict, asset, &balance_info.blocks_to_unlock, &balance_info.time_to_unlock) : m_wallet->unlocked_balance(req.account_index, asset, req.strict, &balance_info.blocks_to_unlock, &balance_info.time_to_unlock); balance_info.multisig_import_needed = m_wallet->multisig() && m_wallet->has_multisig_partial_key_images(); std::map> balance_per_subaddress_per_account; std::map>>> unlocked_balance_per_subaddress_per_account;