mirror of
https://github.com/monero-project/monero.git
synced 2024-12-04 15:41:09 +02:00
Compare commits
2 Commits
c4488ab107
...
e077fd39a3
Author | SHA1 | Date | |
---|---|---|---|
|
e077fd39a3 | ||
|
087b925eda |
@ -97,9 +97,9 @@ private:
|
||||
// track uses of this enote in the blockchain in the format [ [block_height, tx_id], ... ] if `wallet2::m_track_uses` is true (default is false)
|
||||
std::vector<std::pair<std::uint64_t, std::string>> m_uses;
|
||||
|
||||
// QUESTION : Any input on these multisig members? I'd ignore them for now.
|
||||
// Multisig
|
||||
bool m_key_image_partial;
|
||||
// NOTE : These multisig members are part of wallet2 transfer_details and may need to get added here.
|
||||
/*
|
||||
std::vector<rct::key> m_multisig_k;
|
||||
std::vector<multisig_info> m_multisig_info; // one per other participant
|
||||
|
@ -1184,7 +1184,7 @@ bool WalletImpl::submitTransaction(const string &fileName) {
|
||||
|
||||
bool r = m_wallet->load_tx(fileName, transaction->m_pending_tx);
|
||||
if (!r) {
|
||||
setStatus(Status_Ok, tr("Failed to load transaction from file"));
|
||||
setStatusError(tr("Failed to load transaction from file"));
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -3582,7 +3582,7 @@ std::uint64_t WalletImpl::importKeyImages(const std::vector<std::pair<std::strin
|
||||
return false;
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
bool WalletImpl::importKeyImages(std::vector<std::string> key_images, std::size_t offset, std::unordered_set<std::size_t> selected_enotes_indices)
|
||||
bool WalletImpl::importKeyImages(const std::vector<std::string> &key_images, std::size_t offset, const std::unordered_set<std::size_t> &selected_enotes_indices)
|
||||
{
|
||||
clearStatus();
|
||||
|
||||
@ -3621,6 +3621,74 @@ void WalletImpl::setAllowMismatchedDaemonVersion(bool allow_mismatch)
|
||||
m_wallet->allow_mismatched_daemon_version(allow_mismatch);
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
bool WalletImpl::setDaemon(const std::string &daemon_address,
|
||||
const std::string &daemon_username /* = "" */,
|
||||
const std::string &daemon_password /* = "" */,
|
||||
bool trusted_daemon /* = true */,
|
||||
const std::string &ssl_support /* = "autodetect" */,
|
||||
const std::string &ssl_private_key_path /* = "" */,
|
||||
const std::string &ssl_certificate_path /* = "" */,
|
||||
const std::string &ssl_ca_file_path /* = "" */,
|
||||
const std::vector<std::string> &ssl_allowed_fingerprints_str /* = {} */,
|
||||
bool ssl_allow_any_cert /* = false */,
|
||||
const std::string &proxy /* = "" */)
|
||||
{
|
||||
clearStatus();
|
||||
|
||||
// SSL allowed fingerprints
|
||||
std::vector<std::vector<uint8_t>> ssl_allowed_fingerprints;
|
||||
ssl_allowed_fingerprints.reserve(ssl_allowed_fingerprints_str.size());
|
||||
for (const std::string &fp: ssl_allowed_fingerprints_str)
|
||||
{
|
||||
ssl_allowed_fingerprints.push_back({});
|
||||
std::vector<uint8_t> &v = ssl_allowed_fingerprints.back();
|
||||
for (auto c: fp)
|
||||
v.push_back(c);
|
||||
}
|
||||
|
||||
// SSL options
|
||||
epee::net_utils::ssl_options_t ssl_options = epee::net_utils::ssl_support_t::e_ssl_support_enabled;
|
||||
if (ssl_allow_any_cert)
|
||||
ssl_options.verification = epee::net_utils::ssl_verification_t::none;
|
||||
else if (!ssl_allowed_fingerprints.empty() || !ssl_ca_file_path.empty())
|
||||
ssl_options = epee::net_utils::ssl_options_t{std::move(ssl_allowed_fingerprints), std::move(ssl_ca_file_path)};
|
||||
|
||||
if (!epee::net_utils::ssl_support_from_string(ssl_options.support, ssl_support))
|
||||
{
|
||||
setStatusError(string(tr("Invalid ssl support option (allowed options:`disabled` | `enabled` | `autodetect`), actual value: ")) + ssl_support);
|
||||
return false;
|
||||
}
|
||||
|
||||
ssl_options.auth = epee::net_utils::ssl_authentication_t{
|
||||
std::move(ssl_private_key_path), std::move(ssl_certificate_path)
|
||||
};
|
||||
|
||||
const bool verification_required =
|
||||
ssl_options.verification != epee::net_utils::ssl_verification_t::none &&
|
||||
ssl_options.support == epee::net_utils::ssl_support_t::e_ssl_support_enabled;
|
||||
|
||||
if (verification_required && !ssl_options.has_strong_verification(boost::string_ref{}))
|
||||
{
|
||||
setStatusError(string(tr("SSL is enabled but no user certificate or fingerprints were provided")));
|
||||
return false;
|
||||
}
|
||||
|
||||
// daemon login
|
||||
if(daemon_username != "")
|
||||
m_daemon_login.emplace(daemon_username, daemon_password);
|
||||
|
||||
// set daemon
|
||||
try
|
||||
{
|
||||
return m_wallet->set_daemon(daemon_address, m_daemon_login, trusted_daemon, ssl_options, proxy);
|
||||
}
|
||||
catch (const std::exception &e)
|
||||
{
|
||||
setStatusError(string(tr("Failed to set daemon: ")) + e.what());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
//-------------------------------------------------------------------------------------------------------------------
|
||||
// PRIVATE
|
||||
|
@ -277,9 +277,10 @@ public:
|
||||
std::vector<std::tuple<std::string, std::uint16_t, std::uint64_t>> getPublicNodes(bool white_only = true) const override;
|
||||
std::pair<std::size_t, std::uint64_t> estimateTxSizeAndWeight(bool use_rct, int n_inputs, int ring_size, int n_outputs, std::size_t extra_size) const override;
|
||||
std::uint64_t importKeyImages(const std::vector<std::pair<std::string, std::string>> &signed_key_images, std::size_t offset, std::uint64_t &spent, std::uint64_t &unspent, bool check_spent = true) override;
|
||||
bool importKeyImages(std::vector<std::string> key_images, std::size_t offset = 0, std::unordered_set<std::size_t> selected_enotes_indices = {}) override;
|
||||
bool importKeyImages(const std::vector<std::string> &key_images, std::size_t offset = 0, const std::unordered_set<std::size_t> &selected_enotes_indices = {}) override;
|
||||
bool getAllowMismatchedDaemonVersion() const override;
|
||||
void setAllowMismatchedDaemonVersion(bool allow_mismatch) override;
|
||||
bool setDaemon(const std::string &daemon_address, const std::string &daemon_username = "", const std::string &daemon_password = "", bool trusted_daemon = true, const std::string &ssl_support = "autodetect", const std::string &ssl_private_key_path = "", const std::string &ssl_certificate_path = "", const std::string &ssl_ca_file_path = "", const std::vector<std::string> &ssl_allowed_fingerprints_str = {}, bool ssl_allow_any_cert = false, const std::string &proxy = "") override;
|
||||
|
||||
private:
|
||||
void clearStatus() const;
|
||||
|
@ -469,20 +469,17 @@ struct WalletListener
|
||||
* @brief If the listener is created before the wallet this enables to set created wallet object
|
||||
*/
|
||||
virtual void onSetWallet(Wallet * wallet) { (void)wallet; };
|
||||
|
||||
/**
|
||||
* @brief called on blockchain reorg
|
||||
*/
|
||||
* brief: onReorg - called on blockchain reorg
|
||||
*/
|
||||
virtual void onReorg(std::uint64_t height, std::uint64_t blocks_detached, std::size_t transfers_detached) = 0;
|
||||
|
||||
/**
|
||||
* @brief called by scan_output() to decrypt keys
|
||||
*/
|
||||
* brief: onGetPassword - called by scan_output() to decrypt keys
|
||||
*/
|
||||
virtual optional<std::string> onGetPassword(const char *reason) = 0;
|
||||
|
||||
/**
|
||||
* @brief called when obsolete pool transactions get removed
|
||||
*/
|
||||
* brief: onPoolTxRemoved - when obsolete pool transactions get removed
|
||||
*/
|
||||
virtual void onPoolTxRemoved(const std::string &txid) = 0;
|
||||
};
|
||||
|
||||
@ -1456,12 +1453,6 @@ struct Wallet
|
||||
* note: sets status error on fail
|
||||
*/
|
||||
virtual std::vector<std::pair<std::uint64_t, std::uint64_t>> estimateBacklog(const std::vector<std::pair<double, double>> &fee_levels) const = 0;
|
||||
// TODO : mms::multisig_wallet_state - from a quick search for get_multisig_wallet_state in simplewallet.cpp this will be complicated to replace
|
||||
/**
|
||||
* brief: getMultisigWalletState -
|
||||
* return:
|
||||
*/
|
||||
// virtual mms::multisig_wallet_state getMultisigWalletState() const = 0;
|
||||
/**
|
||||
* brief: saveToFile - save hex string to file
|
||||
* param: path_to_file - file name
|
||||
@ -1531,7 +1522,7 @@ struct Wallet
|
||||
* return: true if succeeded
|
||||
* note: sets status error on fail
|
||||
*/
|
||||
virtual bool importKeyImages(std::vector<std::string> key_images, std::size_t offset = 0, std::unordered_set<std::size_t> selected_enotes_indices = {}) = 0;
|
||||
virtual bool importKeyImages(const std::vector<std::string> &key_images, std::size_t offset = 0, const std::unordered_set<std::size_t> &selected_enotes_indices = {}) = 0;
|
||||
/**
|
||||
* brief: getAllowMismatchedDaemonVersion -
|
||||
*/
|
||||
@ -1541,6 +1532,33 @@ struct Wallet
|
||||
* param: allow_mismatch -
|
||||
*/
|
||||
virtual void setAllowMismatchedDaemonVersion(bool allow_mismatch) = 0;
|
||||
/**
|
||||
* brief: setDaemon -
|
||||
* param: daemon_address -
|
||||
* param: daemon_username - for daemon login (default: empty string)
|
||||
* param: daemon_password - for daemon login (default: empty string)
|
||||
* param: trusted_daemon - (default: true)
|
||||
* param: ssl_support - "disabled" | "enabled" | "autodetect" (default: "autodetect")
|
||||
* param: ssl_private_key_path - (default: empty string)
|
||||
* param: ssl_certificate_path - (default: empty string)
|
||||
* param: ssl_ca_file_path - (default: empty string)
|
||||
* param: ssl_allowed_fingerprints_str - (default: empty vector)
|
||||
* param: ssl_allow_any_cert - (default: false)
|
||||
* param: proxy - (default: empty string)
|
||||
* return: true if succeeded
|
||||
* note: sets status error on fail
|
||||
*/
|
||||
virtual bool setDaemon(const std::string &daemon_address,
|
||||
const std::string &daemon_username = "",
|
||||
const std::string &daemon_password = "",
|
||||
bool trusted_daemon = true,
|
||||
const std::string &ssl_support = "autodetect",
|
||||
const std::string &ssl_private_key_path = "",
|
||||
const std::string &ssl_certificate_path = "",
|
||||
const std::string &ssl_ca_file_path = "",
|
||||
const std::vector<std::string> &ssl_allowed_fingerprints_str = {},
|
||||
bool ssl_allow_any_cert = false,
|
||||
const std::string &proxy = "") = 0;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -231,7 +231,6 @@ std::string WalletManagerImpl::errorString() const
|
||||
return m_errorString;
|
||||
}
|
||||
|
||||
// TODO : figure out if we rather modify this to take daemon_login, trusted_daemon and ssl_options as arguments, so this function acts as a replacement for `wallet2::set_daemon()` or should we add a new `setDaemon()` to `WalletImpl`
|
||||
void WalletManagerImpl::setDaemonAddress(const std::string &address)
|
||||
{
|
||||
m_http_client.set_server(address, boost::none);
|
||||
|
Loading…
Reference in New Issue
Block a user