mirror of
https://codeberg.org/anoncontributorxmr/monero.git
synced 2024-11-23 10:37:37 -07:00
walletAPI: init() lightwallet and SSL support
This commit is contained in:
parent
dde5a1fc36
commit
79207743b8
@ -703,12 +703,13 @@ string WalletImpl::keysFilename() const
|
||||
return m_wallet->get_keys_file();
|
||||
}
|
||||
|
||||
bool WalletImpl::init(const std::string &daemon_address, uint64_t upper_transaction_size_limit, const std::string &daemon_username, const std::string &daemon_password)
|
||||
bool WalletImpl::init(const std::string &daemon_address, uint64_t upper_transaction_size_limit, const std::string &daemon_username, const std::string &daemon_password, bool use_ssl, bool lightWallet)
|
||||
{
|
||||
clearStatus();
|
||||
m_wallet->set_light_wallet(lightWallet);
|
||||
if(daemon_username != "")
|
||||
m_daemon_login.emplace(daemon_username, daemon_password);
|
||||
return doInit(daemon_address, upper_transaction_size_limit);
|
||||
return doInit(daemon_address, upper_transaction_size_limit, use_ssl);
|
||||
}
|
||||
|
||||
void WalletImpl::setRefreshFromBlockHeight(uint64_t refresh_from_block_height)
|
||||
@ -1476,13 +1477,14 @@ bool WalletImpl::isNewWallet() const
|
||||
return !(blockChainHeight() > 1 || m_recoveringFromSeed || m_rebuildWalletCache) && !watchOnly();
|
||||
}
|
||||
|
||||
bool WalletImpl::doInit(const string &daemon_address, uint64_t upper_transaction_size_limit)
|
||||
bool WalletImpl::doInit(const string &daemon_address, uint64_t upper_transaction_size_limit, bool ssl)
|
||||
{
|
||||
if (!m_wallet->init(daemon_address, m_daemon_login, upper_transaction_size_limit))
|
||||
if (!m_wallet->init(daemon_address, m_daemon_login, upper_transaction_size_limit, ssl))
|
||||
return false;
|
||||
|
||||
// in case new wallet, this will force fast-refresh (pulling hashes instead of blocks)
|
||||
// If daemon isn't synced a calculated block height will be used instead
|
||||
//TODO: Handle light wallet scenario where block height = 0.
|
||||
if (isNewWallet() && daemonSynced()) {
|
||||
LOG_PRINT_L2(__FUNCTION__ << ":New Wallet - fast refresh until " << daemonBlockChainHeight());
|
||||
m_wallet->set_refresh_from_block_height(daemonBlockChainHeight());
|
||||
|
@ -83,7 +83,7 @@ public:
|
||||
bool store(const std::string &path);
|
||||
std::string filename() const;
|
||||
std::string keysFilename() const;
|
||||
bool init(const std::string &daemon_address, uint64_t upper_transaction_size_limit = 0, const std::string &daemon_username = "", const std::string &daemon_password = "");
|
||||
bool init(const std::string &daemon_address, uint64_t upper_transaction_size_limit = 0, const std::string &daemon_username = "", const std::string &daemon_password = "", bool use_ssl = false, bool lightWallet = false);
|
||||
bool connectToDaemon();
|
||||
ConnectionStatus connected() const;
|
||||
void setTrustedDaemon(bool arg);
|
||||
@ -151,7 +151,7 @@ private:
|
||||
bool daemonSynced() const;
|
||||
void stopRefresh();
|
||||
bool isNewWallet() const;
|
||||
bool doInit(const std::string &daemon_address, uint64_t upper_transaction_size_limit);
|
||||
bool doInit(const std::string &daemon_address, uint64_t upper_transaction_size_limit = 0, bool ssl = false);
|
||||
|
||||
private:
|
||||
friend class PendingTransactionImpl;
|
||||
|
@ -427,9 +427,12 @@ struct Wallet
|
||||
*
|
||||
* \param daemon_address - daemon address in "hostname:port" format
|
||||
* \param upper_transaction_size_limit
|
||||
* \param daemon_username
|
||||
* \param daemon_password
|
||||
* \param lightWallet - start wallet in light mode, connect to a openmonero compatible server.
|
||||
* \return - true on success
|
||||
*/
|
||||
virtual bool init(const std::string &daemon_address, uint64_t upper_transaction_size_limit, const std::string &daemon_username = "", const std::string &daemon_password = "") = 0;
|
||||
virtual bool init(const std::string &daemon_address, uint64_t upper_transaction_size_limit = 0, const std::string &daemon_username = "", const std::string &daemon_password = "", bool use_ssl = false, bool lightWallet = false) = 0;
|
||||
|
||||
/*!
|
||||
* \brief createWatchOnly - Creates a watch only wallet
|
||||
|
Loading…
Reference in New Issue
Block a user