mirror of
https://git.wownero.com/wownero/wownero.git
synced 2024-12-22 23:18:55 +00:00
wallet2_api: allow connection to return "yes, but wrong version"
This commit is contained in:
parent
1372f255af
commit
63fe6fd9ba
@ -720,9 +720,15 @@ bool WalletImpl::connectToDaemon()
|
||||
return result;
|
||||
}
|
||||
|
||||
bool WalletImpl::connected() const
|
||||
Wallet::ConnectionStatus WalletImpl::connected() const
|
||||
{
|
||||
return m_wallet->check_connection();
|
||||
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 @@ 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;
|
||||
|
@ -159,6 +159,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;
|
||||
@ -243,7 +249,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;
|
||||
|
Loading…
Reference in New Issue
Block a user