Skip to content

Commit

Permalink
update to monero-project v0.18.3.4, remove unlock time config
Browse files Browse the repository at this point in the history
  • Loading branch information
woodser committed Aug 23, 2024
1 parent b655701 commit 0682c98
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 15 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
2 changes: 1 addition & 1 deletion external/monero-project
Submodule monero-project updated 65 files
+1 −1 Makefile
+5 −5 README.md
+1 −0 contrib/epee/include/storages/portable_storage_val_converters.h
+7 −10 contrib/epee/include/string_tools.h
+3 −2 contrib/epee/src/mlog.cpp
+2 −1 contrib/epee/src/readline_buffer.cpp
+36 −52 contrib/epee/src/string_tools.cpp
+1 −1 contrib/gitian/DOCKRUN.md
+1 −1 contrib/gitian/README.md
+ src/blocks/checkpoints.dat
+1 −0 src/checkpoints/checkpoints.cpp
+2 −1 src/common/boost_serialization_helper.h
+38 −3 src/common/util.cpp
+7 −1 src/common/util.h
+1 −0 src/cryptonote_basic/verification_context.h
+1 −1 src/cryptonote_core/blockchain.cpp
+6 −6 src/cryptonote_core/cryptonote_tx_utils.cpp
+3 −3 src/cryptonote_core/cryptonote_tx_utils.h
+9 −0 src/cryptonote_core/tx_pool.cpp
+10 −3 src/cryptonote_protocol/levin_notify.cpp
+2 −1 src/cryptonote_protocol/levin_notify.h
+1 −0 src/device/device_ledger.cpp
+1 −2 src/multisig/multisig_tx_builder_ringct.cpp
+0 −1 src/multisig/multisig_tx_builder_ringct.h
+11 −11 src/p2p/net_node.inl
+2 −1 src/p2p/net_peerlist.cpp
+2 −0 src/rpc/core_rpc_server.cpp
+3 −1 src/rpc/core_rpc_server_commands_defs.h
+12 −0 src/rpc/daemon_handler.cpp
+1 −0 src/rpc/message_data_structs.h
+28 −3 src/serialization/json_object.cpp
+1 −1 src/serialization/json_object.h
+12 −129 src/simplewallet/simplewallet.cpp
+2 −4 src/simplewallet/simplewallet.h
+1 −1 src/version.cpp.in
+2 −2 src/wallet/api/wallet.cpp
+36 −38 src/wallet/wallet2.cpp
+7 −7 src/wallet/wallet2.h
+9 −6 src/wallet/wallet_errors.h
+29 −5 src/wallet/wallet_rpc_server.cpp
+2 −0 src/wallet/wallet_rpc_server_error_codes.h
+2 −2 tests/core_tests/block_validation.cpp
+1 −1 tests/core_tests/bulletproof_plus.cpp
+1 −1 tests/core_tests/bulletproofs.cpp
+6 −6 tests/core_tests/chaingen.cpp
+1 −1 tests/core_tests/chaingen.h
+1 −1 tests/core_tests/double_spend.inl
+2 −2 tests/core_tests/integer_overflow.cpp
+2 −2 tests/core_tests/multisig.cpp
+2 −2 tests/core_tests/rct.cpp
+1 −1 tests/core_tests/rct2.cpp
+1 −1 tests/core_tests/transaction_tests.cpp
+28 −1 tests/core_tests/tx_validation.cpp
+1 −1 tests/core_tests/v2_tests.cpp
+4 −4 tests/core_tests/wallet_tools.cpp
+1 −1 tests/core_tests/wallet_tools.h
+1 −1 tests/functional_tests/transactions_flow_test.cpp
+3 −3 tests/performance_tests/check_tx_signature.h
+1 −1 tests/performance_tests/construct_tx.h
+1 −1 tests/performance_tests/ge_frombytes_vartime.h
+1 −1 tests/performance_tests/ge_tobytes.h
+15 −0 tests/unit_tests/epee_utils.cpp
+63 −1 tests/unit_tests/json_serialization.cpp
+90 −0 tests/unit_tests/levin.cpp
+7 −6 tests/unit_tests/wallet_storage.cpp
15 changes: 6 additions & 9 deletions src/wallet/monero_wallet_full.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1985,15 +1985,14 @@ 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<uint32_t> subaddress_indices;
for (const uint32_t& subaddress_idx : config.m_subaddress_indices) subaddress_indices.insert(subaddress_idx);
std::set<uint32_t> subtract_fee_from;
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<wallet2::pending_tx> ptx_vector = m_w2->create_transactions_2(dsts, mixin, unlock_time, priority, extra, account_index, subaddress_indices, subtract_fee_from);
std::vector<wallet2::pending_tx> 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
Expand Down Expand Up @@ -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<uint64_t>(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;
Expand Down Expand Up @@ -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<uint32_t> subaddress_indices;
for (const uint32_t& subaddress_idx : config.m_subaddress_indices) subaddress_indices.insert(subaddress_idx);

// prepare transactions
std::vector<wallet2::pending_tx> 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<wallet2::pending_tx> 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;
Expand Down Expand Up @@ -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<uint64_t>(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
Expand Down Expand Up @@ -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<wallet2::pending_tx> ptx_vector = m_w2->create_transactions_single(ki, dsts[0].addr, dsts[0].is_subaddress, 1, mixin, unlock_time, priority, extra);
std::vector<wallet2::pending_tx> 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");
Expand Down Expand Up @@ -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<uint64_t>(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;
Expand Down
3 changes: 0 additions & 3 deletions src/wallet/monero_wallet_model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
Expand Down Expand Up @@ -1354,7 +1352,6 @@ namespace monero {
else if (key == std::string("fee")) config->m_fee = it->second.get_value<uint64_t>();
else if (key == std::string("accountIndex")) config->m_account_index = it->second.get_value<uint32_t>();
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<uint32_t>());
else if (key == std::string("unlockTime")) config->m_unlock_time = it->second.get_value<uint64_t>();
else if (key == std::string("canSplit")) config->m_can_split = it->second.get_value<bool>();
else if (key == std::string("relay")) config->m_relay = it->second.get_value<bool>();
else if (key == std::string("note")) config->m_note = it->second.data();
Expand Down
1 change: 0 additions & 1 deletion src/wallet/monero_wallet_model.h
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,6 @@ namespace monero {
boost::optional<uint64_t> m_fee;
boost::optional<uint32_t> m_account_index;
std::vector<uint32_t> m_subaddress_indices;
boost::optional<uint64_t> m_unlock_time;
boost::optional<bool> m_can_split;
boost::optional<bool> m_relay;
boost::optional<std::string> m_note;
Expand Down

0 comments on commit 0682c98

Please sign in to comment.