From 0682c98728eb1aa3790dfdd3472f1c4ccd5e55c8 Mon Sep 17 00:00:00 2001 From: woodser Date: Fri, 23 Aug 2024 11:30:06 -0400 Subject: [PATCH] update to monero-project v0.18.3.4, remove unlock time config --- README.md | 2 +- external/monero-project | 2 +- src/wallet/monero_wallet_full.cpp | 15 ++++++--------- src/wallet/monero_wallet_model.cpp | 3 --- src/wallet/monero_wallet_model.h | 1 - 5 files changed, 8 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index cb873037..80af1bbb 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.18.3.3 'Fluorine Fermi'](https://github.com/monero-project/monero/tree/v0.18.3.3). +A C++ library for creating Monero applications using native bindings to [monero v0.18.3.4 'Fluorine Fermi'](https://github.com/monero-project/monero/tree/v0.18.3.4). * 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/external/monero-project b/external/monero-project index 81d4db08..b089f9ee 160000 --- a/external/monero-project +++ b/external/monero-project @@ -1 +1 @@ -Subproject commit 81d4db08eb75ce5392c65ca6571e7b08e41b7c95 +Subproject commit b089f9ee69924882c5d14dd1a6991deb05d9d1cd diff --git a/src/wallet/monero_wallet_full.cpp b/src/wallet/monero_wallet_full.cpp index 9c707266..278c6c83 100644 --- a/src/wallet/monero_wallet_full.cpp +++ b/src/wallet/monero_wallet_full.cpp @@ -1985,7 +1985,6 @@ namespace monero { // prepare parameters for wallet2's create_transactions_2() uint64_t mixin = m_w2->adjust_mixin(0); // get mixin for call to 'create_transactions_2' uint32_t priority = m_w2->adjust_priority(config.m_priority == boost::none ? 0 : config.m_priority.get()); - uint64_t unlock_time = config.m_unlock_time == boost::none ? 0 : config.m_unlock_time.get(); uint32_t account_index = config.m_account_index.get(); std::set subaddress_indices; for (const uint32_t& subaddress_idx : config.m_subaddress_indices) subaddress_indices.insert(subaddress_idx); @@ -1993,7 +1992,7 @@ namespace monero { for (const uint32_t& subtract_fee_from_idx : config.m_subtract_fee_from) subtract_fee_from.insert(subtract_fee_from_idx); // prepare transactions - std::vector ptx_vector = m_w2->create_transactions_2(dsts, mixin, unlock_time, priority, extra, account_index, subaddress_indices, subtract_fee_from); + std::vector ptx_vector = m_w2->create_transactions_2(dsts, mixin, priority, extra, account_index, subaddress_indices, subtract_fee_from); if (ptx_vector.empty()) throw std::runtime_error("No transaction created"); // check if request cannot be fulfilled due to splitting @@ -2088,7 +2087,7 @@ namespace monero { if (!tx->m_is_failed.get() && tx->m_is_relayed.get()) tx->m_is_double_spend_seen = false; // TODO: test and handle if true tx->m_num_confirmations = 0; tx->m_ring_size = monero_utils::RING_SIZE; - tx->m_unlock_time = config.m_unlock_time == boost::none ? 0 : config.m_unlock_time.get(); + tx->m_unlock_time = 0; tx->m_is_locked = true; if (tx->m_is_relayed.get()) tx->m_last_relayed_timestamp = static_cast(time(NULL)); // 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; @@ -2215,13 +2214,12 @@ namespace monero { uint64_t below_amount = config.m_below_amount == boost::none ? 0 : config.m_below_amount.get(); uint64_t mixin = m_w2->adjust_mixin(0); uint32_t priority = m_w2->adjust_priority(config.m_priority == boost::none ? 0 : config.m_priority.get()); - uint64_t unlock_time = config.m_unlock_time == boost::none ? 0 : config.m_unlock_time.get(); uint32_t account_index = config.m_account_index.get(); std::set subaddress_indices; for (const uint32_t& subaddress_idx : config.m_subaddress_indices) subaddress_indices.insert(subaddress_idx); // prepare transactions - std::vector ptx_vector = m_w2->create_transactions_all(below_amount, dsts[0].addr, dsts[0].is_subaddress, num_outputs, mixin, unlock_time, priority, extra, account_index, subaddress_indices); + std::vector ptx_vector = m_w2->create_transactions_all(below_amount, dsts[0].addr, dsts[0].is_subaddress, num_outputs, mixin, priority, extra, account_index, subaddress_indices); // config for fill_response() bool get_tx_keys = true; @@ -2295,7 +2293,7 @@ namespace monero { if (!tx->m_is_failed.get() && tx->m_is_relayed.get()) tx->m_is_double_spend_seen = false; // TODO: test and handle if true tx->m_num_confirmations = 0; tx->m_ring_size = monero_utils::RING_SIZE; - tx->m_unlock_time = config.m_unlock_time == boost::none ? 0 : config.m_unlock_time.get(); + tx->m_unlock_time = 0; if (tx->m_is_relayed.get()) tx->m_last_relayed_timestamp = static_cast(time(NULL)); // 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 @@ -2352,8 +2350,7 @@ namespace monero { // create transaction uint64_t mixin = m_w2->adjust_mixin(0); uint32_t priority = m_w2->adjust_priority(config.m_priority == boost::none ? 0 : config.m_priority.get()); - uint64_t unlock_time = config.m_unlock_time == boost::none ? 0 : config.m_unlock_time.get(); - std::vector ptx_vector = m_w2->create_transactions_single(ki, dsts[0].addr, dsts[0].is_subaddress, 1, mixin, unlock_time, priority, extra); + std::vector ptx_vector = m_w2->create_transactions_single(ki, dsts[0].addr, dsts[0].is_subaddress, 1, mixin, priority, extra); // validate created transaction if (ptx_vector.empty()) throw std::runtime_error("No outputs found"); @@ -2430,7 +2427,7 @@ namespace monero { if (!tx->m_is_failed.get() && tx->m_is_relayed.get()) tx->m_is_double_spend_seen = false; // TODO: test and handle if true tx->m_num_confirmations = 0; tx->m_ring_size = monero_utils::RING_SIZE; - tx->m_unlock_time = config.m_unlock_time == boost::none ? 0 : config.m_unlock_time.get(); + tx->m_unlock_time = 0; tx->m_is_locked = true; if (tx->m_is_relayed.get()) tx->m_last_relayed_timestamp = static_cast(time(NULL)); // 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; diff --git a/src/wallet/monero_wallet_model.cpp b/src/wallet/monero_wallet_model.cpp index acfbd4b1..6aadd378 100644 --- a/src/wallet/monero_wallet_model.cpp +++ b/src/wallet/monero_wallet_model.cpp @@ -1273,7 +1273,6 @@ namespace monero { m_fee = config.m_fee; m_account_index = config.m_account_index; m_subaddress_indices = config.m_subaddress_indices; - m_unlock_time = config.m_unlock_time; m_can_split = config.m_can_split; m_relay = config.m_relay; m_note = config.m_note; @@ -1297,7 +1296,6 @@ namespace monero { if (m_priority != boost::none) monero_utils::add_json_member("priority", m_priority.get(), allocator, root, value_num); if (m_ring_size != boost::none) monero_utils::add_json_member("ringSize", m_ring_size.get(), allocator, root, value_num); if (m_account_index != boost::none) monero_utils::add_json_member("accountIndex", m_account_index.get(), allocator, root, value_num); - if (m_unlock_time != boost::none) monero_utils::add_json_member("unlockTime", m_unlock_time.get(), allocator, root, value_num); if (m_below_amount != boost::none) monero_utils::add_json_member("belowAmount", m_below_amount.get(), allocator, root, value_num); // set string values @@ -1354,7 +1352,6 @@ namespace monero { else if (key == std::string("fee")) config->m_fee = it->second.get_value(); else if (key == std::string("accountIndex")) config->m_account_index = it->second.get_value(); else if (key == std::string("subaddressIndices")) for (boost::property_tree::ptree::const_iterator it2 = it->second.begin(); it2 != it->second.end(); ++it2) config->m_subaddress_indices.push_back(it2->second.get_value()); - else if (key == std::string("unlockTime")) config->m_unlock_time = it->second.get_value(); else if (key == std::string("canSplit")) config->m_can_split = it->second.get_value(); else if (key == std::string("relay")) config->m_relay = it->second.get_value(); else if (key == std::string("note")) config->m_note = it->second.data(); diff --git a/src/wallet/monero_wallet_model.h b/src/wallet/monero_wallet_model.h index c6d83dd6..66982c27 100644 --- a/src/wallet/monero_wallet_model.h +++ b/src/wallet/monero_wallet_model.h @@ -379,7 +379,6 @@ namespace monero { boost::optional m_fee; boost::optional m_account_index; std::vector m_subaddress_indices; - boost::optional m_unlock_time; boost::optional m_can_split; boost::optional m_relay; boost::optional m_note;