change references from "monero-core" to "monero-project"

git mv submodule ./external/monero-core ./external/monero-project
This commit is contained in:
woodser
2021-01-13 12:31:27 -05:00
parent 3bc4aa5151
commit a780c7d56c
11 changed files with 42 additions and 42 deletions
+2 -2
View File
@@ -1,3 +1,3 @@
[submodule "external/monero-core"]
path = external/monero-core
[submodule "external/monero-project"]
path = external/monero-project
url = https://github.com/woodser/monero
+1 -1
View File
@@ -18,7 +18,7 @@ set(BUILD_SCRATCHPAD ON)
# monero-project
###################
set(MONERO_PROJECT "${CMAKE_SOURCE_DIR}/external/monero-core")
set(MONERO_PROJECT "${CMAKE_SOURCE_DIR}/external/monero-project")
set(MONERO_PROJECT_SRC "${MONERO_PROJECT}/src")
# header includes
+2 -2
View File
@@ -184,8 +184,8 @@ For example, [monero-java](https://github.com/monero-ecosystem/monero-java) comp
2. Build monero-project:
1. Install [dependencies](https://github.com/monero-project/monero#dependencies) using your system's package manager (boost, openssl, hidapi, sodium, etc)
2. Update submodules: `./bin/update_submodules.sh`
3. Modify ./external/monero-core/CMakeLists.txt: `option(BUILD_GUI_DEPS "Build GUI dependencies." ON)`
4. `cd ./external/monero-core`
3. Modify ./external/monero-project/CMakeLists.txt: `option(BUILD_GUI_DEPS "Build GUI dependencies." ON)`
4. `cd ./external/monero-project`
5. Run twice to create libwallet_merged.a in addition to other .a libraries: `make release-static -j16`
3. Link to this library's source files in your application or build as a shared library in ./build/: `./bin/build_libmonero_cpp.sh`
+2 -2
View File
@@ -1,8 +1,8 @@
#!/bin/sh
# build monero-core dependencies
# build monero-project dependencies
HOST_NCORES=$(nproc 2>/dev/null || shell nproc 2>/dev/null || sysctl -n hw.ncpu 2>/dev/null || echo 1)
cd ./external/monero-core/ &&
cd ./external/monero-project/ &&
make release-static -j$HOST_NCORES &&
cd ../../
+2 -2
View File
@@ -3,8 +3,8 @@
# initialize submodules recursively
git submodule update --init --force --recursive
# update monero-core
cd ./external/monero-core
# update monero-project
cd ./external/monero-project
git checkout tags/v0.17.1.9
git pull --ff-only origin tags/v0.17.1.9
cd ../../
View File
+4 -4
View File
@@ -136,18 +136,18 @@ namespace monero_utils
bool is_valid_language(const std::string& language);
/**
* Convert a Monero Core cryptonote::block to a block in this library's native model.
* Convert a cryptonote::block to a block in this library's native model.
*
* @param cn_block is the Core block to convert
* @param cn_block is the block to convert
* @return a block in this library's native model
*/
std::shared_ptr<monero_block> cn_block_to_block(const cryptonote::block& cn_block);
/**
* Convert a Monero Core crpytonote::transaction to a transaction in this library's
* Convert a cryptonote::transaction to a transaction in this library's
* native model.
*
* @param cn_tx is the Core transaction to convert
* @param cn_tx is the transaction to convert
* @param init_as_tx_wallet specifies if a monero_tx xor monero_tx_wallet should be initialized
*/
std::shared_ptr<monero_tx> cn_tx_to_tx(const cryptonote::transaction& cn_tx, bool init_as_tx_wallet = false);
+1 -1
View File
@@ -1247,7 +1247,7 @@ namespace monero {
* This process must be repeated with participants exactly N-M times.
*
* @param multisig_hexes are multisig hex from each participant
* @param password is the wallet's password // TODO monero core: redundant? wallet is created with password
* @param password is the wallet's password // TODO monero-project: redundant? wallet is created with password
* @return the result which has the multisig's address xor this wallet's multisig hex to share with participants iff not done
*/
virtual monero_multisig_init_result exchange_multisig_keys(const std::vector<std::string>& mutisig_hexes, const std::string& password) {
+25 -25
View File
@@ -116,14 +116,14 @@ namespace monero {
return opt_val == boost::none ? false : val == *opt_val;
}
// compute m_num_confirmations TODO monero core: this logic is based on wallet_rpc_server.cpp `set_confirmations` but it should be encapsulated in wallet2
// compute m_num_confirmations TODO monero-project: this logic is based on wallet_rpc_server.cpp `set_confirmations` but it should be encapsulated in wallet2
void set_num_confirmations(std::shared_ptr<monero_tx_wallet>& tx, uint64_t blockchain_height) {
std::shared_ptr<monero_block>& block = tx->m_block.get();
if (block->m_height.get() >= blockchain_height || (block->m_height.get() == 0 && !tx->m_in_tx_pool.get())) tx->m_num_confirmations = 0;
else tx->m_num_confirmations = blockchain_height - block->m_height.get();
}
// compute m_num_suggested_confirmations TODO monero core: this logic is based on wallet_rpc_server.cpp `set_confirmations` but it should be encapsulated in wallet2
// compute m_num_suggested_confirmations TODO monero-project: this logic is based on wallet_rpc_server.cpp `set_confirmations` but it should be encapsulated in wallet2
void set_num_suggested_confirmations(std::shared_ptr<monero_incoming_transfer>& incoming_transfer, uint64_t blockchain_height, uint64_t block_reward, uint64_t unlock_time) {
if (block_reward == 0) incoming_transfer->m_num_suggested_confirmations = 0;
else incoming_transfer->m_num_suggested_confirmations = (incoming_transfer->m_amount.get() + block_reward - 1) / block_reward;
@@ -149,7 +149,7 @@ namespace monero {
tx->m_hash = epee::string_tools::pod_to_hex(pd.m_tx_hash);
tx->m_is_incoming = true;
tx->m_payment_id = epee::string_tools::pod_to_hex(payment_id);
if (tx->m_payment_id->substr(16).find_first_not_of('0') == std::string::npos) tx->m_payment_id = tx->m_payment_id->substr(0, 16); // TODO monero core: this should be part of core wallet
if (tx->m_payment_id->substr(16).find_first_not_of('0') == std::string::npos) tx->m_payment_id = tx->m_payment_id->substr(0, 16); // TODO monero-project: this should be part of core wallet
if (tx->m_payment_id == monero_tx::DEFAULT_PAYMENT_ID) tx->m_payment_id = boost::none; // clear default payment id
tx->m_unlock_height = pd.m_unlock_time;
tx->m_is_locked = !m_w2.is_transfer_unlocked(pd.m_unlock_time, pd.m_block_height);
@@ -193,7 +193,7 @@ namespace monero {
tx->m_hash = epee::string_tools::pod_to_hex(txid);
tx->m_is_outgoing = true;
tx->m_payment_id = epee::string_tools::pod_to_hex(pd.m_payment_id);
if (tx->m_payment_id->substr(16).find_first_not_of('0') == std::string::npos) tx->m_payment_id = tx->m_payment_id->substr(0, 16); // TODO monero core: this should be part of core wallet
if (tx->m_payment_id->substr(16).find_first_not_of('0') == std::string::npos) tx->m_payment_id = tx->m_payment_id->substr(0, 16); // TODO monero-project: this should be part of core wallet
if (tx->m_payment_id == monero_tx::DEFAULT_PAYMENT_ID) tx->m_payment_id = boost::none; // clear default payment id
tx->m_unlock_height = pd.m_unlock_time;
tx->m_is_locked = !m_w2.is_transfer_unlocked(pd.m_unlock_time, pd.m_block_height);
@@ -234,7 +234,7 @@ namespace monero {
}
// replace transfer amount with destination sum
// TODO monero core: confirmed tx from/to same account has amount 0 but cached transfer destinations
// TODO monero-project: confirmed tx from/to same account has amount 0 but cached transfer destinations
if (*outgoing_transfer->m_amount == 0 && !outgoing_transfer->m_destinations.empty()) {
uint64_t amount = 0;
for (const std::shared_ptr<monero_destination>& destination : outgoing_transfer->m_destinations) amount += *destination->m_amount;
@@ -253,7 +253,7 @@ namespace monero {
tx->m_hash = epee::string_tools::pod_to_hex(pd.m_tx_hash);
tx->m_is_incoming = true;
tx->m_payment_id = epee::string_tools::pod_to_hex(payment_id);
if (tx->m_payment_id->substr(16).find_first_not_of('0') == std::string::npos) tx->m_payment_id = tx->m_payment_id->substr(0, 16); // TODO monero core: this should be part of core wallet
if (tx->m_payment_id->substr(16).find_first_not_of('0') == std::string::npos) tx->m_payment_id = tx->m_payment_id->substr(0, 16); // TODO monero-project: this should be part of core wallet
if (tx->m_payment_id == monero_tx::DEFAULT_PAYMENT_ID) tx->m_payment_id = boost::none; // clear default payment id
tx->m_unlock_height = pd.m_unlock_time;
tx->m_is_locked = true;
@@ -291,7 +291,7 @@ namespace monero {
tx->m_hash = epee::string_tools::pod_to_hex(txid);
tx->m_is_outgoing = true;
tx->m_payment_id = epee::string_tools::pod_to_hex(pd.m_payment_id);
if (tx->m_payment_id->substr(16).find_first_not_of('0') == std::string::npos) tx->m_payment_id = tx->m_payment_id->substr(0, 16); // TODO monero core: this should be part of core wallet
if (tx->m_payment_id->substr(16).find_first_not_of('0') == std::string::npos) tx->m_payment_id = tx->m_payment_id->substr(0, 16); // TODO monero-project: this should be part of core wallet
if (tx->m_payment_id == monero_tx::DEFAULT_PAYMENT_ID) tx->m_payment_id = boost::none; // clear default payment id
tx->m_unlock_height = pd.m_tx.unlock_time;
tx->m_is_locked = true;
@@ -330,7 +330,7 @@ namespace monero {
}
// replace transfer amount with destination sum
// TODO monero core: confirmed tx from/to same account has amount 0 but cached transfer destinations
// TODO monero-project: confirmed tx from/to same account has amount 0 but cached transfer destinations
if (*outgoing_transfer->m_amount == 0 && !outgoing_transfer->m_destinations.empty()) {
uint64_t amount = 0;
for (const std::shared_ptr<monero_destination>& destination : outgoing_transfer->m_destinations) amount += *destination->m_amount;
@@ -382,7 +382,7 @@ namespace monero {
/**
* Merges a transaction into a unique std::set of transactions.
*
* TODO monero-core: skip_if_absent only necessary because incoming payments not returned
* TODO monero-project: skip_if_absent only necessary because incoming payments not returned
* when sent from/to same account #4500
*
* @param tx is the transaction to merge into the existing txs
@@ -495,10 +495,10 @@ namespace monero {
* (3) Modify monero-wallet-rpc to make this class a friend.
* (4) Move all logic in monero-wallet-rpc to wallet2 so all users can access.
*
* Options 2-4 require modification of Monero Core C++. Of those, (4) is probably ideal.
* TODO: open patch on Monero core which moves common wallet rpc logic (e.g. on_transfer, on_transfer_split) to m_w2.
* Options 2-4 require modification of monero-project C++. Of those, (4) is probably ideal.
* TODO: open patch on monero-project which moves common wallet rpc logic (e.g. on_transfer, on_transfer_split) to m_w2.
*
* Until then, option (1) is used because it allows Monero Core binaries to be used without modification, it's easy, and
* Until then, option (1) is used because it allows monero-project binaries to be used without modification, it's easy, and
* anything other than (4) is temporary.
*/
//------------------------------------------------------------------------------------------------------------------------------
@@ -697,7 +697,7 @@ namespace monero {
this->m_sync_end_height = boost::none;
m_prev_balance = wallet.get_balance();
m_prev_unlocked_balance = wallet.get_unlocked_balance();
m_notification_pool = std::unique_ptr<tools::threadpool>(tools::threadpool::getNewForUnitTests(1)); // TODO (monero-core): utility can be for general use
m_notification_pool = std::unique_ptr<tools::threadpool>(tools::threadpool::getNewForUnitTests(1)); // TODO (monero-project): utility can be for general use
}
~wallet2_listener() {
@@ -1237,7 +1237,7 @@ namespace monero {
monero_integrated_address monero_wallet_core::get_integrated_address(const std::string& standard_address, const std::string& payment_id) const {
MTRACE("get_integrated_address(" << standard_address << ", " << payment_id << ")");
// TODO monero-core: this logic is based on wallet_rpc_server::on_make_integrated_address() and should be moved to wallet so this is unecessary for api users
// TODO monero-project: this logic is based on wallet_rpc_server::on_make_integrated_address() and should be moved to wallet so this is unecessary for api users
// randomly generate payment id if not given, else validate
crypto::hash8 paymen_id_h8;
@@ -1305,7 +1305,7 @@ namespace monero {
std::string err;
uint64_t result = m_w2->get_daemon_blockchain_target_height(err);
if (!err.empty()) throw std::runtime_error(err);
if (result == 0) result = get_daemon_height(); // TODO monero core: target height can be 0 when daemon is synced. Use blockchain height instead
if (result == 0) result = get_daemon_height(); // TODO monero-project: target height can be 0 when daemon is synced. Use blockchain height instead
return result;
}
@@ -1607,7 +1607,7 @@ namespace monero {
}
txs = queried_txs;
// special case: re-fetch txs if inconsistency caused by needing to make multiple wallet calls // TODO monero core: offer wallet.get_txs(...)
// special case: re-fetch txs if inconsistency caused by needing to make multiple wallet calls // TODO monero-project: offer wallet.get_txs(...)
for (const std::shared_ptr<monero_tx_wallet>& tx : txs) {
if (*tx->m_is_confirmed && tx->m_block == boost::none) {
std::cout << "WARNING: Inconsistency detected building txs from multiple wallet2 calls, re-fetching" << std::endl;
@@ -1831,7 +1831,7 @@ namespace monero {
tx->m_ring_size = monero_utils::RING_SIZE;
tx->m_unlock_height = config.m_unlock_height == boost::none ? 0 : config.m_unlock_height.get();
tx->m_is_locked = true;
if (tx->m_is_relayed.get()) tx->m_last_relayed_timestamp = static_cast<uint64_t>(time(NULL)); // std::set last relayed timestamp to current time iff relayed // TODO monero core: this should be encapsulated in wallet2
if (tx->m_is_relayed.get()) tx->m_last_relayed_timestamp = static_cast<uint64_t>(time(NULL)); // std::set last relayed timestamp to current time iff relayed // TODO monero-project: this should be encapsulated in wallet2
out_transfer->m_account_index = config.m_account_index;
if (config.m_subaddress_indices.size() == 1) out_transfer->m_subaddress_indices.push_back(config.m_subaddress_indices[0]); // subaddress index is known iff 1 requested // TODO: get all known subaddress indices here
out_transfer->m_destinations = config.get_normalized_destinations();
@@ -1897,7 +1897,7 @@ namespace monero {
copy.m_account_index = subaddress_indices_pair.first;
copy.m_sweep_each_subaddress = false;
// sweep all subaddresses together // TODO monero core: can this reveal outputs belong to the same wallet?
// sweep all subaddresses together // TODO monero-project: can this reveal outputs belong to the same wallet?
if (copy.m_sweep_each_subaddress == boost::none || copy.m_sweep_each_subaddress.get() != true) {
copy.m_subaddress_indices = subaddress_indices_pair.second;
std::vector<std::shared_ptr<monero_tx_wallet>> account_txs = sweep_account(copy);
@@ -1943,7 +1943,7 @@ namespace monero {
throw std::runtime_error("Failed to validate sweep_account transfer request");
}
// TODO monero-core: this is default `outputs` in COMMAND_RPC_SWEEP_ALL which is not documented
// TODO monero-project: this is default `outputs` in COMMAND_RPC_SWEEP_ALL which is not documented
uint64_t num_outputs = 1;
// prepare parameters for wallet2's create_transactions_all()
@@ -2018,7 +2018,7 @@ namespace monero {
tx->m_num_confirmations = 0;
tx->m_ring_size = monero_utils::RING_SIZE;
tx->m_unlock_height = config.m_unlock_height == boost::none ? 0 : config.m_unlock_height.get();
if (tx->m_is_relayed.get()) tx->m_last_relayed_timestamp = static_cast<uint64_t>(time(NULL)); // std::set last relayed timestamp to current time iff relayed // TODO monero core: this should be encapsulated in wallet2
if (tx->m_is_relayed.get()) tx->m_last_relayed_timestamp = static_cast<uint64_t>(time(NULL)); // std::set last relayed timestamp to current time iff relayed // TODO monero-project: this should be encapsulated in wallet2
out_transfer->m_account_index = config.m_account_index;
if (config.m_subaddress_indices.size() == 1) out_transfer->m_subaddress_indices.push_back(config.m_subaddress_indices[0]); // subaddress index is known iff 1 requested // TODO: get all known subaddress indices here
@@ -2139,7 +2139,7 @@ namespace monero {
tx->m_ring_size = monero_utils::RING_SIZE;
tx->m_unlock_height = config.m_unlock_height == boost::none ? 0 : config.m_unlock_height.get();
tx->m_is_locked = true;
if (tx->m_is_relayed.get()) tx->m_last_relayed_timestamp = static_cast<uint64_t>(time(NULL)); // std::set last relayed timestamp to current time iff relayed // TODO monero core: this should be encapsulated in wallet2
if (tx->m_is_relayed.get()) tx->m_last_relayed_timestamp = static_cast<uint64_t>(time(NULL)); // std::set last relayed timestamp to current time iff relayed // TODO monero-project: this should be encapsulated in wallet2
out_transfer->m_account_index = config.m_account_index;
if (config.m_subaddress_indices.size() == 1) out_transfer->m_subaddress_indices.push_back(config.m_subaddress_indices[0]); // subaddress index is known iff 1 requested // TODO: get all known subaddress indices here
out_transfer->m_destinations = destinations;
@@ -2228,7 +2228,7 @@ namespace monero {
tx->m_num_confirmations = 0;
tx->m_ring_size = monero_utils::RING_SIZE;
tx->m_unlock_height = 0;
if (tx->m_is_relayed.get()) tx->m_last_relayed_timestamp = static_cast<uint64_t>(time(NULL)); // std::set last relayed timestamp to current time iff relayed // TODO monero core: this should be encapsulated in wallet2
if (tx->m_is_relayed.get()) tx->m_last_relayed_timestamp = static_cast<uint64_t>(time(NULL)); // std::set last relayed timestamp to current time iff relayed // TODO monero-project: this should be encapsulated in wallet2
out_transfer->m_destinations[0]->m_amount = *tx_amounts_iter;
// iterate to next element
@@ -3234,7 +3234,7 @@ namespace monero {
// build parameters for m_w2->get_payments()
uint64_t min_height = tx_query->m_min_height == boost::none ? 0 : *tx_query->m_min_height;
uint64_t max_height = tx_query->m_max_height == boost::none ? CRYPTONOTE_MAX_BLOCK_NUMBER : std::min((uint64_t) CRYPTONOTE_MAX_BLOCK_NUMBER, *tx_query->m_max_height);
if (min_height > 0) min_height--; // TODO monero core: wallet2::get_payments() m_min_height is exclusive, so manually offset to match intended range (issues 5751, #5598)
if (min_height > 0) min_height--; // TODO monero-project: wallet2::get_payments() m_min_height is exclusive, so manually offset to match intended range (issues 5751, #5598)
boost::optional<uint32_t> account_index = boost::none;
if (_query->m_account_index != boost::none) account_index = *_query->m_account_index;
std::set<uint32_t> subaddress_indices;
@@ -3277,7 +3277,7 @@ namespace monero {
// get unconfirmed incoming transfers
if (is_pool) {
// update pool state TODO monero-core: this should be encapsulated in wallet when unconfirmed transfers queried
// update pool state TODO monero-project: this should be encapsulated in wallet when unconfirmed transfers queried
std::vector<std::tuple<cryptonote::transaction, crypto::hash, bool>> process_txs;
m_w2->update_pool_state(process_txs);
if (!process_txs.empty()) m_w2->process_pool_state(process_txs);
@@ -3499,7 +3499,7 @@ namespace monero {
// determine sync start height
uint64_t sync_start_height = start_height == boost::none ? std::max(get_height(), get_sync_height()) : *start_height;
if (sync_start_height < get_sync_height()) set_sync_height(sync_start_height); // TODO monero core: start height processed > requested start height unless sync height manually std::set
if (sync_start_height < get_sync_height()) set_sync_height(sync_start_height); // TODO monero-project: start height processed > requested start height unless sync height manually std::set
// notify listeners of sync start
m_w2_listener->on_sync_start(sync_start_height);
+1 -1
View File
@@ -656,7 +656,7 @@ namespace monero {
// otherwise merge transfer fields
m_account_index = gen_utils::reconcile(m_account_index, other->m_account_index, "transfer m_account_index");
// TODO monero core: failed tx in pool (after testUpdateLockedDifferentAccounts()) causes non-originating saved wallets to return duplicate incoming transfers but one has amount of 0
// TODO monero-project: failed tx in pool (after testUpdateLockedDifferentAccounts()) causes non-originating saved wallets to return duplicate incoming transfers but one has amount of 0
if (m_amount != boost::none && other->m_amount != boost::none && *m_amount != *other->m_amount && (*m_amount == 0 || *other->m_amount == 0)) {
std::cout << "WARNING: failed tx in pool causes non-originating wallets to return duplicate incoming transfers but with one amount/m_num_suggested_confirmations of 0, using non-zero amount" << std::endl;
if (*m_amount == 0) m_amount = other->m_amount;
+2 -2
View File
@@ -1,10 +1,10 @@
TODO
rename monero-core submodule to monero-project
rename monero-project submodule to monero-project
add device and device_trezor after testing
in models, strings and pointers do not have to be boost::optional
preserve rpc error codes, just throwing runtime_error now
monero_wallet.cpp move utilities in monero_namespace to be private
polish model: remove all boost::optional from model to be consistent with core?
polish model: remove all boost::optional from model to be consistent with monero-project?
ensure model toPropertyTrees(), etc are not unecessarily copying return objects
monero_wallet_listener should be a class?
way to use copy constructors instead of query copy(sp, sp) methods?