diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 2e142475..42dc142d 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -130,6 +130,41 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + build-ubuntu20-clang: + name: Ubuntu 20.04 clang + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@master + + - name: Build + id: build + run: | + sudo apt-get update + sudo apt-get install -y libboost-all-dev clang + build_folder="build/debug" + ccx_version=${GITHUB_SHA::7} + ccx_ver_folder=$(echo $ccx_version | sed 's/\.//g') + release_name=ccx-cli-ubuntu-2004-clang-dev"$ccx_version" + mkdir -p "$build_folder" + cd "$build_folder" + cmake ../.. -DCMAKE_BUILD_TYPE=Debug + make -j2 + mkdir -p "$release_name" + exeFiles=() + for f in src/*; do [[ -x $f && -f $f ]] && exeFiles+=( "$f" ); done + strip "${exeFiles[@]}" + cp "${exeFiles[@]}" "$release_name/" + echo "::set-output name=release_name::${release_name}.zip" + echo "::set-output name=artifact_path::$build_folder/$release_name" + + - name: Upload To GH Artifacts + uses: actions/upload-artifact@v1.0.0 + with: + name: ${{ steps.build.outputs.release_name }} + path: ${{ steps.build.outputs.artifact_path }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + build-macos: name: macOS runs-on: macos-latest diff --git a/CMakeLists.txt b/CMakeLists.txt index fd92dc56..706a5568 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -271,6 +271,7 @@ endif() if(BUILD_TESTS) add_subdirectory(tests) + add_subdirectory(external/gtest) enable_testing() endif() diff --git a/src/Common/FileMappedVector.h b/src/Common/FileMappedVector.h index fa2dc38d..19f66fe7 100644 --- a/src/Common/FileMappedVector.h +++ b/src/Common/FileMappedVector.h @@ -759,7 +759,7 @@ void FileMappedVector::rename(const std::string& newPath) { template template void FileMappedVector::atomicUpdate(F&& func) { - atomicUpdate0(capacity(), prefixSize(), suffixSize(), std::move(func)); + atomicUpdate0(capacity(), prefixSize(), suffixSize(), std::forward(func)); } template diff --git a/src/Common/Varint.h b/src/Common/Varint.h index f24800e0..6f50af57 100644 --- a/src/Common/Varint.h +++ b/src/Common/Varint.h @@ -59,6 +59,6 @@ namespace Tools { template int read_varint(InputIt &&first, InputIt &&last, T &i) { - return read_varint::digits, InputIt, T>(std::move(first), std::move(last), i); + return read_varint::digits, InputIt, T>(std::forward(first), std::forward(last), i); } } diff --git a/src/CryptoNoteCore/BlockIndex.cpp b/src/CryptoNoteCore/BlockIndex.cpp index 8ae3f460..25a795f2 100644 --- a/src/CryptoNoteCore/BlockIndex.cpp +++ b/src/CryptoNoteCore/BlockIndex.cpp @@ -43,19 +43,23 @@ namespace CryptoNote { return false; } - std::vector BlockIndex::buildSparseChain(const Crypto::Hash& startBlockId) const { + std::vector BlockIndex::buildSparseChain(const Crypto::Hash &startBlockId) const + { assert(m_index.count(startBlockId) > 0); uint32_t startBlockHeight; - getBlockHeight(startBlockId, startBlockHeight); - std::vector result; - size_t sparseChainEnd = static_cast(startBlockHeight + 1); - for (size_t i = 1; i <= sparseChainEnd; i *= 2) { - result.emplace_back(m_container[sparseChainEnd - i]); + if (getBlockHeight(startBlockId, startBlockHeight)) + { + size_t sparseChainEnd = static_cast(startBlockHeight + 1); + for (size_t i = 1; i <= sparseChainEnd; i *= 2) + { + result.emplace_back(m_container[sparseChainEnd - i]); + } } - if (result.back() != m_container[0]) { + if (result.back() != m_container[0]) + { result.emplace_back(m_container[0]); } diff --git a/src/CryptoNoteCore/Blockchain.cpp b/src/CryptoNoteCore/Blockchain.cpp index fb131d01..7835fe51 100644 --- a/src/CryptoNoteCore/Blockchain.cpp +++ b/src/CryptoNoteCore/Blockchain.cpp @@ -664,11 +664,11 @@ namespace CryptoNote Crypto::Hash blockHash = get_block_hash(block.bl); m_blockIndex.push(blockHash); uint64_t interest = 0; - for (uint16_t t = 0; t < block.transactions.size(); ++t) + for (uint32_t t = 0; t < block.transactions.size(); ++t) { const TransactionEntry &transaction = block.transactions[t]; Crypto::Hash transactionHash = getObjectHash(transaction.tx); - TransactionIndex transactionIndex = {b, t}; + TransactionIndex transactionIndex = {b, static_cast(t)}; m_transactionMap.insert(std::make_pair(transactionHash, transactionIndex)); // process inputs @@ -686,7 +686,7 @@ namespace CryptoNote } // process outputs - for (uint16_t o = 0; o < transaction.tx.outputs.size(); ++o) + for (uint32_t o = 0; o < transaction.tx.outputs.size(); ++o) { const auto &out = transaction.tx.outputs[o]; if (out.target.type() == typeid(KeyOutput)) @@ -695,7 +695,7 @@ namespace CryptoNote } else if (out.target.type() == typeid(MultisignatureOutput)) { - MultisignatureOutputUsage usage = {transactionIndex, o, false}; + MultisignatureOutputUsage usage = {transactionIndex, static_cast(o), false}; m_multisignatureOutputs[out.amount].push_back(usage); } } @@ -2740,7 +2740,7 @@ namespace CryptoNote } transaction.m_global_output_indexes.resize(transaction.tx.outputs.size()); - for (uint16_t output = 0; output < transaction.tx.outputs.size(); ++output) + for (uint32_t output = 0; output < transaction.tx.outputs.size(); ++output) { if (transaction.tx.outputs[output].target.type() == typeid(KeyOutput)) { @@ -2752,7 +2752,7 @@ namespace CryptoNote { auto &amountOutputs = m_multisignatureOutputs[transaction.tx.outputs[output].amount]; transaction.m_global_output_indexes[output] = static_cast(amountOutputs.size()); - MultisignatureOutputUsage outputUsage = {transactionIndex, output, false}; + MultisignatureOutputUsage outputUsage = {transactionIndex, static_cast(output), false}; amountOutputs.push_back(outputUsage); } } @@ -3156,7 +3156,7 @@ namespace CryptoNote const BlockEntry &block = m_blocks[b]; m_timestampIndex.add(block.bl.timestamp, get_block_hash(block.bl)); m_generatedTransactionsIndex.add(block.bl); - for (uint16_t t = 0; t < block.transactions.size(); ++t) + for (size_t t = 0; t < block.transactions.size(); ++t) { const TransactionEntry &transaction = block.transactions[t]; m_paymentIdIndex.add(transaction.tx); diff --git a/src/CryptoNoteCore/Core.h b/src/CryptoNoteCore/Core.h index 77f8eabe..08b5ec96 100644 --- a/src/CryptoNoteCore/Core.h +++ b/src/CryptoNoteCore/Core.h @@ -34,7 +34,7 @@ namespace CryptoNote { class core : public ICore, public IMinerHandler, public IBlockchainStorageObserver, public ITxPoolObserver { public: - core(const Currency ¤cy, i_cryptonote_protocol *pprotocol, Logging::ILogger &logger, bool blockchainIndexesEnabled, bool blockchainAutosaveEnabled); + core(const Currency ¤cy, i_cryptonote_protocol *pprotocol, Logging::ILogger &logger, bool blockchainIndexesEnabled = false, bool blockchainAutosaveEnabled = false); ~core(); bool on_idle() override; diff --git a/src/CryptoNoteCore/Currency.cpp b/src/CryptoNoteCore/Currency.cpp index 35026ecf..522b5d32 100644 --- a/src/CryptoNoteCore/Currency.cpp +++ b/src/CryptoNoteCore/Currency.cpp @@ -1092,7 +1092,12 @@ namespace CryptoNote uint64_t T = 120; // target solvetime seconds uint64_t N = 60; // N=45, 60, and 90 for T=600, 120, 60. - uint64_t L(0), ST, sum_3_ST(0), next_D, prev_D, this_timestamp, previous_timestamp; + uint64_t L = 0; + uint64_t sum_3_ST = 0; + uint64_t next_D = 0; + uint64_t prev_D; + uint64_t this_timestamp; + uint64_t previous_timestamp; // Make sure timestamps & CD vectors are not bigger than they are supposed to be. // assert(timestamps.size() == cumulative_difficulties.size() && @@ -1100,9 +1105,9 @@ namespace CryptoNote // If it's a new coin, do startup code. // Increase difficulty_guess if it needs to be much higher, but guess lower than lowest guess. - uint64_t difficulty_guess = 100; if (timestamps.size() <= 10) { + uint64_t difficulty_guess = 100; return difficulty_guess; } // Use "if" instead of "else if" in case vectors are incorrectly N all the time instead of N+1. @@ -1130,7 +1135,7 @@ namespace CryptoNote this_timestamp = previous_timestamp + 1; } // Limit solvetime ST to 6*T to prevent large drop in difficulty that could cause oscillations. - ST = std::min(6 * T, this_timestamp - previous_timestamp); + uint64_t ST = std::min(6 * T, this_timestamp - previous_timestamp); previous_timestamp = this_timestamp; L += ST * i; // give linearly higher weight to more recent solvetimes // delete the following line if you do not want the "jump rule" diff --git a/src/CryptoNoteCore/TransactionPool.cpp b/src/CryptoNoteCore/TransactionPool.cpp index 23d8bee6..4279a775 100644 --- a/src/CryptoNoteCore/TransactionPool.cpp +++ b/src/CryptoNoteCore/TransactionPool.cpp @@ -447,18 +447,47 @@ namespace CryptoNote ss << "blobSize: " << txd.blobSize << std::endl << "fee: " << m_currency.formatAmount(txd.fee) << std::endl - << "received: " << std::ctime(&txd.receiveTime); + << "received: "; + + char receivedTimeStr[32]; + struct tm receivedTimeTm; +#ifdef _WIN32 + gmtime_s(&receivedTimeTm, &txd.receiveTime); +#else + gmtime_r(&txd.receiveTime, &receivedTimeTm); +#endif + if (std::strftime(receivedTimeStr, sizeof(receivedTimeStr), "%c", &receivedTimeTm)) + { + ss << receivedTimeStr << " UTC"; + } + else + { + ss << "unable to get time"; + } + ss << std::endl; auto ttlIt = m_ttlIndex.find(txd.id); if (ttlIt != m_ttlIndex.end()) { - // ctime() returns string that ends with new line - ss << "TTL: " << std::ctime(reinterpret_cast(&ttlIt->second)); + char ttlTimeStr[32]; + struct tm ttlTimeTm; + time_t timestamp = reinterpret_cast(&ttlIt->second); +#ifdef _WIN32 + gmtime_s(&ttlTimeTm, ×tamp); +#else + gmtime_r(×tamp, &ttlTimeTm); +#endif + if (std::strftime(ttlTimeStr, sizeof(ttlTimeStr), "%c", &ttlTimeTm)) + { + ss << "TTL: " << ttlTimeStr << " UTC"; + } + else + { + ss << "TTL failed"; + } + ss << std::endl; } - - ss << std::endl; } - return ss.str(); } //--------------------------------------------------------------------------------- diff --git a/src/CryptoNoteCore/UpgradeDetector.h b/src/CryptoNoteCore/UpgradeDetector.h index 6619abf0..d75015bf 100644 --- a/src/CryptoNoteCore/UpgradeDetector.h +++ b/src/CryptoNoteCore/UpgradeDetector.h @@ -123,13 +123,21 @@ namespace CryptoNote { if (m_blockchain.size() % (60 * 60 / m_currency.difficultyTarget()) == 0) { auto interval = m_currency.difficultyTarget() * (upgradeHeight() - m_blockchain.size() + 2); + char upgradeTimeStr[32]; + struct tm upgradeTimeTm; time_t upgradeTimestamp = time(nullptr) + static_cast(interval); - struct tm* upgradeTime = localtime(&upgradeTimestamp);; - char upgradeTimeStr[40]; - strftime(upgradeTimeStr, 40, "%H:%M:%S %Y.%m.%d", upgradeTime); +#ifdef _WIN32 + gmtime_s(&upgradeTimeTm, &upgradeTimestamp); +#else + gmtime_r(&upgradeTimestamp, &upgradeTimeTm); +#endif + if (!std::strftime(upgradeTimeStr, sizeof(upgradeTimeStr), "%c", &upgradeTimeTm)) + { + throw std::runtime_error("time buffer is too small"); + } logger(Logging::TRACE, Logging::BRIGHT_GREEN) << "###### UPGRADE is going to happen after block index " << upgradeHeight() << " at about " << - upgradeTimeStr << " (in " << Common::timeIntervalToString(interval) << ")! Current last block index " << (m_blockchain.size() - 1) << + upgradeTimeStr << " UTC" << " (in " << Common::timeIntervalToString(interval) << ")! Current last block index " << (m_blockchain.size() - 1) << ", hash " << get_block_hash(m_blockchain.back().bl); } } else if (m_blockchain.size() == upgradeHeight() + 1) { @@ -198,7 +206,7 @@ namespace CryptoNote { assert(m_currency.upgradeVotingThreshold() > 0 && m_currency.upgradeVotingThreshold() <= 100); size_t voteCounter = getNumberOfVotes(height); - return m_currency.upgradeVotingThreshold() * m_currency.upgradeVotingWindow() <= 100 * voteCounter; + return (size_t) m_currency.upgradeVotingThreshold() * m_currency.upgradeVotingWindow() <= 100 * voteCounter; } private: diff --git a/src/HTTP/HttpParser.cpp b/src/HTTP/HttpParser.cpp index 1c702ed2..bec49f71 100644 --- a/src/HTTP/HttpParser.cpp +++ b/src/HTTP/HttpParser.cpp @@ -26,17 +26,30 @@ void throwIfNotGood(std::istream& stream) { namespace CryptoNote { -HttpResponse::HTTP_STATUS HttpParser::parseResponseStatusFromString(const std::string& status) { - if (status == "200 OK" || status == "200 Ok") return CryptoNote::HttpResponse::STATUS_200; - else if (status.substr(0, 4) == "401 ") return CryptoNote::HttpResponse::STATUS_401; - else if (status == "404 Not Found") return CryptoNote::HttpResponse::STATUS_404; - else if (status == "500 Internal Server Error") return CryptoNote::HttpResponse::STATUS_500; - else throw std::system_error(make_error_code(CryptoNote::error::HttpParserErrorCodes::UNEXPECTED_SYMBOL), - "Unknown HTTP status code is given"); - - return CryptoNote::HttpResponse::STATUS_200; //unaccessible -} - + HttpResponse::HTTP_STATUS HttpParser::parseResponseStatusFromString(const std::string &status) + { + if (status == "200 OK" || status == "200 Ok") + { + return CryptoNote::HttpResponse::STATUS_200; + } + else if (status.substr(0, 4) == "401 ") + { + return CryptoNote::HttpResponse::STATUS_401; + } + else if (status == "404 Not Found") + { + return CryptoNote::HttpResponse::STATUS_404; + } + else if (status == "500 Internal Server Error") + { + return CryptoNote::HttpResponse::STATUS_500; + } + else + { + throw std::system_error(make_error_code(CryptoNote::error::HttpParserErrorCodes::UNEXPECTED_SYMBOL), + "Unknown HTTP status code is given"); + } + } void HttpParser::receiveRequest(std::istream& stream, HttpRequest& request) { readWord(stream, request.method); diff --git a/src/HTTP/HttpResponse.cpp b/src/HTTP/HttpResponse.cpp index 2fb75a86..febe134d 100644 --- a/src/HTTP/HttpResponse.cpp +++ b/src/HTTP/HttpResponse.cpp @@ -10,38 +10,38 @@ namespace { -const char* getStatusString(CryptoNote::HttpResponse::HTTP_STATUS status) { - switch (status) { - case CryptoNote::HttpResponse::STATUS_200: - return "200 OK"; - case CryptoNote::HttpResponse::STATUS_401: - return "401 Unauthorized"; - case CryptoNote::HttpResponse::STATUS_404: - return "404 Not Found"; - case CryptoNote::HttpResponse::STATUS_500: - return "500 Internal Server Error"; - default: - throw std::runtime_error("Unknown HTTP status code is given"); + const char *getStatusString(CryptoNote::HttpResponse::HTTP_STATUS status) + { + switch (status) + { + case CryptoNote::HttpResponse::STATUS_200: + return "200 OK"; + case CryptoNote::HttpResponse::STATUS_401: + return "401 Unauthorized"; + case CryptoNote::HttpResponse::STATUS_404: + return "404 Not Found"; + case CryptoNote::HttpResponse::STATUS_500: + return "500 Internal Server Error"; + default: + throw std::runtime_error("Unknown HTTP status code is given"); + } } - return ""; //unaccessible -} - -const char* getErrorBody(CryptoNote::HttpResponse::HTTP_STATUS status) { - switch (status) { - case CryptoNote::HttpResponse::STATUS_401: - return "Authorization required\n"; - case CryptoNote::HttpResponse::STATUS_404: - return "Requested url is not found\n"; - case CryptoNote::HttpResponse::STATUS_500: - return "Internal server error is occurred\n"; - default: - throw std::runtime_error("Error body for given status is not available"); + const char *getErrorBody(CryptoNote::HttpResponse::HTTP_STATUS status) + { + switch (status) + { + case CryptoNote::HttpResponse::STATUS_401: + return "Authorization required\n"; + case CryptoNote::HttpResponse::STATUS_404: + return "Requested url is not found\n"; + case CryptoNote::HttpResponse::STATUS_500: + return "Internal server error is occurred\n"; + default: + throw std::runtime_error("Error body for given status is not available"); + } } - return ""; //unaccessible -} - } //namespace namespace CryptoNote { diff --git a/src/Serialization/KVBinaryInputStreamSerializer.cpp b/src/Serialization/KVBinaryInputStreamSerializer.cpp index 0b1c598e..c5c33696 100644 --- a/src/Serialization/KVBinaryInputStreamSerializer.cpp +++ b/src/Serialization/KVBinaryInputStreamSerializer.cpp @@ -130,7 +130,6 @@ JsonValue loadValue(Common::IInputStream& stream, uint8_t type) { case BIN_KV_SERIALIZE_TYPE_ARRAY: return loadArray(stream, type); default: throw std::runtime_error("Unknown data type"); - break; } } diff --git a/src/SimpleWallet/SimpleWallet.cpp b/src/SimpleWallet/SimpleWallet.cpp index 469a5dd1..36fd9368 100644 --- a/src/SimpleWallet/SimpleWallet.cpp +++ b/src/SimpleWallet/SimpleWallet.cpp @@ -14,6 +14,7 @@ #include #include #include +#include #include #include @@ -394,7 +395,7 @@ std::string makeCenteredString(size_t width, const std::string& text) { return std::string(offset, ' ') + text + std::string(width - text.size() - offset, ' '); } -const size_t TIMESTAMP_MAX_WIDTH = 19; +const size_t TIMESTAMP_MAX_WIDTH = 32; const size_t HASH_MAX_WIDTH = 64; const size_t TOTAL_AMOUNT_MAX_WIDTH = 20; const size_t FEE_MAX_WIDTH = 14; @@ -421,13 +422,21 @@ void printListTransfersItem(LoggerRef& logger, const WalletLegacyTransaction& tx char timeString[TIMESTAMP_MAX_WIDTH + 1]; time_t timestamp = static_cast(txInfo.timestamp); - if (std::strftime(timeString, sizeof(timeString), "%Y-%m-%d %H:%M:%S", std::gmtime(×tamp)) == 0) { + struct tm time; +#ifdef _WIN32 + gmtime_s(&time, ×tamp); +#else + gmtime_r(×tamp, &time); +#endif + + if (!std::strftime(timeString, sizeof(timeString), "%c", &time)) + { throw std::runtime_error("time buffer is too small"); } std::string rowColor = txInfo.totalAmount < 0 ? MAGENTA : GREEN; logger(INFO, rowColor) - << std::setw(TIMESTAMP_MAX_WIDTH) << timeString + << std::left << std::setw(TIMESTAMP_MAX_WIDTH) << timeString << " " << std::setw(HASH_MAX_WIDTH) << Common::podToHex(txInfo.hash) << " " << std::setw(TOTAL_AMOUNT_MAX_WIDTH) << currency.formatAmount(txInfo.totalAmount) << " " << std::setw(FEE_MAX_WIDTH) << currency.formatAmount(txInfo.fee) diff --git a/src/Transfers/TypeHelpers.h b/src/Transfers/TypeHelpers.h index 533b5420..8a5b3867 100644 --- a/src/Transfers/TypeHelpers.h +++ b/src/Transfers/TypeHelpers.h @@ -12,10 +12,10 @@ namespace CryptoNote { -inline bool operator==(const AccountPublicAddress &_v1, const AccountPublicAddress &_v2) { - return memcmp(&_v1, &_v2, sizeof(AccountPublicAddress)) == 0; -} - + inline bool operator==(const AccountPublicAddress &_v1, const AccountPublicAddress &_v2) + { + return _v1.spendPublicKey == _v2.spendPublicKey && _v1.viewPublicKey == _v2.viewPublicKey; + } } namespace std { diff --git a/src/crypto/chacha8.h b/src/crypto/chacha8.h index 96dacd34..a0a05c27 100644 --- a/src/crypto/chacha8.h +++ b/src/crypto/chacha8.h @@ -26,11 +26,6 @@ namespace Crypto struct chacha8_key { uint8_t data[CHACHA8_KEY_SIZE]; - - ~chacha8_key() - { - memset(data, 0, sizeof(data)); - } }; // MS VC 2012 doesn't interpret `class chacha8_iv` as POD in spite of [9.0.10], so it is a struct diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index d9ce41ff..e8995532 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -60,3 +60,8 @@ set_property(TARGET NodeRpcProxyTests PROPERTY OUTPUT_NAME "node_rpc_proxy_tests set_property(TARGET PerformanceTests PROPERTY OUTPUT_NAME "performance_tests") set_property(TARGET SystemTests PROPERTY OUTPUT_NAME "system_tests") set_property(TARGET DifficultyTests PROPERTY OUTPUT_NAME "difficulty_tests") + +if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux" OR APPLE AND NOT ANDROID) + target_link_libraries(CoreTests -lresolv) + target_link_libraries(IntegrationTests -lresolv) +endif() \ No newline at end of file diff --git a/tests/IntegrationTestLib/InProcTestNode.cpp b/tests/IntegrationTestLib/InProcTestNode.cpp index 2bc2204e..ee08eaee 100644 --- a/tests/IntegrationTestLib/InProcTestNode.cpp +++ b/tests/IntegrationTestLib/InProcTestNode.cpp @@ -61,7 +61,7 @@ void InProcTestNode::workerThread(std::promise& initPromise) { try { - core.reset(new CryptoNote::core(m_currency, NULL, log)); + core.reset(new CryptoNote::core(m_currency, NULL, log, false, false)); protocol.reset(new CryptoNote::CryptoNoteProtocolHandler(m_currency, dispatcher, *core, NULL, log)); p2pNode.reset(new CryptoNote::NodeServer(dispatcher, *protocol, log)); protocol->set_p2p_endpoint(p2pNode.get()); diff --git a/tests/IntegrationTests/Node.cpp b/tests/IntegrationTests/Node.cpp index 5d0392e1..cefc0039 100644 --- a/tests/IntegrationTests/Node.cpp +++ b/tests/IntegrationTests/Node.cpp @@ -205,7 +205,8 @@ TEST_F(NodeTest, generateBlockchain) std::string password = "pass"; CryptoNote::WalletGreen wallet(dispatcher, currency, *mainNode, logger); - wallet.initialize(password); + std::string walletFile("wallet.bin", std::ios::binary | std::ios::trunc); + wallet.initialize(walletFile, password); std::string minerAddress = wallet.createAddress(); daemon.startMining(1, minerAddress); @@ -220,8 +221,8 @@ TEST_F(NodeTest, generateBlockchain) daemon.stopMining(); - std::ofstream walletFile("wallet.bin", std::ios::binary | std::ios::trunc); - wallet.save(walletFile); + + wallet.save(); wallet.shutdown(); dumpBlockchainInfo(*mainNode); @@ -257,7 +258,7 @@ TEST_F(NodeTest, addMoreBlocks) CryptoNote::WalletGreen wallet(dispatcher, currency, *mainNode, logger); { - std::ifstream walletFile("wallet.bin", std::ios::binary); + std::string walletFile("wallet.bin", std::ios::binary); wallet.load(walletFile, password); } @@ -275,7 +276,7 @@ TEST_F(NodeTest, addMoreBlocks) daemon.stopMining(); std::ofstream walletFile("wallet.bin", std::ios::binary | std::ios::trunc); - wallet.save(walletFile); + wallet.save(); wallet.shutdown(); dumpBlockchainInfo(*mainNode);