aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/api/wallet.cpp
diff options
context:
space:
mode:
authorj-berman <justinberman@protonmail.com>2022-08-26 16:13:19 -0700
committerj-berman <justinberman@protonmail.com>2022-09-12 21:23:08 -0600
commit864a78ee5f5db4619c093e0dfb26bd03735d9fb1 (patch)
tree75db44fd75f9a7e037ed2325c91e5f0087258991 /src/wallet/api/wallet.cpp
parentaf4f97bf66282bb2af25b5577d9bcba4d00b00b0 (diff)
downloadmonzero-core-864a78ee5f5db4619c093e0dfb26bd03735d9fb1.tar.gz
monzero-core-864a78ee5f5db4619c093e0dfb26bd03735d9fb1.tar.xz
monzero-core-864a78ee5f5db4619c093e0dfb26bd03735d9fb1.zip
wallet2: check wallet compatibility with daemon's hard fork version
Diffstat (limited to 'src/wallet/api/wallet.cpp')
-rw-r--r--src/wallet/api/wallet.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/wallet/api/wallet.cpp b/src/wallet/api/wallet.cpp
index 807dba33b..470206bc5 100644
--- a/src/wallet/api/wallet.cpp
+++ b/src/wallet/api/wallet.cpp
@@ -2173,9 +2173,15 @@ bool WalletImpl::connectToDaemon()
Wallet::ConnectionStatus WalletImpl::connected() const
{
uint32_t version = 0;
- m_is_connected = m_wallet->check_connection(&version, NULL, DEFAULT_CONNECTION_TIMEOUT_MILLIS);
+ bool wallet_is_outdated, daemon_is_outdated = false;
+ m_is_connected = m_wallet->check_connection(&version, NULL, DEFAULT_CONNECTION_TIMEOUT_MILLIS, &wallet_is_outdated, &daemon_is_outdated);
if (!m_is_connected)
- return Wallet::ConnectionStatus_Disconnected;
+ {
+ if (!m_wallet->light_wallet() && (wallet_is_outdated || daemon_is_outdated))
+ return Wallet::ConnectionStatus_WrongVersion;
+ else
+ return Wallet::ConnectionStatus_Disconnected;
+ }
// Version check is not implemented in light wallets nodes/wallets
if (!m_wallet->light_wallet() && (version >> 16) != CORE_RPC_VERSION_MAJOR)
return Wallet::ConnectionStatus_WrongVersion;