From 8716d2ad9dbb27d28d806ab548ea161dd36a7a58 Mon Sep 17 00:00:00 2001 From: selsta Date: Wed, 28 Apr 2021 16:13:19 +0200 Subject: cmake: fix non portable code --- src/blocks/CMakeLists.txt | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/src/blocks/CMakeLists.txt b/src/blocks/CMakeLists.txt index 051c60886..071ccd506 100644 --- a/src/blocks/CMakeLists.txt +++ b/src/blocks/CMakeLists.txt @@ -28,20 +28,32 @@ set(GENERATED_SOURCES "") +set(GENERATOR "${CMAKE_CURRENT_BINARY_DIR}/blocks_generator.cmake") +file(GENERATE OUTPUT ${GENERATOR} CONTENT [=[ +file(READ "${INPUT_DAT_FILE}" DATA HEX) +string(REGEX REPLACE "[0-9a-fA-F][0-9a-fA-F]" "0x\\0," DATA "${DATA}") +file(WRITE "${OUTPUT_C_SOURCE}" " +#include +const unsigned char ${BLOB_NAME}[]={ + ${DATA} +}; +const size_t ${BLOB_NAME}_len = sizeof(${BLOB_NAME}); +" +) +]=]) foreach(BLOB_NAME checkpoints testnet_blocks stagenet_blocks) set(OUTPUT_C_SOURCE "generated_${BLOB_NAME}.c") list(APPEND GENERATED_SOURCES ${OUTPUT_C_SOURCE}) set(INPUT_DAT_FILE "${BLOB_NAME}.dat") add_custom_command( - OUTPUT ${OUTPUT_C_SOURCE} - MAIN_DEPENDENCY ${INPUT_DAT_FILE} - COMMAND - cd ${CMAKE_CURRENT_BINARY_DIR} && - echo "'#include\t'" > ${OUTPUT_C_SOURCE} && - echo "'const\tunsigned\tchar\t${BLOB_NAME}[]={'" >> ${OUTPUT_C_SOURCE} && - od -v -An -tx1 ${CMAKE_CURRENT_SOURCE_DIR}/${INPUT_DAT_FILE} | sed -e "'s/[0-9a-fA-F]\\{1,\\}/0x&,/g'" -e "'$$s/.$$//'" >> ${OUTPUT_C_SOURCE} && - echo "'};'" >> ${OUTPUT_C_SOURCE} && - echo "'const\tsize_t\t${BLOB_NAME}_len\t=\tsizeof(${BLOB_NAME});'" >> ${OUTPUT_C_SOURCE} + OUTPUT ${OUTPUT_C_SOURCE} + MAIN_DEPENDENCY ${INPUT_DAT_FILE} + DEPENDS ${GENERATOR} + COMMAND ${CMAKE_COMMAND} + "-DINPUT_DAT_FILE=${CMAKE_CURRENT_SOURCE_DIR}/${INPUT_DAT_FILE}" + "-DBLOB_NAME=${BLOB_NAME}" + "-DOUTPUT_C_SOURCE=${CMAKE_CURRENT_BINARY_DIR}/${OUTPUT_C_SOURCE}" + "-P${GENERATOR}" ) endforeach() -- cgit v1.2.3 From 85079173db486bebedbf630c67cb195aa665d273 Mon Sep 17 00:00:00 2001 From: selsta Date: Wed, 30 Jun 2021 23:57:09 +0200 Subject: depends: add getmonero package mirror --- contrib/depends/Makefile | 2 +- contrib/depends/funcs.mk | 2 +- contrib/depends/packages/eudev.mk | 3 ++- contrib/depends/packages/gtest.mk | 3 ++- contrib/depends/packages/native_cctools.mk | 3 ++- 5 files changed, 8 insertions(+), 5 deletions(-) diff --git a/contrib/depends/Makefile b/contrib/depends/Makefile index 28ec972e4..2d9aa424a 100644 --- a/contrib/depends/Makefile +++ b/contrib/depends/Makefile @@ -3,7 +3,7 @@ SOURCES_PATH ?= $(BASEDIR)/sources BASE_CACHE ?= $(BASEDIR)/built SDK_PATH ?= $(BASEDIR)/SDKs -FALLBACK_DOWNLOAD_PATH ?= https://bitcoincore.org/depends-sources +FALLBACK_DOWNLOAD_PATH ?= https://downloads.getmonero.org/depends-sources BUILD = $(shell ./config.guess) HOST ?= $(BUILD) diff --git a/contrib/depends/funcs.mk b/contrib/depends/funcs.mk index 2d6b37190..ffda2b5b2 100644 --- a/contrib/depends/funcs.mk +++ b/contrib/depends/funcs.mk @@ -32,7 +32,7 @@ endef define fetch_file ( test -f $$($(1)_source_dir)/$(4) || \ ( $(call fetch_file_inner,$(1),$(2),$(3),$(4),$(5)) || \ - $(call fetch_file_inner,$(1),$(FALLBACK_DOWNLOAD_PATH),$(3),$(4),$(5)))) + $(call fetch_file_inner,$(1),$(FALLBACK_DOWNLOAD_PATH),$(4),$(4),$(5)))) endef define int_get_build_recipe_hash diff --git a/contrib/depends/packages/eudev.mk b/contrib/depends/packages/eudev.mk index 0e930df93..6b6887e98 100644 --- a/contrib/depends/packages/eudev.mk +++ b/contrib/depends/packages/eudev.mk @@ -1,7 +1,8 @@ package=eudev $(package)_version=v3.2.6 $(package)_download_path=https://github.com/gentoo/eudev/archive/ -$(package)_file_name=$($(package)_version).tar.gz +$(package)_download_file=$($(package)_version).tar.gz +$(package)_file_name=$(package)-$($(package)_version).tar.gz $(package)_sha256_hash=a96ecb8637667897b8bd4dee4c22c7c5f08b327be45186e912ce6bc768385852 define $(package)_set_vars diff --git a/contrib/depends/packages/gtest.mk b/contrib/depends/packages/gtest.mk index 5df07a32e..1208d7c03 100644 --- a/contrib/depends/packages/gtest.mk +++ b/contrib/depends/packages/gtest.mk @@ -1,7 +1,8 @@ package=gtest $(package)_version=1.8.1 $(package)_download_path=https://github.com/google/googletest/archive/ -$(package)_file_name=release-$($(package)_version).tar.gz +$(package)_download_file=release-$($(package)_version).tar.gz +$(package)_file_name=$(package)-$($(package)_version).tar.gz $(package)_sha256_hash=9bf1fe5182a604b4135edc1a425ae356c9ad15e9b23f9f12a02e80184c3a249c $(package)_cxxflags=-std=c++11 $(package)_cxxflags_linux=-fPIC diff --git a/contrib/depends/packages/native_cctools.mk b/contrib/depends/packages/native_cctools.mk index 8bf71254f..64a72e484 100644 --- a/contrib/depends/packages/native_cctools.mk +++ b/contrib/depends/packages/native_cctools.mk @@ -1,7 +1,8 @@ package=native_cctools $(package)_version=807d6fd1be5d2224872e381870c0a75387fe05e6 $(package)_download_path=https://github.com/theuni/cctools-port/archive -$(package)_file_name=$($(package)_version).tar.gz +$(package)_download_file=$($(package)_version).tar.gz +$(package)_file_name=$(package)-$($(package)_version).tar.gz $(package)_sha256_hash=a09c9ba4684670a0375e42d9d67e7f12c1f62581a27f28f7c825d6d7032ccc6a $(package)_build_subdir=cctools $(package)_clang_version=3.7.1 -- cgit v1.2.3 From db564efe0b35b036205778225bfe3557f24a70a5 Mon Sep 17 00:00:00 2001 From: selsta Date: Wed, 23 Jun 2021 20:43:19 +0200 Subject: wallet_api: fix typo in exportKeyImages --- src/wallet/api/wallet.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wallet/api/wallet.cpp b/src/wallet/api/wallet.cpp index b2ffce229..ff10eb519 100644 --- a/src/wallet/api/wallet.cpp +++ b/src/wallet/api/wallet.cpp @@ -1178,7 +1178,7 @@ bool WalletImpl::exportKeyImages(const string &filename, bool all) try { - if (!m_wallet->export_key_images(filename), all) + if (!m_wallet->export_key_images(filename, all)) { setStatusError(tr("failed to save file ") + filename); return false; -- cgit v1.2.3 From 2e9af2a1c8092c804bb2d32fba0c72fc5de47564 Mon Sep 17 00:00:00 2001 From: selsta Date: Wed, 12 May 2021 21:32:51 +0200 Subject: cmake: treat warnings as error in compiler flag tests --- CMakeLists.txt | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 66f4d0363..362ca8d56 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -71,16 +71,18 @@ function (die msg) endfunction () function (add_c_flag_if_supported flag var) - string(REPLACE "-" "_" supported ${flag}_c) - check_c_compiler_flag(${flag} ${supported}) + set(TMP "-Werror ${flag}") + string(REGEX REPLACE "[- ]" "_" supported ${TMP}_c) + check_c_compiler_flag(${TMP} ${supported}) if(${${supported}}) set(${var} "${${var}} ${flag}" PARENT_SCOPE) endif() endfunction() function (add_cxx_flag_if_supported flag var) - string(REPLACE "-" "_" supported ${flag}_cxx) - check_cxx_compiler_flag(${flag} ${supported}) + set(TMP "-Werror ${flag}") + string(REGEX REPLACE "[- ]" "_" supported ${TMP}_cxx) + check_cxx_compiler_flag(${TMP} ${supported}) if(${${supported}}) set(${var} "${${var}} ${flag}" PARENT_SCOPE) endif() -- cgit v1.2.3 From 1565bcb1fb17ff632209994fbb7f2649e04819ab Mon Sep 17 00:00:00 2001 From: selsta Date: Sun, 9 May 2021 22:22:17 +0200 Subject: epee: include public openssl header in cmake --- contrib/epee/src/CMakeLists.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/contrib/epee/src/CMakeLists.txt b/contrib/epee/src/CMakeLists.txt index 6e0af6730..5640f5bb0 100644 --- a/contrib/epee/src/CMakeLists.txt +++ b/contrib/epee/src/CMakeLists.txt @@ -72,3 +72,9 @@ if (USE_READLINE AND (GNU_READLINE_FOUND OR (DEPENDS AND NOT MINGW))) PRIVATE ${GNU_READLINE_LIBRARY}) endif() + +target_include_directories(epee + PUBLIC + "${EPEE_INCLUDE_DIR_BASE}" + "${OPENSSL_INCLUDE_DIR}") + -- cgit v1.2.3 From 402ba046e02a552c42a384d0512f93523be67928 Mon Sep 17 00:00:00 2001 From: selsta Date: Sun, 9 May 2021 01:24:34 +0200 Subject: cmake: use CMAKE_CURRENT_LIST_DIR in FindLibUSB --- cmake/FindLibUSB.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/FindLibUSB.cmake b/cmake/FindLibUSB.cmake index 79d8fba75..6944c6c45 100644 --- a/cmake/FindLibUSB.cmake +++ b/cmake/FindLibUSB.cmake @@ -134,7 +134,7 @@ if ( LibUSB_FOUND ) try_compile(LibUSB_COMPILE_TEST_PASSED ${CMAKE_BINARY_DIR} - "${CMAKE_SOURCE_DIR}/cmake/test-libusb-version.c" + "${CMAKE_CURRENT_LIST_DIR}/test-libusb-version.c" CMAKE_FLAGS "-DINCLUDE_DIRECTORIES=${LibUSB_INCLUDE_DIRS}" "-DLINK_DIRECTORIES=${LibUSB_LIBRARIES}" -- cgit v1.2.3 From 67ba733de173008a94e6fcb1b4bf8549acbe81ec Mon Sep 17 00:00:00 2001 From: xiphon Date: Wed, 27 Jan 2021 13:04:08 +0000 Subject: unit_tests: fix wipeable_string parse_hexstr test with latest gtest https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=973196 --- tests/unit_tests/wipeable_string.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/tests/unit_tests/wipeable_string.cpp b/tests/unit_tests/wipeable_string.cpp index 9911bd6f4..0e0bf8906 100644 --- a/tests/unit_tests/wipeable_string.cpp +++ b/tests/unit_tests/wipeable_string.cpp @@ -189,20 +189,20 @@ TEST(wipeable_string, parse_hexstr) { boost::optional s; - ASSERT_EQ(boost::none, epee::wipeable_string("x").parse_hexstr()); - ASSERT_EQ(boost::none, epee::wipeable_string("x0000000000000000").parse_hexstr()); - ASSERT_EQ(boost::none, epee::wipeable_string("0000000000000000x").parse_hexstr()); - ASSERT_EQ(boost::none, epee::wipeable_string("0").parse_hexstr()); - ASSERT_EQ(boost::none, epee::wipeable_string("000").parse_hexstr()); + ASSERT_TRUE(boost::none == epee::wipeable_string("x").parse_hexstr()); + ASSERT_TRUE(boost::none == epee::wipeable_string("x0000000000000000").parse_hexstr()); + ASSERT_TRUE(boost::none == epee::wipeable_string("0000000000000000x").parse_hexstr()); + ASSERT_TRUE(boost::none == epee::wipeable_string("0").parse_hexstr()); + ASSERT_TRUE(boost::none == epee::wipeable_string("000").parse_hexstr()); ASSERT_TRUE((s = epee::wipeable_string("").parse_hexstr()) != boost::none); - ASSERT_EQ(*s, ""); + ASSERT_TRUE(*s == ""); ASSERT_TRUE((s = epee::wipeable_string("00").parse_hexstr()) != boost::none); - ASSERT_EQ(*s, epee::wipeable_string("", 1)); + ASSERT_TRUE(*s == epee::wipeable_string("", 1)); ASSERT_TRUE((s = epee::wipeable_string("41").parse_hexstr()) != boost::none); - ASSERT_EQ(*s, epee::wipeable_string("A")); + ASSERT_TRUE(*s == epee::wipeable_string("A")); ASSERT_TRUE((s = epee::wipeable_string("414243").parse_hexstr()) != boost::none); - ASSERT_EQ(*s, epee::wipeable_string("ABC")); + ASSERT_TRUE(*s == epee::wipeable_string("ABC")); } TEST(wipeable_string, to_hex) -- cgit v1.2.3 From 76824bf827e06a1b20847c65f1c4fbdabb0c79f7 Mon Sep 17 00:00:00 2001 From: Alex Opie Date: Fri, 22 Jan 2021 11:38:18 +1300 Subject: Stop adding more outputs than bulletproof allows If more outputs are requested, they are split across multiple transactions. #7322 --- src/wallet/wallet2.cpp | 42 +++++++++++++++++++++++++++++++++++------- 1 file changed, 35 insertions(+), 7 deletions(-) diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp index 642777797..61c2b705b 100644 --- a/src/wallet/wallet2.cpp +++ b/src/wallet/wallet2.cpp @@ -9768,13 +9768,18 @@ std::vector wallet2::create_transactions_2(std::vector::iterator i; i = std::find_if(dsts.begin(), dsts.end(), [&](const cryptonote::tx_destination_entry &d) { return !memcmp (&d.addr, &de.addr, sizeof(de.addr)); }); if (i == dsts.end()) { + if (dsts.size() >= max_dsts) + return false; dsts.push_back(de); i = dsts.end() - 1; i->amount = 0; @@ -9787,12 +9792,15 @@ std::vector wallet2::create_transactions_2(std::vector " + std::to_string(dsts.size())); if (original_output_index == dsts.size()) { + if (dsts.size() >= max_dsts) + return false; dsts.push_back(de); dsts.back().amount = 0; } THROW_WALLET_EXCEPTION_IF(memcmp(&dsts[original_output_index].addr, &de.addr, sizeof(de.addr)), error::wallet_internal_error, "Mismatched destination address"); dsts[original_output_index].amount += amount; } + return true; } }; std::vector txes; @@ -10062,6 +10070,7 @@ std::vector wallet2::create_transactions_2(std::vector wallet2::create_transactions_2(std::vector 0 && !dsts.empty() && estimate_tx_weight(use_rct, tx.selected_transfers.size(), fake_outs_count, tx.dsts.size()+1, extra.size(), bulletproof, clsag) < TX_WEIGHT_TARGET(upper_transaction_weight_limit)) { + if (!out_slots_exhausted && available_amount > 0 && !dsts.empty() && estimate_tx_weight(use_rct, tx.selected_transfers.size(), fake_outs_count, tx.dsts.size()+1, extra.size(), bulletproof, clsag) < TX_WEIGHT_TARGET(upper_transaction_weight_limit)) { // we can partially fill that destination LOG_PRINT_L2("We can partially pay " << get_account_address_as_str(m_nettype, dsts[0].is_subaddress, dsts[0].addr) << " for " << print_money(available_amount) << "/" << print_money(dsts[0].amount)); - tx.add(dsts[0], available_amount, original_output_index, m_merge_destinations); - dsts[0].amount -= available_amount; - available_amount = 0; + if (tx.add(dsts[0], available_amount, original_output_index, m_merge_destinations, BULLETPROOF_MAX_OUTPUTS-1)) + { + dsts[0].amount -= available_amount; + available_amount = 0; + } + else + { + LOG_PRINT_L2("Didn't pay: ran out of output slots"); + out_slots_exhausted = true; + } } } @@ -10095,8 +10116,15 @@ std::vector wallet2::create_transactions_2(std::vector Date: Wed, 28 Jul 2021 00:38:54 +0200 Subject: blocks: fix cmake syntax --- src/blocks/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/blocks/CMakeLists.txt b/src/blocks/CMakeLists.txt index 071ccd506..5eebaaa03 100644 --- a/src/blocks/CMakeLists.txt +++ b/src/blocks/CMakeLists.txt @@ -53,7 +53,7 @@ foreach(BLOB_NAME checkpoints testnet_blocks stagenet_blocks) "-DINPUT_DAT_FILE=${CMAKE_CURRENT_SOURCE_DIR}/${INPUT_DAT_FILE}" "-DBLOB_NAME=${BLOB_NAME}" "-DOUTPUT_C_SOURCE=${CMAKE_CURRENT_BINARY_DIR}/${OUTPUT_C_SOURCE}" - "-P${GENERATOR}" + -P "${GENERATOR}" ) endforeach() -- cgit v1.2.3 From a395f363e79f1886c8cfd8ff2f45c171a64da39b Mon Sep 17 00:00:00 2001 From: selsta Date: Mon, 26 Apr 2021 19:54:25 +0200 Subject: depends, docker: fix bintray links --- Dockerfile | 2 +- contrib/depends/packages/boost.mk | 2 +- utils/build_scripts/android32.Dockerfile | 2 +- utils/build_scripts/android64.Dockerfile | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 61bbd76f2..54a261a2a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -46,7 +46,7 @@ ARG BOOST_VERSION=1_70_0 ARG BOOST_VERSION_DOT=1.70.0 ARG BOOST_HASH=430ae8354789de4fd19ee52f3b1f739e1fba576f0aded0897c3c2bc00fb38778 RUN set -ex \ - && curl -s -L -o boost_${BOOST_VERSION}.tar.bz2 https://dl.bintray.com/boostorg/release/${BOOST_VERSION_DOT}/source/boost_${BOOST_VERSION}.tar.bz2 \ + && curl -s -L -o boost_${BOOST_VERSION}.tar.bz2 https://downloads.sourceforge.net/project/boost/boost/${BOOST_VERSION_DOT}/boost_${BOOST_VERSION}.tar.bz2 \ && echo "${BOOST_HASH} boost_${BOOST_VERSION}.tar.bz2" | sha256sum -c \ && tar -xvf boost_${BOOST_VERSION}.tar.bz2 \ && cd boost_${BOOST_VERSION} \ diff --git a/contrib/depends/packages/boost.mk b/contrib/depends/packages/boost.mk index 0d241928e..4571d4232 100644 --- a/contrib/depends/packages/boost.mk +++ b/contrib/depends/packages/boost.mk @@ -1,6 +1,6 @@ package=boost $(package)_version=1_64_0 -$(package)_download_path=https://dl.bintray.com/boostorg/release/1.64.0/source/ +$(package)_download_path=https://downloads.sourceforge.net/project/boost/boost/1.64.0/ $(package)_file_name=$(package)_$($(package)_version).tar.bz2 $(package)_sha256_hash=7bcc5caace97baa948931d712ea5f37038dbb1c5d89b43ad4def4ed7cb683332 $(package)_dependencies=libiconv diff --git a/utils/build_scripts/android32.Dockerfile b/utils/build_scripts/android32.Dockerfile index a2d0edbb3..c0931ce05 100644 --- a/utils/build_scripts/android32.Dockerfile +++ b/utils/build_scripts/android32.Dockerfile @@ -44,7 +44,7 @@ ARG BOOST_VERSION=1_68_0 ARG BOOST_VERSION_DOT=1.68.0 ARG BOOST_HASH=7f6130bc3cf65f56a618888ce9d5ea704fa10b462be126ad053e80e553d6d8b7 RUN set -ex \ - && curl -s -L -o boost_${BOOST_VERSION}.tar.bz2 https://dl.bintray.com/boostorg/release/${BOOST_VERSION_DOT}/source/boost_${BOOST_VERSION}.tar.bz2 \ + && curl -s -L -o boost_${BOOST_VERSION}.tar.bz2 https://downloads.sourceforge.net/project/boost/boost/${BOOST_VERSION_DOT}/boost_${BOOST_VERSION}.tar.bz2 \ && echo "${BOOST_HASH} boost_${BOOST_VERSION}.tar.bz2" | sha256sum -c \ && tar -xvf boost_${BOOST_VERSION}.tar.bz2 \ && rm -f boost_${BOOST_VERSION}.tar.bz2 \ diff --git a/utils/build_scripts/android64.Dockerfile b/utils/build_scripts/android64.Dockerfile index eca2d4da1..3a62da464 100644 --- a/utils/build_scripts/android64.Dockerfile +++ b/utils/build_scripts/android64.Dockerfile @@ -44,7 +44,7 @@ ARG BOOST_VERSION=1_68_0 ARG BOOST_VERSION_DOT=1.68.0 ARG BOOST_HASH=7f6130bc3cf65f56a618888ce9d5ea704fa10b462be126ad053e80e553d6d8b7 RUN set -ex \ - && curl -s -L -o boost_${BOOST_VERSION}.tar.bz2 https://dl.bintray.com/boostorg/release/${BOOST_VERSION_DOT}/source/boost_${BOOST_VERSION}.tar.bz2 \ + && curl -s -L -o boost_${BOOST_VERSION}.tar.bz2 https://downloads.sourceforge.net/project/boost/boost/${BOOST_VERSION_DOT}/boost_${BOOST_VERSION}.tar.bz2 \ && echo "${BOOST_HASH} boost_${BOOST_VERSION}.tar.bz2" | sha256sum -c \ && tar -xvf boost_${BOOST_VERSION}.tar.bz2 \ && rm -f boost_${BOOST_VERSION}.tar.bz2 \ -- cgit v1.2.3 From d188b5f51f088d5740b0c9a8dda99bc2ee92b51b Mon Sep 17 00:00:00 2001 From: tobtoht Date: Fri, 4 Jun 2021 18:59:33 +0200 Subject: wallet_api: getPassword --- src/wallet/api/wallet.cpp | 5 +++++ src/wallet/api/wallet.h | 1 + src/wallet/api/wallet2_api.h | 1 + 3 files changed, 7 insertions(+) diff --git a/src/wallet/api/wallet.cpp b/src/wallet/api/wallet.cpp index ff10eb519..94edba213 100644 --- a/src/wallet/api/wallet.cpp +++ b/src/wallet/api/wallet.cpp @@ -839,6 +839,11 @@ bool WalletImpl::setPassword(const std::string &password) return status() == Status_Ok; } +const std::string& WalletImpl::getPassword() const +{ + return m_password; +} + bool WalletImpl::setDevicePin(const std::string &pin) { clearStatus(); diff --git a/src/wallet/api/wallet.h b/src/wallet/api/wallet.h index ce2d7d7e4..b53548951 100644 --- a/src/wallet/api/wallet.h +++ b/src/wallet/api/wallet.h @@ -89,6 +89,7 @@ public: std::string errorString() const override; void statusWithErrorString(int& status, std::string& errorString) const override; bool setPassword(const std::string &password) override; + const std::string& getPassword() const override; bool setDevicePin(const std::string &password) override; bool setDevicePassphrase(const std::string &password) override; std::string address(uint32_t accountIndex = 0, uint32_t addressIndex = 0) const override; diff --git a/src/wallet/api/wallet2_api.h b/src/wallet/api/wallet2_api.h index e34332734..35516b35d 100644 --- a/src/wallet/api/wallet2_api.h +++ b/src/wallet/api/wallet2_api.h @@ -456,6 +456,7 @@ struct Wallet //! returns both error and error string atomically. suggested to use in instead of status() and errorString() virtual void statusWithErrorString(int& status, std::string& errorString) const = 0; virtual bool setPassword(const std::string &password) = 0; + virtual const std::string& getPassword() const = 0; virtual bool setDevicePin(const std::string &pin) { (void)pin; return false; }; virtual bool setDevicePassphrase(const std::string &passphrase) { (void)passphrase; return false; }; virtual std::string address(uint32_t accountIndex = 0, uint32_t addressIndex = 0) const = 0; -- cgit v1.2.3 From 49beb8da17ff2700ef96eddf9fca9f94ee3582a1 Mon Sep 17 00:00:00 2001 From: tobtoht Date: Fri, 4 Jun 2021 15:02:06 +0200 Subject: ledger: use software device if we have view key --- src/device/device_ledger.cpp | 14 ++++++++++++-- src/device/device_ledger.hpp | 5 +---- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/device/device_ledger.cpp b/src/device/device_ledger.cpp index 3e0afeb65..b7c6fe94d 100644 --- a/src/device/device_ledger.cpp +++ b/src/device/device_ledger.cpp @@ -529,9 +529,7 @@ namespace hw { } bool device_ledger::init(void) { - #ifdef DEBUG_HWDEVICE this->controle_device = &hw::get_device("default"); - #endif this->release(); hw_device.init(); MDEBUG( "Device "<id <<" HIDUSB inited"); @@ -750,6 +748,12 @@ namespace hw { } crypto::public_key device_ledger::get_subaddress_spend_public_key(const cryptonote::account_keys& keys, const cryptonote::subaddress_index &index) { + if (has_view_key) { + cryptonote::account_keys keys_{keys}; + keys_.m_view_secret_key = this->viewkey; + return this->controle_device->get_subaddress_spend_public_key(keys_, index); + } + AUTO_LOCK_CMD(); crypto::public_key D; @@ -801,6 +805,12 @@ namespace hw { } cryptonote::account_public_address device_ledger::get_subaddress(const cryptonote::account_keys& keys, const cryptonote::subaddress_index &index) { + if (has_view_key) { + cryptonote::account_keys keys_{keys}; + keys_.m_view_secret_key = this->viewkey; + return this->controle_device->get_subaddress(keys_, index); + } + AUTO_LOCK_CMD(); cryptonote::account_public_address address; diff --git a/src/device/device_ledger.hpp b/src/device/device_ledger.hpp index 5abfaf2be..c9aadbd00 100644 --- a/src/device/device_ledger.hpp +++ b/src/device/device_ledger.hpp @@ -192,11 +192,8 @@ namespace hw { // To speed up blockchain parsing the view key maybe handle here. crypto::secret_key viewkey; bool has_view_key; - - //extra debug - #ifdef DEBUG_HWDEVICE + device *controle_device; - #endif public: device_ledger(); -- cgit v1.2.3 From 3c23aca26bc28eab43496741845b290bb24e55b1 Mon Sep 17 00:00:00 2001 From: tobtoht Date: Fri, 4 Jun 2021 17:41:42 +0200 Subject: ledger: don't lock for software device --- src/device/device_ledger.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/device/device_ledger.cpp b/src/device/device_ledger.cpp index b7c6fe94d..f83ed1e48 100644 --- a/src/device/device_ledger.cpp +++ b/src/device/device_ledger.cpp @@ -695,7 +695,6 @@ namespace hw { /* ======================================================================= */ bool device_ledger::derive_subaddress_public_key(const crypto::public_key &pub, const crypto::key_derivation &derivation, const std::size_t output_index, crypto::public_key &derived_pub){ - AUTO_LOCK_CMD(); #ifdef DEBUG_HWDEVICE const crypto::public_key pub_x = pub; crypto::key_derivation derivation_x; @@ -719,7 +718,7 @@ namespace hw { MDEBUG( "derive_subaddress_public_key : PARSE mode with known viewkey"); crypto::derive_subaddress_public_key(pub, derivation, output_index,derived_pub); } else { - + AUTO_LOCK_CMD(); int offset = set_command_header_noopt(INS_DERIVE_SUBADDRESS_PUBLIC_KEY); //pub memmove(this->buffer_send+offset, pub.data, 32); @@ -1059,7 +1058,6 @@ namespace hw { } bool device_ledger::generate_key_derivation(const crypto::public_key &pub, const crypto::secret_key &sec, crypto::key_derivation &derivation) { - AUTO_LOCK_CMD(); bool r = false; #ifdef DEBUG_HWDEVICE @@ -1080,6 +1078,7 @@ namespace hw { assert(is_fake_view_key(sec)); r = crypto::generate_key_derivation(pub, this->viewkey, derivation); } else { + AUTO_LOCK_CMD(); int offset = set_command_header_noopt(INS_GEN_KEY_DERIVATION); //pub memmove(this->buffer_send+offset, pub.data, 32); -- cgit v1.2.3 From 94bad34c26c8da8e727dfb991f01ebb0cb12c014 Mon Sep 17 00:00:00 2001 From: tobtoht Date: Tue, 13 Jul 2021 19:01:55 +0200 Subject: wallet2: Don't auto lock device on process parsed blocks --- src/wallet/wallet2.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp index 61c2b705b..d5befdaaf 100644 --- a/src/wallet/wallet2.cpp +++ b/src/wallet/wallet2.cpp @@ -2734,9 +2734,8 @@ void wallet2::process_parsed_blocks(uint64_t start_height, const std::vector hwdev_lock(hwdev); for (auto &iod: slot.primary) gender(iod); for (auto &iod: slot.additional) -- cgit v1.2.3 From 8dbe2e57ac0ecef7601c1f74065cfdb1811d58d1 Mon Sep 17 00:00:00 2001 From: rbrunner7 Date: Tue, 27 Jul 2021 13:45:55 +0200 Subject: Daemon: Update average block size table --- src/common/util.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/common/util.cpp b/src/common/util.cpp index 9dffe6ebe..66875319e 100644 --- a/src/common/util.cpp +++ b/src/common/util.cpp @@ -1355,8 +1355,12 @@ std::string get_nix_version_display_string() 100743, 92152, 57565, 22533, 37564, 21823, 19980, 18277, 18402, 14344, 12142, 15842, 13677, 17631, 18294, 22270, 41422, 39296, 36688, 33512, 33831, 27582, 22276, 27516, 27317, 25505, 24426, 20566, 23045, 26766, - 28185, 26169, 27011, - 28642 // Blocks 1,990,000 to 1,999,999 in December 2019 + 28185, 26169, 27011, 28642, 34994, 34442, 30682, 34357, 31640, 41167, + 41301, 48616, 51075, 55061, 49909, 44606, 47091, 53828, 42520, 39023, + 55245, 56145, 51119, 60398, 71821, 48142, 60310, 56041, 54176, 66220, + 56336, 55248, 56656, 63305, 54029, 77136, 71902, 71618, 83587, 81068, + 69062, 54848, 53681, 53555, + 50616 // Blocks 2,400,000 to 2,409,999 in July 2021 }; const uint64_t block_range_size = 10000; -- cgit v1.2.3 From f0fa959383e1fead039817d008efd39943a6c1e8 Mon Sep 17 00:00:00 2001 From: anon Date: Tue, 16 Mar 2021 13:41:15 +0000 Subject: cmake: fix ccache detection --- cmake/FindCcache.cmake | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/cmake/FindCcache.cmake b/cmake/FindCcache.cmake index a0734a312..f7b1b8425 100644 --- a/cmake/FindCcache.cmake +++ b/cmake/FindCcache.cmake @@ -42,12 +42,19 @@ find_program(CCACHE_FOUND ccache) if (CCACHE_FOUND) # Try to compile a test program with ccache, in order to verify if it really works. (needed on exotic setups) - # Create a temporary file with a simple program. - set(TEMP_CPP_FILE "${CMAKE_BINARY_DIR}/${CMAKE_FILES_DIRECTORY}/CMakeTmp/test-program.cpp") - file(WRITE "${TEMP_CPP_FILE}" "int main() { return 0; }") - # And run the found ccache on it. - execute_process(COMMAND "${CCACHE_FOUND}" "${CMAKE_CXX_COMPILER}" "${TEMP_CPP_FILE}" RESULT_VARIABLE RET) - if (${RET} EQUAL 0) + set(TEST_PROJECT "${CMAKE_BINARY_DIR}/${CMAKE_FILES_DIRECTORY}/CMakeTmp") + file(WRITE "${TEST_PROJECT}/CMakeLists.txt" [=[ +cmake_minimum_required(VERSION 3.1) +project(test) +option (CCACHE "") +file(WRITE "${CMAKE_SOURCE_DIR}/test.cpp" "int main() { return 0; }") +set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "${CCACHE}") +set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK "${CCACHE}") +add_executable(test test.cpp) +]=]) + try_compile(RET "${TEST_PROJECT}/build" "${TEST_PROJECT}" "test" CMAKE_FLAGS -DCCACHE="${CCACHE_FOUND}") + unset(TEST_PROJECT) + if (${RET}) # Success message(STATUS "Found usable ccache: ${CCACHE_FOUND}") set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "${CCACHE_FOUND}") -- cgit v1.2.3 From ccfed6008a180344771dbf670db2705422d7c651 Mon Sep 17 00:00:00 2001 From: selsta Date: Thu, 15 Jul 2021 09:30:32 +0200 Subject: cmake: test is a reserved keyword --- cmake/FindCcache.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/FindCcache.cmake b/cmake/FindCcache.cmake index f7b1b8425..164ddf601 100644 --- a/cmake/FindCcache.cmake +++ b/cmake/FindCcache.cmake @@ -50,7 +50,7 @@ option (CCACHE "") file(WRITE "${CMAKE_SOURCE_DIR}/test.cpp" "int main() { return 0; }") set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "${CCACHE}") set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK "${CCACHE}") -add_executable(test test.cpp) +add_executable(main test.cpp) ]=]) try_compile(RET "${TEST_PROJECT}/build" "${TEST_PROJECT}" "test" CMAKE_FLAGS -DCCACHE="${CCACHE_FOUND}") unset(TEST_PROJECT) -- cgit v1.2.3