diff --git a/.circleci/config.yml b/.circleci/config.yml old mode 100644 new mode 100755 diff --git a/.gitmodules b/.gitmodules old mode 100644 new mode 100755 diff --git a/.ycm_extra_conf.py b/.ycm_extra_conf.py old mode 100644 new mode 100755 index 6e9139b..a64beb9 --- a/.ycm_extra_conf.py +++ b/.ycm_extra_conf.py @@ -1,4 +1,4 @@ -# Generated by YCM Generator at 2019-02-04 16:43:28.957650 +# Generated by YCM Generator at 2019-11-20 22:37:52.132783 # This file is NOT licensed under the GPLv3, which is the license for the rest # of YouCompleteMe. @@ -36,28 +36,27 @@ import ycm_core flags = [ '-x', 'c++', - '-DASIO_STANDALONE=YES', - '-DBUILD_SSL=TRUE', - '-I/home/mwo2/monero/build', - '-I/home/mwo2/monero/contrib/epee/include', - '-I/home/mwo2/monero/external', - '-I/home/mwo2/monero/external/db_drivers/liblmdb', - '-I/home/mwo2/monero/external/easylogging++', - '-I/home/mwo2/monero/src', - '-I/home/mwo2/openmonero/ext/restbed/source', + '-DBOOST_ALL_NO_LIB', + '-DBOOST_CHRONO_DYN_LINK', + '-DBOOST_DATE_TIME_DYN_LINK', + '-DBOOST_FILESYSTEM_DYN_LINK', + '-DBOOST_PROGRAM_OPTIONS_DYN_LINK', + '-DBOOST_REGEX_DYN_LINK', + '-DBOOST_SERIALIZATION_DYN_LINK', + '-DBOOST_SYSTEM_DYN_LINK', + '-DBOOST_THREAD_DYN_LINK', '-I/home/mwo2/openmonero/src/xmregcore', + '-I/tmp/tmpaV0i5C/distribution/include', + '-I/tmp/tmpaV0i5C/gen', '-I/usr/include/mysql', - '-I/usr/local/include', - '-I/usr/local/include/mysql', - '-I/usr/local/opt/openssl/include', - '-Wall', - '-Weffc++', - '-Wextra', - '-Wno-unknown-pragmas', - '-std=c++14', + '-I/usr/include/mysql++', '-std=gnu++14', - '-isystem', '/home/mwo2/openmonero/ext/restbed/dependency/asio/asio/include', - '-isystem', '/home/mwo2/openmonero/ext/restbed/dependency/kashmir', + '-isystem', '/home/mwo2/monero/build', + '-isystem', '/home/mwo2/monero/contrib/epee/include', + '-isystem', '/home/mwo2/monero/external', + '-isystem', '/home/mwo2/monero/external/db_drivers/liblmdb', + '-isystem', '/home/mwo2/monero/external/easylogging++', + '-isystem', '/home/mwo2/monero/src', ] @@ -157,3 +156,11 @@ def FlagsForFile( filename, **kwargs ): 'do_cache': True } +def Settings( **kwargs ): + language = kwargs[ 'language' ] + if language == 'cfamily': + return { + 'flags': flags + } + + return {} diff --git a/README.md b/README.md index d909338..9421cad 100755 --- a/README.md +++ b/README.md @@ -29,8 +29,8 @@ to MyMonero. They include: ## Live stagenet version -- [http://139.162.60.17:81](http://139.162.60.17:81) -- [http://139.162.60.17:8100](http://139.162.60.17:8100) - MyMonero frontend +- [http://139.162.60.17:81](http://139.162.60.17:81) - down for now. +- [http://139.162.60.17:8100](http://139.162.60.17:8100) - MyMonero frontend - down for now. This is OpenMonero running on stagnet network. You can use it to play around with it. Please note that the live version is running on cheap VPS, which may result in diff --git a/cmake/FindASan.cmake b/cmake/FindASan.cmake old mode 100644 new mode 100755 diff --git a/cmake/FindHIDAPI.cmake b/cmake/FindHIDAPI.cmake old mode 100644 new mode 100755 diff --git a/cmake/FindMSan.cmake b/cmake/FindMSan.cmake old mode 100644 new mode 100755 diff --git a/cmake/FindMySQL++.cmake b/cmake/FindMySQL++.cmake old mode 100644 new mode 100755 diff --git a/cmake/FindRestbed.cmake b/cmake/FindRestbed.cmake old mode 100644 new mode 100755 diff --git a/cmake/FindSanitizers.cmake b/cmake/FindSanitizers.cmake old mode 100644 new mode 100755 diff --git a/cmake/FindTSan.cmake b/cmake/FindTSan.cmake old mode 100644 new mode 100755 diff --git a/cmake/FindUBSan.cmake b/cmake/FindUBSan.cmake old mode 100644 new mode 100755 diff --git a/cmake/sanitize-helpers.cmake b/cmake/sanitize-helpers.cmake old mode 100644 new mode 100755 diff --git a/ext/ThreadPool.hpp b/ext/ThreadPool.hpp old mode 100644 new mode 100755 diff --git a/ext/ThreadSafeQueue.hpp b/ext/ThreadSafeQueue.hpp old mode 100644 new mode 100755 diff --git a/html/js/cn_util.js b/html/js/cn_util.js old mode 100644 new mode 100755 diff --git a/html/js/config.js b/html/js/config.js index 1716cc5..784a9c3 100755 --- a/html/js/config.js +++ b/html/js/config.js @@ -1,5 +1,4 @@ var config = { - //apiUrl: "http://0.0.0.0:1984/", apiUrl: "http://127.0.0.1:1984/", mainnetExplorerUrl: "https://xmrchain.com/", testnetExplorerUrl: "https://testnet.xmrchain.com/", diff --git a/html/js/controllers/send_coins.js b/html/js/controllers/send_coins.js old mode 100644 new mode 100755 diff --git a/html/js/crypto.js b/html/js/crypto.js old mode 100644 new mode 100755 diff --git a/html/js/lib/mymonero-core.js b/html/js/lib/mymonero-core.js old mode 100644 new mode 100755 diff --git a/html/js/lib/mymonero_core_js/monero_utils/MyMoneroCoreCpp_WASM.wasm b/html/js/lib/mymonero_core_js/monero_utils/MyMoneroCoreCpp_WASM.wasm old mode 100644 new mode 100755 diff --git a/scripts/README.md b/scripts/README.md old mode 100644 new mode 100755 diff --git a/scripts/batch_import_test.py b/scripts/batch_import_test.py old mode 100644 new mode 100755 index be3b4a2..fc22f51 --- a/scripts/batch_import_test.py +++ b/scripts/batch_import_test.py @@ -16,7 +16,6 @@ import monero # openmonero backend url om_url = "http://127.0.0.1:1984/" -#om_url = "http://139.162.60.17:1984/" async def make_request(url, payload=""): diff --git a/src/CurrentBlockchainStatus.cpp b/src/CurrentBlockchainStatus.cpp index f3d2d3f..cede36c 100755 --- a/src/CurrentBlockchainStatus.cpp +++ b/src/CurrentBlockchainStatus.cpp @@ -46,7 +46,8 @@ CurrentBlockchainStatus::monitor_blockchain() break; } - OMVLOG1 << "PoolQueue size: " + //OMVLOG1 << "PoolQueue size: " + OMINFO << "PoolQueue size: " << TP::DefaultThreadPool::queueSize(); update_current_blockchain_height(); @@ -589,62 +590,51 @@ bool CurrentBlockchainStatus::read_mempool() { // get txs in the mempool - std::vector mempool_tx_info; - vector key_image_infos; + + mempool_txs_t local_mempool_txs; auto future_result = thread_pool->submit( - [this](auto& mempool_tx_info, auto& key_image_infos) + [this](auto& local_mempool_txs) -> bool { - if (!this->mcore->get_mempool_txs( - mempool_tx_info, key_image_infos)) + + std::vector txs; + + if (!this->mcore->get_mempool_txs(txs)) { OMERROR << "Getting mempool failed "; return false; } - return true; - - }, std::ref(mempool_tx_info), - std::ref(key_image_infos)); - if (!future_result.get()) - return false; + for (size_t i = 0; i < txs.size(); ++i) + { + // get transaction info of the tx in the mempool + auto const& tx = txs.at(i); - // not using this info at present - (void) key_image_infos; + tx_memory_pool::tx_details txd; - std::lock_guard lck (getting_mempool_txs); + txpool_tx_meta_t meta; - // clear current mempool txs vector - // repopulate it with each execution of read_mempool() - // not very efficient but good enough for now. - mempool_txs.clear(); + if (!this->mcore->get_core().get_txpool_tx_meta(tx.hash, meta)) + { + OMERROR << "Failed to find tx in txpool"; + return false; + } - // if dont have tx_blob member, construct tx - // from json obtained from the rpc call + local_mempool_txs.emplace_back(meta.receive_time, tx); - for (size_t i = 0; i < mempool_tx_info.size(); ++i) - { - // get transaction info of the tx in the mempool - tx_info const& _tx_info = mempool_tx_info.at(i); + } // for (size_t i = 0; i < mempool_tx_info.size(); ++i) - transaction tx; - crypto::hash tx_hash; - crypto::hash tx_prefix_hash; + return true; - if (!parse_and_validate_tx_from_blob( - _tx_info.tx_blob, tx, tx_hash, tx_prefix_hash)) - { - OMERROR << "Cant make tx from _tx_info.tx_blob"; - return false; - } + }, std::ref(local_mempool_txs)); - (void) tx_hash; - (void) tx_prefix_hash; + if (!future_result.get()) + return false; - mempool_txs.emplace_back(_tx_info.receive_time, tx); + std::lock_guard lck (getting_mempool_txs); - } // for (size_t i = 0; i < mempool_tx_info.size(); ++i) + mempool_txs = std::move(local_mempool_txs); return true; } diff --git a/src/OpenMoneroRequests.cpp b/src/OpenMoneroRequests.cpp index 3d99e95..f5d5baa 100755 --- a/src/OpenMoneroRequests.cpp +++ b/src/OpenMoneroRequests.cpp @@ -1710,9 +1710,19 @@ OpenMoneroRequests::get_tx( if (current_bc_status->get_xmr_address_viewkey( xmr_address, address_info, viewkey)) { + auto coreacc = make_account(xmr_address, view_key); + + if (!coreacc) + { + // if creation failed, just close the session + session_close(session, j_response, UNPROCESSABLE_ENTITY, + "Cant create coreacc for " + xmr_address); + return; + } - auto identifier = make_identifier(tx, - make_unique(&address_info, &viewkey)); + auto identifier = make_identifier( + tx, + make_unique(coreacc.get())); identifier.identify(); @@ -1739,6 +1749,7 @@ OpenMoneroRequests::get_tx( // a placeholder for exciting or new account data XmrAccount acc; + // select this account if its existing one if (xmr_accounts->select(xmr_address, acc)) { @@ -1819,7 +1830,7 @@ OpenMoneroRequests::get_tx( // and inputs in a given tx. auto identifier = make_identifier(tx, - make_unique(&address_info, &viewkey, + make_unique(coreacc.get(), &known_outputs_keys, &mcore_addapter)); identifier.identify(); @@ -2159,7 +2170,8 @@ OpenMoneroRequests::create_account( // in a moment we will try to get last block timestamp // to replace this value. But if it fails, we just use current // timestamp - uint64_t current_blockchain_timestamp = std::time(nullptr); + uint64_t current_blockchain_timestamp + = std::time(nullptr); // get last block so we have its timestamp when // createing the account @@ -2167,14 +2179,14 @@ OpenMoneroRequests::create_account( if (current_bc_status->get_block(current_blockchain_height, last_blk)) { - current_blockchain_timestamp = last_blk.timestamp; + if (last_blk.timestamp != 0) + current_blockchain_timestamp = last_blk.timestamp; } DateTime blk_timestamp_mysql_format = XmrTransaction::timestamp_to_DateTime( current_blockchain_timestamp); - //@todo setting up start_height and scanned_block_height //needs to be revisited as they are needed for importing //wallets. The simples way is when import is free and this diff --git a/src/TxSearch.cpp b/src/TxSearch.cpp index bfb9fd9..b1f09e4 100755 --- a/src/TxSearch.cpp +++ b/src/TxSearch.cpp @@ -393,9 +393,12 @@ for (auto const& tx_tuple: txs_data) { OMERROR << address_prefix << ": insert outputs_found: no_rows_inserted is zero!" - << outputs_found; + << " in tx " << tx_hash_str << " in blk " << blk_height + << ' ' << outputs_found; - throw TxSearchException("insert output_found: no_rows_inserted is zero!"); + continue; + //throw TxSearchException("insert output_found: " + // "no_rows_inserted is zero!"); } } // if (!found_mine_outputs.empty()) @@ -581,10 +584,12 @@ for (auto const& tx_tuple: txs_data) { OMERROR << address_prefix << ": insert inputs_found: no_rows_inserted is zero!" - << inputs_found; + << " in tx " << tx_hash_str << " in blk " << blk_height + << ' ' << inputs_found; - throw TxSearchException( - "insert inputs_found: no_rows_inserted is zero!"); + continue; + //throw TxSearchException( + //"insert inputs_found: no_rows_inserted is zero!"); } } // if (!inputs_found.empty()) diff --git a/src/om_log.h b/src/om_log.h index 812d70f..a052b3c 100755 --- a/src/om_log.h +++ b/src/om_log.h @@ -7,10 +7,15 @@ #define OMWARN CLOG(WARNING, OPENMONERO_LOG_CATEGORY) #define OMERROR CLOG(ERROR, OPENMONERO_LOG_CATEGORY) -#define OMVLOG1 CVLOG(1, OPENMONERO_LOG_CATEGORY) -#define OMVLOG2 CVLOG(2, OPENMONERO_LOG_CATEGORY) -#define OMVLOG3 CVLOG(3, OPENMONERO_LOG_CATEGORY) -#define OMVLOG4 CVLOG(4, OPENMONERO_LOG_CATEGORY) +//#define OMVLOG1 CVLOG(1, OPENMONERO_LOG_CATEGORY) +//#define OMVLOG2 CVLOG(2, OPENMONERO_LOG_CATEGORY) +//#define OMVLOG3 CVLOG(3, OPENMONERO_LOG_CATEGORY) +//#define OMVLOG4 CVLOG(4, OPENMONERO_LOG_CATEGORY) + +#define OMVLOG1 CLOG(INFO, OPENMONERO_LOG_CATEGORY) +#define OMVLOG2 CLOG(INFO, OPENMONERO_LOG_CATEGORY) +#define OMVLOG3 CLOG(INFO, OPENMONERO_LOG_CATEGORY) +#define OMVLOG4 CLOG(INFO, OPENMONERO_LOG_CATEGORY) #define OMINFO_IF(cond) CLOG_IF(cond, INFO, OPENMONERO_LOG_CATEGORY) #define OMWARN_IF(cond) CLOG_IF(cond, WARNING, OPENMONERO_LOG_CATEGORY) diff --git a/src/utils.cpp b/src/utils.cpp index 0c707d5..9d9f571 100755 --- a/src/utils.cpp +++ b/src/utils.cpp @@ -1240,7 +1240,7 @@ blocks_and_txs_from_complete_blocks( { transaction tx; - if (!parse_and_validate_tx_from_blob(tx_blob, tx)) + if (!parse_and_validate_tx_from_blob(tx_blob.blob, tx)) return false; txs.push_back(tx); diff --git a/src/xmregcore b/src/xmregcore index 4356c98..6e0c9e4 160000 --- a/src/xmregcore +++ b/src/xmregcore @@ -1 +1 @@ -Subproject commit 4356c9892b9903da4410f773ea36a6e4c799be5a +Subproject commit 6e0c9e4b9fa1d2ce1182e61290ff5190608c8b6a diff --git a/tests/JsonTx.cpp b/tests/JsonTx.cpp old mode 100644 new mode 100755 diff --git a/tests/JsonTx.h b/tests/JsonTx.h old mode 100644 new mode 100755 diff --git a/tests/res/tx/README.md b/tests/res/tx/README.md old mode 100644 new mode 100755 diff --git a/tests/res/tx/d7dcb2daa64b5718dad71778112d48ad62f4d5f54337037c420cb76efdd8a21c.json b/tests/res/tx/d7dcb2daa64b5718dad71778112d48ad62f4d5f54337037c420cb76efdd8a21c.json old mode 100644 new mode 100755 diff --git a/tests/res/tx/ddff95211b53c194a16c2b8f37ae44b643b8bd46b4cb402af961ecabeb8417b2.json b/tests/res/tx/ddff95211b53c194a16c2b8f37ae44b643b8bd46b4cb402af961ecabeb8417b2.json old mode 100644 new mode 100755 diff --git a/tests/res/tx/f3c84fe925292ec5b4dc383d306d934214f4819611566051bca904d1cf4efceb.json b/tests/res/tx/f3c84fe925292ec5b4dc383d306d934214f4819611566051bca904d1cf4efceb.json old mode 100644 new mode 100755