Skip to content
Permalink
Browse files

Merge pull request #1302

63fe6fd wallet2_api: allow connection to return "yes, but wrong version" (moneromooo-monero)
  • Loading branch information...
fluffypony committed Nov 8, 2016
2 parents 96e0138 + 63fe6fd commit 7c7a6cf2f8b8cb2675f7f2eab972c2db981ac6a8
Showing with 17 additions and 5 deletions.
  1. +9 −3 src/wallet/api/wallet.cpp
  2. +1 −1 src/wallet/api/wallet.h
  3. +7 −1 src/wallet/wallet2_api.h
@@ -760,9 +760,15 @@ bool WalletImpl::connectToDaemon()
return result;
}

bool WalletImpl::connected() const
{
return m_wallet->check_connection();
Wallet::ConnectionStatus WalletImpl::connected() const
{
bool same_version = false;
bool is_connected = m_wallet->check_connection(&same_version);
if (!is_connected)
return Wallet::ConnectionStatus_Disconnected;
if (!same_version)
return Wallet::ConnectionStatus_WrongVersion;
return Wallet::ConnectionStatus_Connected;
}

void WalletImpl::setTrustedDaemon(bool arg)
@@ -70,7 +70,7 @@ class WalletImpl : public Wallet
bool init(const std::string &daemon_address, uint64_t upper_transaction_size_limit);
void initAsync(const std::string &daemon_address, uint64_t upper_transaction_size_limit);
bool connectToDaemon();
bool connected() const;
ConnectionStatus connected() const;
void setTrustedDaemon(bool arg);
bool trustedDaemon() const;
uint64_t balance() const;
@@ -160,6 +160,12 @@ struct Wallet
Status_Error
};

enum ConnectionStatus {
ConnectionStatus_Disconnected,
ConnectionStatus_Connected,
ConnectionStatus_WrongVersion
};

virtual ~Wallet() = 0;
virtual std::string seed() const = 0;
virtual std::string getSeedLanguage() const = 0;
@@ -244,7 +250,7 @@ struct Wallet
* @brief connected - checks if the wallet connected to the daemon
* @return - true if connected
*/
virtual bool connected() const = 0;
virtual ConnectionStatus connected() const = 0;
virtual void setTrustedDaemon(bool arg) = 0;
virtual bool trustedDaemon() const = 0;
virtual uint64_t balance() const = 0;

0 comments on commit 7c7a6cf

Please sign in to comment.
You can’t perform that action at this time.