diff options
-rw-r--r-- | CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/blockchain_db/lmdb/db_lmdb.cpp | 2 | ||||
-rw-r--r-- | src/common/varint.h | 4 | ||||
-rw-r--r-- | src/crypto/crypto.cpp | 2 | ||||
-rw-r--r-- | src/cryptonote_basic/miner.cpp | 2 | ||||
-rw-r--r-- | src/cryptonote_core/blockchain.cpp | 4 | ||||
-rw-r--r-- | src/cryptonote_protocol/cryptonote_protocol_handler.h | 2 | ||||
-rw-r--r-- | src/cryptonote_protocol/cryptonote_protocol_handler.inl | 2 | ||||
-rw-r--r-- | src/daemonizer/CMakeLists.txt | 4 | ||||
-rw-r--r-- | src/daemonizer/posix_fork.cpp | 2 | ||||
-rw-r--r-- | src/serialization/binary_archive.h | 2 | ||||
-rw-r--r-- | src/serialization/variant.h | 2 | ||||
-rw-r--r-- | src/simplewallet/simplewallet.cpp | 2 | ||||
-rw-r--r-- | src/wallet/api/wallet.cpp | 2 | ||||
-rw-r--r-- | src/wallet/api/wallet2_api.h | 4 | ||||
-rw-r--r-- | src/wallet/wallet2.cpp | 43 | ||||
-rw-r--r-- | tests/gtest/include/gtest/internal/gtest-filepath.h | 2 | ||||
-rw-r--r-- | tests/gtest/src/gtest-filepath.cc | 2 | ||||
-rw-r--r-- | tests/libwallet_api_tests/main.cpp | 2 | ||||
-rw-r--r-- | tests/libwallet_api_tests/scripts/README.md | 2 | ||||
-rw-r--r-- | tests/unit_tests/ringct.cpp | 2 | ||||
-rw-r--r-- | utils/systemd/monerod.service | 1 |
22 files changed, 50 insertions, 42 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index d60eecbc1..7697cd1c4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -298,7 +298,7 @@ if(SANITIZE) endif() # Set default blockchain storage location: -# memory was the default in Cryptonote before Monero implimented LMDB, it still works but is unneccessary. +# memory was the default in Cryptonote before Monero implemented LMDB, it still works but is unnecessary. # set(DATABASE memory) set(DATABASE lmdb) diff --git a/src/blockchain_db/lmdb/db_lmdb.cpp b/src/blockchain_db/lmdb/db_lmdb.cpp index bdec846d1..51dcb49a8 100644 --- a/src/blockchain_db/lmdb/db_lmdb.cpp +++ b/src/blockchain_db/lmdb/db_lmdb.cpp @@ -472,7 +472,7 @@ void BlockchainLMDB::do_resize(uint64_t increase_size) // add 1Gb per resize, instead of doing a percentage increase uint64_t new_mapsize = (double) mei.me_mapsize + add_size; - // If given, use increase_size intead of above way of resizing. + // If given, use increase_size instead of above way of resizing. // This is currently used for increasing by an estimated size at start of new // batch txn. if (increase_size > 0) diff --git a/src/common/varint.h b/src/common/varint.h index 262bd1360..151d13dbf 100644 --- a/src/common/varint.h +++ b/src/common/varint.h @@ -45,7 +45,7 @@ * is as follows: Strip the msb of each byte, then from left to right, * read in what remains, placing it in reverse, into the buffer. Thus, * the following bit stream: 0xff02 would return 0x027f. 0xff turns - * into 0x7f, is placed on the beggining of the buffer, then 0x02 is + * into 0x7f, is placed on the beginning of the buffer, then 0x02 is * unchanged, since its msb is not set, and placed at the end of the * buffer. */ @@ -108,7 +108,7 @@ namespace tools { return EVARINT_REPRESENT; } - write |= static_cast<T>(byte & 0x7f) << shift; /* Does the actualy placing into write, stripping the first bit */ + write |= static_cast<T>(byte & 0x7f) << shift; /* Does the actually placing into write, stripping the first bit */ /* If there is no next */ if ((byte & 0x80) == 0) { diff --git a/src/crypto/crypto.cpp b/src/crypto/crypto.cpp index afac105e4..0c70b9eeb 100644 --- a/src/crypto/crypto.cpp +++ b/src/crypto/crypto.cpp @@ -107,7 +107,7 @@ namespace crypto { /* * generate public and secret keys from a random 256-bit integer - * TODO: allow specifiying random value (for wallet recovery) + * TODO: allow specifying random value (for wallet recovery) * */ secret_key crypto_ops::generate_keys(public_key &pub, secret_key &sec, const secret_key& recovery_key, bool recover) { diff --git a/src/cryptonote_basic/miner.cpp b/src/cryptonote_basic/miner.cpp index 6437d3057..f949bbd2b 100644 --- a/src/cryptonote_basic/miner.cpp +++ b/src/cryptonote_basic/miner.cpp @@ -602,7 +602,7 @@ namespace cryptonote // this should take care of the case where mining is started with bg-enabled, // and then the user decides to un-check background mining, and just do // regular full-speed mining. I might just be over-doing it and thinking up - // non-existant use-cases, so if the concensus is to simplify, we can remove all this fluff. + // non-existant use-cases, so if the consensus is to simplify, we can remove all this fluff. /* while( !m_is_background_mining_enabled ) { diff --git a/src/cryptonote_core/blockchain.cpp b/src/cryptonote_core/blockchain.cpp index a1b297c11..88ed409bf 100644 --- a/src/cryptonote_core/blockchain.cpp +++ b/src/cryptonote_core/blockchain.cpp @@ -2756,7 +2756,7 @@ bool Blockchain::check_tx_inputs(transaction& tx, tx_verification_context &tvc, case rct::RCTTypeSimple: case rct::RCTTypeSimpleBulletproof: { - // check all this, either recontructed (so should really pass), or not + // check all this, either reconstructed (so should really pass), or not { if (pubkeys.size() != rv.mixRing.size()) { @@ -2814,7 +2814,7 @@ bool Blockchain::check_tx_inputs(transaction& tx, tx_verification_context &tvc, case rct::RCTTypeFull: case rct::RCTTypeFullBulletproof: { - // check all this, either recontructed (so should really pass), or not + // check all this, either reconstructed (so should really pass), or not { bool size_matches = true; for (size_t i = 0; i < pubkeys.size(); ++i) diff --git a/src/cryptonote_protocol/cryptonote_protocol_handler.h b/src/cryptonote_protocol/cryptonote_protocol_handler.h index e24c964a5..d7b74c06d 100644 --- a/src/cryptonote_protocol/cryptonote_protocol_handler.h +++ b/src/cryptonote_protocol/cryptonote_protocol_handler.h @@ -1,6 +1,6 @@ /// @file /// @author rfree (current maintainer/user in monero.cc project - most of code is from CryptoNote) -/// @brief This is the orginal cryptonote protocol network-events handler, modified by us +/// @brief This is the original cryptonote protocol network-events handler, modified by us // Copyright (c) 2014-2018, The Monero Project // diff --git a/src/cryptonote_protocol/cryptonote_protocol_handler.inl b/src/cryptonote_protocol/cryptonote_protocol_handler.inl index 2c6e41c3e..7c4f16c77 100644 --- a/src/cryptonote_protocol/cryptonote_protocol_handler.inl +++ b/src/cryptonote_protocol/cryptonote_protocol_handler.inl @@ -1,6 +1,6 @@ /// @file /// @author rfree (current maintainer/user in monero.cc project - most of code is from CryptoNote) -/// @brief This is the orginal cryptonote protocol network-events handler, modified by us +/// @brief This is the original cryptonote protocol network-events handler, modified by us // Copyright (c) 2014-2018, The Monero Project // diff --git a/src/daemonizer/CMakeLists.txt b/src/daemonizer/CMakeLists.txt index 2c0583c49..2753d0003 100644 --- a/src/daemonizer/CMakeLists.txt +++ b/src/daemonizer/CMakeLists.txt @@ -54,6 +54,10 @@ else() ) endif() +if(CMAKE_BUILD_TYPE STREQUAL "Debug") + add_definitions(-DDEBUG_TMPDIR_LOG=1) +endif() + monero_private_headers(daemonizer ${daemonizer_private_headers}) monero_add_library(daemonizer diff --git a/src/daemonizer/posix_fork.cpp b/src/daemonizer/posix_fork.cpp index 4dff04f3f..3cbee9c51 100644 --- a/src/daemonizer/posix_fork.cpp +++ b/src/daemonizer/posix_fork.cpp @@ -115,6 +115,7 @@ void fork(const std::string & pidfile) quit("Unable to open /dev/null"); } +#ifdef DEBUG_TMPDIR_LOG // Send standard output to a log file. const char *tmpdir = getenv("TMPDIR"); if (!tmpdir) @@ -133,6 +134,7 @@ void fork(const std::string & pidfile) { quit("Unable to dup output descriptor"); } +#endif } } // namespace posix diff --git a/src/serialization/binary_archive.h b/src/serialization/binary_archive.h index 79c6c753c..f47a4494d 100644 --- a/src/serialization/binary_archive.h +++ b/src/serialization/binary_archive.h @@ -82,7 +82,7 @@ protected: /* \struct binary_archive * - * \brief the actualy binary archive type + * \brief the actually binary archive type * * \detailed The boolean template argument /a W is the is_saving * parameter for binary_archive_base. diff --git a/src/serialization/variant.h b/src/serialization/variant.h index 31d903d55..1d00ab461 100644 --- a/src/serialization/variant.h +++ b/src/serialization/variant.h @@ -87,7 +87,7 @@ struct variant_reader }; // This one just fails when you call it.... okay -// So the TEnd parameter must be specified/differnt from TBegin +// So the TEnd parameter must be specified/different from TBegin template <class Archive, class Variant, class TBegin> struct variant_reader<Archive, Variant, TBegin, TBegin> { diff --git a/src/simplewallet/simplewallet.cpp b/src/simplewallet/simplewallet.cpp index 6014f388c..b74097306 100644 --- a/src/simplewallet/simplewallet.cpp +++ b/src/simplewallet/simplewallet.cpp @@ -2598,7 +2598,7 @@ bool simple_wallet::init(const boost::program_options::variables_map& vm) try { year = boost::lexical_cast<uint16_t>(heightstr.substr(0,4)); - // lexical_cast<uint8_t> won't work becasue uint8_t is treated as character type + // lexical_cast<uint8_t> won't work because uint8_t is treated as character type month = boost::lexical_cast<uint16_t>(heightstr.substr(5,2)); day = boost::lexical_cast<uint16_t>(heightstr.substr(8,2)); m_restore_height = m_wallet->get_blockchain_height_by_date(year, month, day); diff --git a/src/wallet/api/wallet.cpp b/src/wallet/api/wallet.cpp index c04b25ee2..0ed6601af 100644 --- a/src/wallet/api/wallet.cpp +++ b/src/wallet/api/wallet.cpp @@ -1746,7 +1746,7 @@ void WalletImpl::doRefresh() m_synchronized = true; } // assuming if we have empty history, it wasn't initialized yet - // for futher history changes client need to update history in + // for further history changes client need to update history in // "on_money_received" and "on_money_sent" callbacks if (m_history->count() == 0) { m_history->refresh(); diff --git a/src/wallet/api/wallet2_api.h b/src/wallet/api/wallet2_api.h index d423ff87c..a6320545e 100644 --- a/src/wallet/api/wallet2_api.h +++ b/src/wallet/api/wallet2_api.h @@ -706,7 +706,7 @@ struct Wallet * \brief setUserNote - attach an arbitrary string note to a txid * \param txid - the transaction id to attach the note to * \param note - the note - * \return true if succesful, false otherwise + * \return true if successful, false otherwise */ virtual bool setUserNote(const std::string &txid, const std::string ¬e) = 0; /*! @@ -888,7 +888,7 @@ struct WalletManager } /*! - * \brief Closes wallet. In case operation succeded, wallet object deleted. in case operation failed, wallet object not deleted + * \brief Closes wallet. In case operation succeeded, wallet object deleted. in case operation failed, wallet object not deleted * \param wallet previously opened / created wallet instance * \return None */ diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp index 2e1e44662..9b2595716 100644 --- a/src/wallet/wallet2.cpp +++ b/src/wallet/wallet2.cpp @@ -387,7 +387,7 @@ std::unique_ptr<tools::wallet2> generate_from_json(const std::string& json_file, if (field_spendkey.empty()) { - // if we have an addres but no spend key, we can deduce the spend public key + // if we have an address but no spend key, we can deduce the spend public key // from the address if (field_address_found) { @@ -2856,16 +2856,9 @@ crypto::secret_key wallet2::generate(const std::string& wallet_, const epee::wip m_multisig_signers.clear(); m_key_on_device = false; - // -1 month for fluctuations in block time and machine date/time setup. - // avg seconds per block - const int seconds_per_block = DIFFICULTY_TARGET_V2; - // ~num blocks per month - const uint64_t blocks_per_month = 60*60*24*30/seconds_per_block; - - // try asking the daemon first + // calculate a starting refresh height if(m_refresh_from_block_height == 0 && !recover){ - uint64_t height = estimate_blockchain_height(); - m_refresh_from_block_height = height >= blocks_per_month ? height - blocks_per_month : 0; + m_refresh_from_block_height = estimate_blockchain_height(); } if (!wallet_.empty()) @@ -2900,20 +2893,30 @@ crypto::secret_key wallet2::generate(const std::string& wallet_, const epee::wip std::string err; uint64_t height = 0; - // we get the max of approximated height and known height + // we get the max of approximated height and local height. // approximated height is the least of daemon target height // (the max of what the other daemons are claiming is their // height) and the theoretical height based on the local // clock. This will be wrong only if both the local clock // is bad *and* a peer daemon claims a highest height than // the real chain. - // known height is the height the local daemon is currently + // local height is the height the local daemon is currently // synced to, it will be lower than the real chain height if // the daemon is currently syncing. + // If we use the approximate height we subtract one month as + // a safety margin. height = get_approximate_blockchain_height(); uint64_t target_height = get_daemon_blockchain_target_height(err); - if (err.empty() && target_height < height) - height = target_height; + if (err.empty()) { + if (target_height < height) + height = target_height; + } else { + // if we couldn't talk to the daemon, check safety margin. + if (height > blocks_per_month) + height -= blocks_per_month; + else + height = 0; + } uint64_t local_height = get_daemon_blockchain_height(err); if (err.empty() && local_height > height) height = local_height; @@ -5316,7 +5319,7 @@ void wallet2::light_wallet_get_outs(std::vector<std::vector<tools::wallet2::get_ bool r = epee::net_utils::invoke_http_json("/get_random_outs", oreq, ores, m_http_client, rpc_timeout, "POST"); m_daemon_rpc_mutex.unlock(); THROW_WALLET_EXCEPTION_IF(!r, error::no_connection_to_daemon, "get_random_outs"); - THROW_WALLET_EXCEPTION_IF(ores.amount_outs.empty() , error::wallet_internal_error, "No outputs recieved from light wallet node. Error: " + ores.Error); + THROW_WALLET_EXCEPTION_IF(ores.amount_outs.empty() , error::wallet_internal_error, "No outputs received from light wallet node. Error: " + ores.Error); // Check if we got enough outputs for each amount for(auto& out: ores.amount_outs) { @@ -5540,7 +5543,7 @@ void wallet2::get_outs(std::vector<std::vector<tools::wallet2::get_outs_entry>> } } - // sort the subsection, to ensure the daemon doesn't know wich output is ours + // sort the subsection, to ensure the daemon doesn't know which output is ours std::sort(req.outputs.begin() + start, req.outputs.end(), [](const get_outputs_out &a, const get_outputs_out &b) { return a.index < b.index; }); } @@ -6167,7 +6170,7 @@ bool wallet2::light_wallet_login(bool &new_address) cryptonote::COMMAND_RPC_LOGIN::response response; request.address = get_account().get_public_address_str(m_nettype); request.view_key = string_tools::pod_to_hex(get_account().get_keys().m_view_secret_key); - // Always create account if it doesnt exist. + // Always create account if it doesn't exist. request.create_account = true; m_daemon_rpc_mutex.lock(); bool connected = epee::net_utils::invoke_http_json("/login", request, response, m_http_client, rpc_timeout, "POST"); @@ -6180,7 +6183,7 @@ bool wallet2::light_wallet_login(bool &new_address) MDEBUG("New wallet: " << response.new_address); if(m_light_wallet_connected) { - // Clear old data on successfull login. + // Clear old data on successful login. // m_transfers.clear(); // m_payments.clear(); // m_unconfirmed_payments.clear(); @@ -6552,7 +6555,7 @@ void wallet2::light_wallet_get_address_txs() // Calculate wallet balance m_light_wallet_balance = ires.total_received-wallet_total_sent; - // MyMonero doesnt send unlocked balance + // MyMonero doesn't send unlocked balance if(ires.total_received_unlocked > 0) m_light_wallet_unlocked_balance = ires.total_received_unlocked-wallet_total_sent; else @@ -6829,7 +6832,7 @@ std::vector<wallet2::pending_tx> wallet2::create_transactions_2(std::vector<cryp { string s; for (auto i: preferred_inputs) s += boost::lexical_cast<std::string>(i) + " (" + print_money(m_transfers[i].amount()) + ") "; - LOG_PRINT_L1("Found prefered rct inputs for rct tx: " << s); + LOG_PRINT_L1("Found preferred rct inputs for rct tx: " << s); // bring the list of available outputs stored by the same subaddress index to the front of the list uint32_t index_minor = m_transfers[preferred_inputs[0]].m_subaddr_index.minor; diff --git a/tests/gtest/include/gtest/internal/gtest-filepath.h b/tests/gtest/include/gtest/internal/gtest-filepath.h index 7a13b4b0d..184450686 100644 --- a/tests/gtest/include/gtest/internal/gtest-filepath.h +++ b/tests/gtest/include/gtest/internal/gtest-filepath.h @@ -192,7 +192,7 @@ class GTEST_API_ FilePath { void Normalize(); - // Returns a pointer to the last occurence of a valid path separator in + // Returns a pointer to the last occurrence of a valid path separator in // the FilePath. On Windows, for example, both '/' and '\' are valid path // separators. Returns NULL if no path separator was found. const char* FindLastPathSeparator() const; diff --git a/tests/gtest/src/gtest-filepath.cc b/tests/gtest/src/gtest-filepath.cc index 0292dc119..3bb275488 100644 --- a/tests/gtest/src/gtest-filepath.cc +++ b/tests/gtest/src/gtest-filepath.cc @@ -130,7 +130,7 @@ FilePath FilePath::RemoveExtension(const char* extension) const { return *this; } -// Returns a pointer to the last occurence of a valid path separator in +// Returns a pointer to the last occurrence of a valid path separator in // the FilePath. On Windows, for example, both '/' and '\' are valid path // separators. Returns NULL if no path separator was found. const char* FilePath::FindLastPathSeparator() const { diff --git a/tests/libwallet_api_tests/main.cpp b/tests/libwallet_api_tests/main.cpp index 96e327ef1..1e63a12f3 100644 --- a/tests/libwallet_api_tests/main.cpp +++ b/tests/libwallet_api_tests/main.cpp @@ -841,7 +841,7 @@ struct MyWalletListener : public Monero::WalletListener { std::cout << "wallet: " << wallet->mainAddress() << "**** just received unconfirmed money (" << txId << ", " << wallet->displayAmount(amount) << ")" << std::endl; - // Don't trigger recieve until tx is mined + // Don't trigger receive until tx is mined // total_rx += amount; // receive_triggered = true; // cv_receive.notify_one(); diff --git a/tests/libwallet_api_tests/scripts/README.md b/tests/libwallet_api_tests/scripts/README.md index 2705cc04b..3818a27d8 100644 --- a/tests/libwallet_api_tests/scripts/README.md +++ b/tests/libwallet_api_tests/scripts/README.md @@ -3,7 +3,7 @@ ## Environment for the tests * Running monero node, linked to private/public testnet. By default, tests expect daemon running at ```localhost:38081```, - can we overriden with enviroment variable ```TESTNET_DAEMON_ADDRESS=<your_daemon_address>``` + can we overriden with environment variable ```TESTNET_DAEMON_ADDRESS=<your_daemon_address>``` [Manual](https://github.com/moneroexamples/private-testnet) explaining how to run private testnet. * Directory with pre-generated wallets diff --git a/tests/unit_tests/ringct.cpp b/tests/unit_tests/ringct.cpp index 95b20f563..b7fcbbcab 100644 --- a/tests/unit_tests/ringct.cpp +++ b/tests/unit_tests/ringct.cpp @@ -132,7 +132,7 @@ TEST(ringct, MG_sigs) } sk[j] = xx[ind][j]; } - sk[2] = skGen();//asume we don't know one of the private keys.. + sk[2] = skGen();//assume we don't know one of the private keys.. IIccss = MLSAG_Gen(message, P, sk, NULL, NULL, ind, R, hw::get_device("default")); ASSERT_FALSE(MLSAG_Ver(message, P, IIccss, R)); } diff --git a/utils/systemd/monerod.service b/utils/systemd/monerod.service index b6b6b6ce6..696be4c33 100644 --- a/utils/systemd/monerod.service +++ b/utils/systemd/monerod.service @@ -15,7 +15,6 @@ ExecStart=/usr/bin/monerod --config-file /etc/monerod.conf \ --detach --pidfile /run/monero/monerod.pid Restart=always -PrivateTmp=true [Install] WantedBy=multi-user.target |