mirror of
https://github.com/wownero/wownero-cpp.git
synced 2026-10-19 08:08:39 +02:00
implement getIsConnected()
This commit is contained in:
@@ -70,6 +70,10 @@ using namespace tools;
|
||||
*/
|
||||
namespace monero {
|
||||
|
||||
// ------------------------- INITIALIZE CONSTANTS ---------------------------
|
||||
|
||||
static const int DEFAULT_CONNECTION_TIMEOUT_MILLIS = 1000 * 30;
|
||||
|
||||
// ----------------------- INTERNAL PRIVATE HELPERS -----------------------
|
||||
|
||||
bool boolEquals(bool val, const boost::optional<bool>& optVal) {
|
||||
@@ -859,6 +863,31 @@ namespace monero {
|
||||
return connection;
|
||||
}
|
||||
|
||||
// TODO: could return Wallet::ConnectionStatus_Disconnected, Wallet::ConnectionStatus_WrongVersion, Wallet::ConnectionStatus_Connected like wallet.cpp::connected()
|
||||
bool MoneroWallet::getIsConnected() {
|
||||
uint32_t version = 0;
|
||||
bool isConnected = wallet2->check_connection(&version, NULL, DEFAULT_CONNECTION_TIMEOUT_MILLIS);
|
||||
if (!isConnected) return false;
|
||||
if (!wallet2->light_wallet() && (version >> 16) != CORE_RPC_VERSION_MAJOR) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
long MoneroWallet::getDaemonHeight() {
|
||||
throw runtime_error("getDaemonHeight() not implemented");
|
||||
}
|
||||
|
||||
long MoneroWallet::getDaemonTargetHeight() {
|
||||
throw runtime_error("getDaemonTargetHeight() not implemented");
|
||||
}
|
||||
|
||||
bool MoneroWallet::getIsDaemonSynced() {
|
||||
throw runtime_error("getIsDaemonSynced() not implemented");
|
||||
}
|
||||
|
||||
bool MoneroWallet::getIsSynced() {
|
||||
throw runtime_error("getIsSynced() not implemented");
|
||||
}
|
||||
|
||||
string MoneroWallet::getPath() const {
|
||||
return wallet2->path();
|
||||
}
|
||||
|
||||
@@ -225,6 +225,16 @@ namespace monero {
|
||||
*/
|
||||
shared_ptr<MoneroRpcConnection> getDaemonConnection() const;
|
||||
|
||||
bool getIsConnected();
|
||||
|
||||
long getDaemonHeight();
|
||||
|
||||
long getDaemonTargetHeight();
|
||||
|
||||
bool getIsDaemonSynced();
|
||||
|
||||
bool getIsSynced();
|
||||
|
||||
/**
|
||||
* TODO
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user