From c4e236b1964e8eecb5c05eb4a077b219b78f1223 Mon Sep 17 00:00:00 2001 From: woodser Date: Tue, 3 Nov 2020 14:23:04 -0500 Subject: [PATCH] update monero-project to v0.17.1.1 --- README.md | 2 +- bin/update_submodules.sh | 4 +- external/monero-core | 2 +- src/daemon/monero_daemon_model.cpp | 108 ++++++++++++++--------------- src/utils/gen_utils.h | 4 +- src/wallet/monero_wallet_core.cpp | 5 +- src/wallet/monero_wallet_model.cpp | 40 +++++------ 7 files changed, 84 insertions(+), 81 deletions(-) diff --git a/README.md b/README.md index 51a13ea..1138506 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Monero C++ Library -A C++ library for creating Monero applications using native bindings to [monero v0.17.0.1 'Oxygen Orion'](https://github.com/monero-project/monero/tree/v0.17.0.1). +A C++ library for creating Monero applications using native bindings to [monero v0.17.1.1 'Oxygen Orion'](https://github.com/monero-project/monero/tree/v0.17.1.1). * Supports fully client-side wallets by wrapping [wallet2.h](https://github.com/monero-project/monero/blob/master/src/wallet/wallet2.h). * Supports multisig, view-only, and offline wallets. diff --git a/bin/update_submodules.sh b/bin/update_submodules.sh index 34303d9..fb57474 100755 --- a/bin/update_submodules.sh +++ b/bin/update_submodules.sh @@ -5,6 +5,6 @@ git submodule update --init --force --recursive # update monero-core cd ./external/monero-core -git checkout tags/v0.17.0.1 -git pull --ff-only origin tags/v0.17.0.1 +git checkout tags/v0.17.1.1 +git pull --ff-only origin tags/v0.17.1.1 cd ../../ \ No newline at end of file diff --git a/external/monero-core b/external/monero-core index 1a9a984..76cc82c 160000 --- a/external/monero-core +++ b/external/monero-core @@ -1 +1 @@ -Subproject commit 1a9a984d2631b7f01637d8119c55f8effd24f72c +Subproject commit 76cc82c29234fc2805f936f0fc53d48acc9cedf7 diff --git a/src/daemon/monero_daemon_model.cpp b/src/daemon/monero_daemon_model.cpp index e261772..2a3e01f 100644 --- a/src/daemon/monero_daemon_model.cpp +++ b/src/daemon/monero_daemon_model.cpp @@ -163,24 +163,24 @@ namespace monero { void monero_block_header::merge(const std::shared_ptr& self, const std::shared_ptr& other) { if (this != self.get()) throw std::runtime_error("this != self"); if (self == other) return; - m_hash = gen_utils::reconcile(m_hash, other->m_hash); - m_height = gen_utils::reconcile(m_height, other->m_height, boost::none, boost::none, true, "block height"); // height can increase - m_timestamp = gen_utils::reconcile(m_timestamp, other->m_timestamp, boost::none, boost::none, true, "block header timestamp"); // timestamp can increase - m_size = gen_utils::reconcile(m_size, other->m_size, "block header size"); - m_weight = gen_utils::reconcile(m_weight, other->m_weight, "block header weight"); - m_long_term_weight = gen_utils::reconcile(m_long_term_weight, other->m_long_term_weight, "block header long term weight"); - m_depth = gen_utils::reconcile(m_depth, other->m_depth, "block header depth"); - m_difficulty = gen_utils::reconcile(m_difficulty, other->m_difficulty, "difficulty"); - m_cumulative_difficulty = gen_utils::reconcile(m_cumulative_difficulty, other->m_cumulative_difficulty, "m_cumulative_difficulty"); - m_major_version = gen_utils::reconcile(m_major_version, other->m_major_version, "m_major_version"); - m_minor_version = gen_utils::reconcile(m_minor_version, other->m_minor_version, "m_minor_version"); - m_nonce = gen_utils::reconcile(m_nonce, other->m_nonce, "m_nonce"); - m_miner_tx_hash = gen_utils::reconcile(m_miner_tx_hash, other->m_miner_tx_hash); + m_hash = gen_utils::reconcile(m_hash, other->m_hash, "block header m_hash"); + m_height = gen_utils::reconcile(m_height, other->m_height, boost::none, boost::none, true, "block header m_height"); // height can increase + m_timestamp = gen_utils::reconcile(m_timestamp, other->m_timestamp, boost::none, boost::none, true, "block header m_timestamp"); // timestamp can increase + m_size = gen_utils::reconcile(m_size, other->m_size, "block header m_size"); + m_weight = gen_utils::reconcile(m_weight, other->m_weight, "block header m_weight "); + m_long_term_weight = gen_utils::reconcile(m_long_term_weight, other->m_long_term_weight, "block header m_long_term_weight"); + m_depth = gen_utils::reconcile(m_depth, other->m_depth, "block header m_depth"); + m_difficulty = gen_utils::reconcile(m_difficulty, other->m_difficulty, "block header m_difficulty"); + m_cumulative_difficulty = gen_utils::reconcile(m_cumulative_difficulty, other->m_cumulative_difficulty, "block header m_cumulative_difficulty"); + m_major_version = gen_utils::reconcile(m_major_version, other->m_major_version, "block header m_major_version"); + m_minor_version = gen_utils::reconcile(m_minor_version, other->m_minor_version, "block header m_minor_version"); + m_nonce = gen_utils::reconcile(m_nonce, other->m_nonce, "block header m_nonce"); + m_miner_tx_hash = gen_utils::reconcile(m_miner_tx_hash, other->m_miner_tx_hash, "block header m_miner_tx_hash"); m_num_txs = gen_utils::reconcile(m_num_txs, other->m_num_txs, "block header m_num_txs"); - m_orphan_status = gen_utils::reconcile(m_orphan_status, other->m_orphan_status); - m_prev_hash = gen_utils::reconcile(m_prev_hash, other->m_prev_hash); + m_orphan_status = gen_utils::reconcile(m_orphan_status, other->m_orphan_status, "block header m_orphan_status"); + m_prev_hash = gen_utils::reconcile(m_prev_hash, other->m_prev_hash, "block header m_prev_hash"); m_reward = gen_utils::reconcile(m_reward, other->m_reward, "block header m_reward"); - m_pow_hash = gen_utils::reconcile(m_pow_hash, other->m_pow_hash); + m_pow_hash = gen_utils::reconcile(m_pow_hash, other->m_pow_hash, "block header m_pow_hash"); } // ----------------------------- MONERO BLOCK ------------------------------- @@ -217,8 +217,8 @@ namespace monero { monero_block_header::merge(self, other); // merge reconcilable block extensions - m_hex = gen_utils::reconcile(m_hex, other->m_hex); - m_tx_hashes = gen_utils::reconcile(m_tx_hashes, other->m_tx_hashes); + m_hex = gen_utils::reconcile(m_hex, other->m_hex, "monero block m_hex"); + m_tx_hashes = gen_utils::reconcile(m_tx_hashes, other->m_tx_hashes, "monero block m_tx_hahes"); // merge miner tx if (m_miner_tx == boost::none) m_miner_tx = other->m_miner_tx; @@ -421,38 +421,38 @@ namespace monero { } // otherwise merge tx fields - m_hash = gen_utils::reconcile(m_hash, other->m_hash); - m_version = gen_utils::reconcile(m_version, other->m_version); - m_payment_id = gen_utils::reconcile(m_payment_id, other->m_payment_id); - m_fee = gen_utils::reconcile(m_fee, other->m_fee, "tx fee"); + m_hash = gen_utils::reconcile(m_hash, other->m_hash, "tx m_hash"); + m_version = gen_utils::reconcile(m_version, other->m_version, "tx m_version"); + m_payment_id = gen_utils::reconcile(m_payment_id, other->m_payment_id, "tx m_payment_id"); + m_fee = gen_utils::reconcile(m_fee, other->m_fee, "tx tx m_fee"); m_ring_size = gen_utils::reconcile(m_ring_size, other->m_ring_size, "tx m_ring_size"); - m_is_confirmed = gen_utils::reconcile(m_is_confirmed, other->m_is_confirmed); - m_is_miner_tx = gen_utils::reconcile(m_is_miner_tx, other->m_is_miner_tx); - m_relay = gen_utils::reconcile(m_relay, other->m_relay); - m_is_relayed = gen_utils::reconcile(m_is_relayed, other->m_is_relayed); - m_is_double_spend_seen = gen_utils::reconcile(m_is_double_spend_seen, other->m_is_double_spend_seen); - m_key = gen_utils::reconcile(m_key, other->m_key); - m_full_hex = gen_utils::reconcile(m_full_hex, other->m_full_hex); - m_pruned_hex = gen_utils::reconcile(m_pruned_hex, other->m_pruned_hex); - m_prunable_hex = gen_utils::reconcile(m_prunable_hex, other->m_prunable_hex); - m_prunable_hash = gen_utils::reconcile(m_prunable_hash, other->m_prunable_hash); - m_size = gen_utils::reconcile(m_size, other->m_size, "tx size"); - m_weight = gen_utils::reconcile(m_weight, other->m_weight, "tx weight"); - //m_output_indices = gen_utils::reconcile(m_output_indices, other->m_output_indices); // TODO - m_metadata = gen_utils::reconcile(m_metadata, other->m_metadata); - m_common_tx_sets = gen_utils::reconcile(m_common_tx_sets, other->m_common_tx_sets); - //m_extra = gen_utils::reconcile(m_extra, other->m_extra); // TODO - m_rct_signatures = gen_utils::reconcile(m_rct_signatures, other->m_rct_signatures); - m_rct_sig_prunable = gen_utils::reconcile(m_rct_sig_prunable, other->m_rct_sig_prunable); - m_is_kept_by_block = gen_utils::reconcile(m_is_kept_by_block, other->m_is_kept_by_block); - m_is_failed = gen_utils::reconcile(m_is_failed, other->m_is_failed); - m_last_failed_height = gen_utils::reconcile(m_last_failed_height, other->m_last_failed_height, "m_last_failed_height"); - m_last_failed_hash = gen_utils::reconcile(m_last_failed_hash, other->m_last_failed_hash); - m_max_used_block_height = gen_utils::reconcile(m_max_used_block_height, other->m_max_used_block_height, "max_used_block_height"); - m_max_used_block_hash = gen_utils::reconcile(m_max_used_block_hash, other->m_max_used_block_hash); - //m_signatures = gen_utils::reconcile(m_signatures, other->m_signatures); // TODO - m_unlock_height = gen_utils::reconcile(m_unlock_height, other->m_unlock_height, "m_unlock_height"); - m_num_confirmations = gen_utils::reconcile(m_num_confirmations, other->m_num_confirmations, "m_num_confirmations"); + m_is_confirmed = gen_utils::reconcile(m_is_confirmed, other->m_is_confirmed, "tx m_is_confirmed"); + m_is_miner_tx = gen_utils::reconcile(m_is_miner_tx, other->m_is_miner_tx, "tx m_is_miner_tx"); + m_relay = gen_utils::reconcile(m_relay, other->m_relay, "tx m_relay"); + m_is_relayed = gen_utils::reconcile(m_is_relayed, other->m_is_relayed, "tx m_is_relayed"); + m_is_double_spend_seen = gen_utils::reconcile(m_is_double_spend_seen, other->m_is_double_spend_seen, "tx m_is_double_spend_seen"); + m_key = gen_utils::reconcile(m_key, other->m_key, "tx m_key"); + m_full_hex = gen_utils::reconcile(m_full_hex, other->m_full_hex, "tx m_full_hex"); + m_pruned_hex = gen_utils::reconcile(m_pruned_hex, other->m_pruned_hex, "tx m_pruned_hex"); + m_prunable_hex = gen_utils::reconcile(m_prunable_hex, other->m_prunable_hex, "tx m_prunable_hex"); + m_prunable_hash = gen_utils::reconcile(m_prunable_hash, other->m_prunable_hash, "tx m_prunable_hash"); + m_size = gen_utils::reconcile(m_size, other->m_size, "tx m_size"); + m_weight = gen_utils::reconcile(m_weight, other->m_weight, "tx m_weight"); + //m_output_indices = gen_utils::reconcile(m_output_indices, other->m_output_indices, "tx m_output_indices"); // TODO + m_metadata = gen_utils::reconcile(m_metadata, other->m_metadata, "tx m_metadata"); + m_common_tx_sets = gen_utils::reconcile(m_common_tx_sets, other->m_common_tx_sets, "tx m_common_tx_sets"); + //m_extra = gen_utils::reconcile(m_extra, other->m_extra, "tx m_extra"); // TODO + m_rct_signatures = gen_utils::reconcile(m_rct_signatures, other->m_rct_signatures, "tx m_rct_signatures"); + m_rct_sig_prunable = gen_utils::reconcile(m_rct_sig_prunable, other->m_rct_sig_prunable, "tx m_rct_sig_prunable"); + m_is_kept_by_block = gen_utils::reconcile(m_is_kept_by_block, other->m_is_kept_by_block, "tx m_is_kept_by_block"); + m_is_failed = gen_utils::reconcile(m_is_failed, other->m_is_failed, "tx m_is_failed"); + m_last_failed_height = gen_utils::reconcile(m_last_failed_height, other->m_last_failed_height, "tx m_last_failed_height"); + m_last_failed_hash = gen_utils::reconcile(m_last_failed_hash, other->m_last_failed_hash, "tx m_last_failed_hash"); + m_max_used_block_height = gen_utils::reconcile(m_max_used_block_height, other->m_max_used_block_height, "tx m_max_used_block_height"); + m_max_used_block_hash = gen_utils::reconcile(m_max_used_block_hash, other->m_max_used_block_hash, "tx m_max_used_block_hash"); + //m_signatures = gen_utils::reconcile(m_signatures, other->m_signatures, "tx m_signatures"); // TODO + m_unlock_height = gen_utils::reconcile(m_unlock_height, other->m_unlock_height, "tx m_unlock_height"); + m_num_confirmations = gen_utils::reconcile(m_num_confirmations, other->m_num_confirmations, "tx m_num_confirmations"); // merge inputs if (!other->m_inputs.empty()) { @@ -499,9 +499,9 @@ namespace monero { m_received_timestamp = boost::none; m_last_relayed_timestamp = boost::none; } else { - m_in_tx_pool = gen_utils::reconcile(m_in_tx_pool, other->m_in_tx_pool, boost::none, true, boost::none); // unrelayed -> tx pool - m_received_timestamp = gen_utils::reconcile(m_received_timestamp, other->m_received_timestamp, boost::none, boost::none, false, "m_received_timestamp"); // take earliest receive time - m_last_relayed_timestamp = gen_utils::reconcile(m_last_relayed_timestamp, other->m_last_relayed_timestamp, boost::none, boost::none, true, "m_last_relayed_timestamp"); // take latest relay time + m_in_tx_pool = gen_utils::reconcile(m_in_tx_pool, other->m_in_tx_pool, boost::none, true, boost::none, "tx m_in_tx_pool"); // unrelayed -> tx pool + m_received_timestamp = gen_utils::reconcile(m_received_timestamp, other->m_received_timestamp, boost::none, boost::none, false, "tx m_received_timestamp"); // take earliest receive time + m_last_relayed_timestamp = gen_utils::reconcile(m_last_relayed_timestamp, other->m_last_relayed_timestamp, boost::none, boost::none, true, "tx m_last_relayed_timestamp"); // take latest relay time } } @@ -565,8 +565,8 @@ namespace monero { MTRACE("monero_key_image::merge(self, other)"); if (this != self.get()) throw std::runtime_error("this != self"); if (self == other) return; - m_hex = gen_utils::reconcile(m_hex, other->m_hex); - m_signature = gen_utils::reconcile(m_signature, other->m_signature); + m_hex = gen_utils::reconcile(m_hex, other->m_hex, "key image m_hex"); + m_signature = gen_utils::reconcile(m_signature, other->m_signature, "key image m_signature"); } // ------------------------------ MONERO OUTPUT ----------------------------- diff --git a/src/utils/gen_utils.h b/src/utils/gen_utils.h index 07499c4..f4a64d0 100644 --- a/src/utils/gen_utils.h +++ b/src/utils/gen_utils.h @@ -58,11 +58,11 @@ #include "common/util.h" /** - * Collection of utilities for working with Monero's binary portable storage format. + * Collection of generic utilities. */ namespace gen_utils { - // ------------------------- VALUE RECONCILATION- --------------------------- + // ------------------------- VALUE RECONCILATION ---------------------------- // TODO: refactor common template code template ::value, T>::type* = nullptr> diff --git a/src/wallet/monero_wallet_core.cpp b/src/wallet/monero_wallet_core.cpp index 7daca4d..12e7c87 100644 --- a/src/wallet/monero_wallet_core.cpp +++ b/src/wallet/monero_wallet_core.cpp @@ -1574,7 +1574,10 @@ namespace monero { // special case: re-fetch txs if inconsistency caused by needing to make multiple wallet calls // TODO monero core: offer wallet.get_txs(...) for (const std::shared_ptr& tx : txs) { - if (*tx->m_is_confirmed && tx->m_block == boost::none) return get_txs(*_query, missing_tx_hashes); + 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; + return get_txs(*_query, missing_tx_hashes); + } } // if tx hashes requested, order txs and collect missing hashes diff --git a/src/wallet/monero_wallet_model.cpp b/src/wallet/monero_wallet_model.cpp index 2f6cd92..4eea7f3 100644 --- a/src/wallet/monero_wallet_model.cpp +++ b/src/wallet/monero_wallet_model.cpp @@ -275,16 +275,16 @@ namespace monero { } // merge simple extensions - m_is_incoming = gen_utils::reconcile(m_is_incoming, other->m_is_incoming); - m_is_outgoing = gen_utils::reconcile(m_is_outgoing, other->m_is_outgoing); - m_note = gen_utils::reconcile(m_note, other->m_note); - m_is_locked = gen_utils::reconcile(m_is_locked, other->m_is_locked); - m_input_sum = gen_utils::reconcile(m_input_sum, other->m_input_sum); - m_output_sum = gen_utils::reconcile(m_output_sum, other->m_output_sum); - m_change_address = gen_utils::reconcile(m_change_address, other->m_change_address); - m_change_amount = gen_utils::reconcile(m_change_amount, other->m_change_amount); - m_num_dummy_outputs = gen_utils::reconcile(m_num_dummy_outputs, other->m_num_dummy_outputs); - m_extra_hex = gen_utils::reconcile(m_extra_hex, other->m_extra_hex); + m_is_incoming = gen_utils::reconcile(m_is_incoming, other->m_is_incoming, "tx wallet m_is_incoming"); + m_is_outgoing = gen_utils::reconcile(m_is_outgoing, other->m_is_outgoing, "tx wallet m_is_outgoing"); + m_note = gen_utils::reconcile(m_note, other->m_note, "tx wallet m_note"); + m_is_locked = gen_utils::reconcile(m_is_locked, other->m_is_locked, "tx wallet m_is_locked"); + m_input_sum = gen_utils::reconcile(m_input_sum, other->m_input_sum, "tx wallet m_input_sum"); + m_output_sum = gen_utils::reconcile(m_output_sum, other->m_output_sum, "tx wallet m_output_sum"); + m_change_address = gen_utils::reconcile(m_change_address, other->m_change_address, "tx wallet m_change_address"); + m_change_amount = gen_utils::reconcile(m_change_amount, other->m_change_amount, "tx wallet m_change_amount"); + m_num_dummy_outputs = gen_utils::reconcile(m_num_dummy_outputs, other->m_num_dummy_outputs, "tx wallet m_num_dummy_outputs"); + m_extra_hex = gen_utils::reconcile(m_extra_hex, other->m_extra_hex, "tx wallet m_extra_hex"); } std::vector> monero_tx_wallet::get_transfers() const { @@ -654,7 +654,7 @@ namespace monero { } // otherwise merge transfer fields - m_account_index = gen_utils::reconcile(m_account_index, other->m_account_index, "acountIndex"); + m_account_index = gen_utils::reconcile(m_account_index, other->m_account_index, "transfer acountIndex"); // TODO monero core: failed m_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)) { @@ -703,8 +703,8 @@ namespace monero { if (self == other) return; monero_transfer::merge(self, other); m_subaddress_index = gen_utils::reconcile(m_subaddress_index, other->m_subaddress_index, "incoming transfer m_subaddress_index"); - m_address = gen_utils::reconcile(m_address, other->m_address); - m_num_suggested_confirmations = gen_utils::reconcile(m_num_suggested_confirmations, other->m_num_suggested_confirmations, boost::none, boost::none, false, "m_num_suggested_confirmations"); + m_address = gen_utils::reconcile(m_address, other->m_address, "incoming transfer m_address"); + m_num_suggested_confirmations = gen_utils::reconcile(m_num_suggested_confirmations, other->m_num_suggested_confirmations, boost::none, boost::none, false, "incoming transfer m_num_suggested_confirmations"); } // ----------------------- MONERO OUTGOING TRANSFER ------------------------- @@ -741,9 +741,9 @@ namespace monero { void monero_outgoing_transfer::merge(const std::shared_ptr& self, const std::shared_ptr& other) { if (self == other) return; monero_transfer::merge(self, other); - m_subaddress_indices = gen_utils::reconcile(m_subaddress_indices, other->m_subaddress_indices); - m_addresses = gen_utils::reconcile(m_addresses, other->m_addresses); - m_destinations = gen_utils::reconcile(m_destinations, other->m_destinations); + m_subaddress_indices = gen_utils::reconcile(m_subaddress_indices, other->m_subaddress_indices, "outgoing transfer m_subaddress_indices"); + m_addresses = gen_utils::reconcile(m_addresses, other->m_addresses, "outgoing transfer m_addresses"); + m_destinations = gen_utils::reconcile(m_destinations, other->m_destinations, "outgoing transfer m_destinations"); } // ----------------------- MONERO TRANSFER QUERY -------------------------- @@ -985,10 +985,10 @@ namespace monero { monero_output::merge(self, other); // merge output wallet extensions - m_account_index = gen_utils::reconcile(m_account_index, other->m_account_index); - m_subaddress_index = gen_utils::reconcile(m_subaddress_index, other->m_subaddress_index); - m_is_spent = gen_utils::reconcile(m_is_spent, other->m_is_spent); - m_is_frozen = gen_utils::reconcile(m_is_frozen, other->m_is_frozen); + m_account_index = gen_utils::reconcile(m_account_index, other->m_account_index, "output wallet m_account_index"); + m_subaddress_index = gen_utils::reconcile(m_subaddress_index, other->m_subaddress_index, "output wallet m_subaddress_index"); + m_is_spent = gen_utils::reconcile(m_is_spent, other->m_is_spent, "output wallet m_is_spent"); + m_is_frozen = gen_utils::reconcile(m_is_frozen, other->m_is_frozen, "output wallet m_is_frozen"); } // ------------------------ MONERO OUTPUT QUERY ---------------------------