diff options
author | Jeffrey Ryan <jeffro256@tutanota.com> | 2023-01-28 01:20:13 -0600 |
---|---|---|
committer | jeffro256 <jeffro256@tutanota.com> | 2023-04-25 10:18:20 -0500 |
commit | d2a591d7c6ddca053b887473c9deff52c19a1aee (patch) | |
tree | 69d140b0f8b0f51fbaba1aa65970c6e550ae751e /src/wallet/wallet2.h | |
parent | Merge pull request #8719 (diff) | |
download | monero-d2a591d7c6ddca053b887473c9deff52c19a1aee.tar.xz |
wallet, simplewallet: Drop support for mine-to-use RPC system
Using post-PR wallet with pre-PR node will generate error message specific to this PR and not generic "command failed" mesages.
Diffstat (limited to 'src/wallet/wallet2.h')
-rw-r--r-- | src/wallet/wallet2.h | 41 |
1 files changed, 4 insertions, 37 deletions
diff --git a/src/wallet/wallet2.h b/src/wallet/wallet2.h index 142c8edea..5144ff95e 100644 --- a/src/wallet/wallet2.h +++ b/src/wallet/wallet2.h @@ -71,14 +71,12 @@ #include "node_rpc_proxy.h" #include "message_store.h" #include "wallet_light_rpc.h" -#include "wallet_rpc_helpers.h" #undef MONERO_DEFAULT_LOG_CATEGORY #define MONERO_DEFAULT_LOG_CATEGORY "wallet.wallet2" #define THROW_ON_RPC_RESPONSE_ERROR(r, error, res, method, ...) \ do { \ - handle_payment_changes(res, std::integral_constant<bool, HasCredits<decltype(res)>::Has>()); \ throw_on_rpc_response_error(r, error, res.status, method); \ THROW_WALLET_EXCEPTION_IF(res.status != CORE_RPC_STATUS_OK, ## __VA_ARGS__); \ } while(0) @@ -1234,7 +1232,8 @@ private: a & m_cold_key_images.parent(); if(ver < 29) return; - a & m_rpc_client_secret_key; + crypto::secret_key dummy_rpc_client_secret_key; // Compatibility for old RPC payment system + a & dummy_rpc_client_secret_key; if(ver < 30) { m_has_ever_refreshed_from_node = false; @@ -1270,7 +1269,8 @@ private: FIELD(m_tx_device) FIELD(m_device_last_key_image_sync) FIELD(m_cold_key_images) - FIELD(m_rpc_client_secret_key) + crypto::secret_key dummy_rpc_client_secret_key; // Compatibility for old RPC payment system + FIELD_N("m_rpc_client_secret_key", dummy_rpc_client_secret_key) if (version < 1) { m_has_ever_refreshed_from_node = false; @@ -1354,14 +1354,6 @@ private: inline void set_export_format(const ExportFormat& export_format) { m_export_format = export_format; } bool load_deprecated_formats() const { return m_load_deprecated_formats; } void load_deprecated_formats(bool load) { m_load_deprecated_formats = load; } - bool persistent_rpc_client_id() const { return m_persistent_rpc_client_id; } - void persistent_rpc_client_id(bool persistent) { m_persistent_rpc_client_id = persistent; } - void auto_mine_for_rpc_payment_threshold(float threshold) { m_auto_mine_for_rpc_payment_threshold = threshold; } - float auto_mine_for_rpc_payment_threshold() const { return m_auto_mine_for_rpc_payment_threshold; } - crypto::secret_key get_rpc_client_secret_key() const { return m_rpc_client_secret_key; } - void set_rpc_client_secret_key(const crypto::secret_key &key) { m_rpc_client_secret_key = key; m_node_rpc_proxy.set_client_secret_key(key); } - uint64_t credits_target() const { return m_credits_target; } - void credits_target(uint64_t threshold) { m_credits_target = threshold; } bool is_multisig_enabled() const { return m_enable_multisig; } void enable_multisig(bool enable) { m_enable_multisig = enable; } bool is_mismatched_daemon_version_allowed() const { return m_allow_mismatched_daemon_version; } @@ -1545,21 +1537,6 @@ private: std::pair<size_t, uint64_t> estimate_tx_size_and_weight(bool use_rct, int n_inputs, int ring_size, int n_outputs, size_t extra_size); - bool get_rpc_payment_info(bool mining, bool &payment_required, uint64_t &credits, uint64_t &diff, uint64_t &credits_per_hash_found, cryptonote::blobdata &hashing_blob, uint64_t &height, uint64_t &seed_height, crypto::hash &seed_hash, crypto::hash &next_seed_hash, uint32_t &cookie); - bool daemon_requires_payment(); - bool make_rpc_payment(uint32_t nonce, uint32_t cookie, uint64_t &credits, uint64_t &balance); - bool search_for_rpc_payment(uint64_t credits_target, uint32_t n_threads, const std::function<bool(uint64_t, uint64_t)> &startfunc, const std::function<bool(unsigned)> &contfunc, const std::function<bool(uint64_t)> &foundfunc = NULL, const std::function<void(const std::string&)> &errorfunc = NULL); - template<typename T> void handle_payment_changes(const T &res, std::true_type) { - if (res.status == CORE_RPC_STATUS_OK || res.status == CORE_RPC_STATUS_PAYMENT_REQUIRED) - m_rpc_payment_state.credits = res.credits; - if (res.top_hash != m_rpc_payment_state.top_hash) - { - m_rpc_payment_state.top_hash = res.top_hash; - m_rpc_payment_state.stale = true; - } - } - template<typename T> void handle_payment_changes(const T &res, std::false_type) {} - // Light wallet specific functions // fetch unspent outs from lw node and store in m_transfers void light_wallet_get_unspent_outs(); @@ -1674,9 +1651,6 @@ private: void set_offline(bool offline = true); bool is_offline() const { return m_offline; } - uint64_t credits() const { return m_rpc_payment_state.credits; } - void credit_report(uint64_t &expected_spent, uint64_t &discrepancy) const { expected_spent = m_rpc_payment_state.expected_spent; discrepancy = m_rpc_payment_state.discrepancy; } - static std::string get_default_daemon_address() { CRITICAL_REGION_LOCAL(default_daemon_address_lock); return default_daemon_address; } private: @@ -1785,9 +1759,6 @@ private: std::string get_rpc_status(const std::string &s) const; void throw_on_rpc_response_error(bool r, const epee::json_rpc::error &error, const std::string &status, const char *method) const; - std::string get_client_signature() const; - void check_rpc_cost(const char *call, uint64_t post_call_credits, uint64_t pre_credits, double expected_cost); - bool should_expand(const cryptonote::subaddress_index &index) const; bool spends_one_of_ours(const cryptonote::transaction &tx) const; @@ -1874,7 +1845,6 @@ private: bool m_show_wallet_name_when_locked; uint32_t m_inactivity_lock_timeout; BackgroundMiningSetupType m_setup_background_mining; - bool m_persistent_rpc_client_id; float m_auto_mine_for_rpc_payment_threshold; bool m_is_initialized; NodeRPCProxy m_node_rpc_proxy; @@ -1886,9 +1856,6 @@ private: bool m_use_dns; bool m_offline; uint32_t m_rpc_version; - crypto::secret_key m_rpc_client_secret_key; - rpc_payment_state_t m_rpc_payment_state; - uint64_t m_credits_target; bool m_enable_multisig; bool m_allow_mismatched_daemon_version; |