diff options
author | Riccardo Spagni <ric@spagni.net> | 2016-11-08 22:53:13 +0200 |
---|---|---|
committer | Riccardo Spagni <ric@spagni.net> | 2016-11-08 22:53:13 +0200 |
commit | 7c7a6cf2f8b8cb2675f7f2eab972c2db981ac6a8 (patch) | |
tree | 1de659803d1ea4859e787ddcac54fe8281bb8ce4 /src/wallet/api | |
parent | Merge pull request #1301 (diff) | |
parent | wallet2_api: allow connection to return "yes, but wrong version" (diff) | |
download | monero-7c7a6cf2f8b8cb2675f7f2eab972c2db981ac6a8.tar.xz |
Merge pull request #1302
63fe6fd wallet2_api: allow connection to return "yes, but wrong version" (moneromooo-monero)
Diffstat (limited to 'src/wallet/api')
-rw-r--r-- | src/wallet/api/wallet.cpp | 12 | ||||
-rw-r--r-- | src/wallet/api/wallet.h | 2 |
2 files changed, 10 insertions, 4 deletions
diff --git a/src/wallet/api/wallet.cpp b/src/wallet/api/wallet.cpp index 3c472b410..fb56a347f 100644 --- a/src/wallet/api/wallet.cpp +++ b/src/wallet/api/wallet.cpp @@ -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) diff --git a/src/wallet/api/wallet.h b/src/wallet/api/wallet.h index 7973349ca..3f6d2ac7b 100644 --- a/src/wallet/api/wallet.h +++ b/src/wallet/api/wallet.h @@ -70,7 +70,7 @@ public: 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; |