game: suggest deleting wallet cache on large reorg error

This commit is contained in:
Crypto City 2023-09-19 14:52:06 +00:00
parent 1d865d0807
commit f29b58be86
3 changed files with 16 additions and 0 deletions

View File

@ -457,6 +457,7 @@ public:
bool get_cc_lightsource(uint32_t flag, uint8_t x, uint8_t y, uint16_t h, cc::lightsource_t &lightsource);
std::shared_ptr<tools::wallet2> wallet() { boost::unique_lock<boost::mutex> lock(mutex); return internal_wallet; }
std::string get_wallet_file();
bool is_spectator() const { return spectator; }
GameWallet::Connection is_connected() const { return connection; }
std::string get_daemon_error() const { return daemon_error; }
@ -1343,6 +1344,13 @@ void GameWalletInternal::save()
}
}
std::string GameWalletInternal::get_wallet_file()
{
std::shared_ptr<tools::wallet2> w = wallet();
boost::unique_lock<boost::mutex> lock(mutex);
return w->get_wallet_file();
}
bool GameWalletInternal::deposit(const GameState *game, uint64_t amount, const std::string &name, uint8_t gender, uint8_t skin_color, uint8_t hair_color, uint8_t eye_color, uint8_t primary_color, uint8_t secondary_color, uint8_t height, uint8_t corpulence, uint8_t origin, uint8_t occupation, const std::string &invitation, uint32_t inviting_account)
{
std::shared_ptr<tools::wallet2> w = wallet();
@ -3516,6 +3524,11 @@ std::shared_ptr<tools::wallet2> GameWallet::wallet()
return internal->wallet();
}
std::string GameWallet::get_wallet_file()
{
return internal->get_wallet_file();
}
bool GameWallet::is_spectator()
{
return internal->is_spectator();

View File

@ -188,6 +188,7 @@ public:
bool sweep_cc_message_fees();
std::shared_ptr<tools::wallet2> wallet();
std::string get_wallet_file();
bool is_spectator();
Connection is_connected();
std::string get_daemon_error();

View File

@ -884,6 +884,8 @@ void UIUrho3D::UpdateNodeNotification(const std::shared_ptr<GameWallet> &w)
nodeNotificationWidget->SetVisibility(WIDGET_VISIBILITY_VISIBLE);
nodeNotificationWidget->GetWidgetByIDAndType<TBTextField>(TBIDC("state"))->SetText("Incompatible");
std::string error = w->get_daemon_error();
if (error.find("set max-reorg-depth ") != std::string::npos)
error += "\n\nOr try deleting the wallet cache:\n" + w->get_wallet_file() + "\nBut NOT the one ending in '.keys'";
nodeNotificationWidget->GetWidgetByIDAndType<TBToggleContainer>(TBIDC("error-message-container"))->SetValue(!error.empty());
nodeNotificationWidget->GetWidgetByIDAndType<TBEditField>(TBIDC("error-message"))->SetText(error.c_str());
nodeNotificationWidget->ResizeToFitContent();