DragonX compatibility: crash fixes, reorg detection, server failover, sync perf

- Fix Rust FFI panics with catch_unwind wrappers and safe CString handling
- Handle poisoned mutex/RwLock from prior panics instead of crashing
- Add stuck sync detection (10s stall threshold) and chain reorg user prompt
- Add "Skip Verification" button to seed phrase wizard
- Update payment URIs from hush: to drgx:
- Update branding strings throughout UI
- Add all 6 lite servers (lite, lite1-5.dragonx.is) with random selection
- Add server connectivity probing to skip unreachable servers
- Reuse Tokio runtime across block fetch batches to reduce sync overhead
- Update Cargo.lock dependencies
This commit is contained in:
2026-03-21 03:43:23 -05:00
parent b0d7319182
commit cd5a9f3736
283 changed files with 124331 additions and 124080 deletions

View File

@@ -1,172 +1,172 @@
// Copyright 2019-2024 The Hush developers
// Released under the GPLv3
#include "ChatDataStore.h"
#include "addressbook.h"
#include "chatmodel.h"
ChatDataStore* ChatDataStore::getInstance()
{
if(!ChatDataStore::instanced)
{
ChatDataStore::instanced = true;
ChatDataStore::instance = new ChatDataStore();
}
return ChatDataStore::instance;
}
void ChatDataStore::clear()
{
this->data.clear();
}
void ChatDataStore::setData(QString key, ChatItem value)
{
this->data[key] = value;
}
ChatItem ChatDataStore::getData(QString key)
{
return this->data[key];
}
QString ChatDataStore::getPassword()
{
return _password;
}
QString ChatDataStore::getSendZaddr()
{
return _zaddr;
}
void ChatDataStore::setSendZaddr(QString zaddr)
{
_zaddr = zaddr;
}
void ChatDataStore::setPassword(QString password)
{
_password = password;
}
QString ChatDataStore::dump()
{
json chats;
chats["count"] = this->data.size();
json j = {};
for (auto &c: this->data)
{
j.push_back(c.second.toJson());
}
chats["chatitems"] = j;
return QString::fromStdString(chats.dump());
}
std::map<QString, ChatItem> ChatDataStore::getAllRawChatItems()
{
return this->data;
}
std::map<QString, ChatItem> ChatDataStore::getAllNewContactRequests()
{
std::map<QString, ChatItem> filteredItems;
for(auto &c: this->data)
{
if (
(c.second.isOutgoing() == false) &&
(c.second.getType() == "Cont") &&
(c.second.isContact() == false) &&
(c.second.getMemo().startsWith("{"))
)
{
filteredItems[c.first] = c.second;
}
}
return filteredItems;
}
std::map<QString, ChatItem> ChatDataStore::getAllOldContactRequests()
{
std::map<QString, ChatItem> filteredItems;
for(auto &c: this->data)
{
if (
(c.second.isOutgoing() == false) &&
(c.second.getType() == "Cont") &&
(c.second.isContact() == true) &&
(c.second.getMemo().startsWith("{"))
)
{
filteredItems[c.first] = c.second;
}
}
return filteredItems;
}
std::map<QString, ChatItem> ChatDataStore::getAllCashMemosIncoming()
{
std::map<QString, ChatItem> filteredItems;
for(auto &c: this->data)
{
if (
(c.second.isOutgoing() == false) &&
(c.second.getType() == "Money") &&
(c.second.getMemo().startsWith("{"))
)
{
filteredItems[c.first] = c.second;
}
}
return filteredItems;
}
std::map<QString, ChatItem> ChatDataStore::getAllCashMemosOutgoing()
{
std::map<QString, ChatItem> filteredItems;
for(auto &c: this->data)
{
if (
(c.second.isOutgoing() == true) &&
(c.second.getType() == "Money") &&
(c.second.getMemo().startsWith("{"))
)
{
filteredItems[c.first] = c.second;
}
}
return filteredItems;
}
std::map<QString, ChatItem> ChatDataStore::getAllMemos()
{
std::map<QString, ChatItem> filteredItems;
for(auto &c: this->data)
{
if ((c.second.getMemo().startsWith("{") == false) && (c.second.getMemo().isEmpty() == false) ) {
filteredItems[c.first] = c.second;
}
}
return filteredItems;
}
ChatDataStore* ChatDataStore::instance = nullptr;
bool ChatDataStore::instanced = false;
// Copyright 2019-2024 The Hush developers
// Released under the GPLv3
#include "ChatDataStore.h"
#include "addressbook.h"
#include "chatmodel.h"
ChatDataStore* ChatDataStore::getInstance()
{
if(!ChatDataStore::instanced)
{
ChatDataStore::instanced = true;
ChatDataStore::instance = new ChatDataStore();
}
return ChatDataStore::instance;
}
void ChatDataStore::clear()
{
this->data.clear();
}
void ChatDataStore::setData(QString key, ChatItem value)
{
this->data[key] = value;
}
ChatItem ChatDataStore::getData(QString key)
{
return this->data[key];
}
QString ChatDataStore::getPassword()
{
return _password;
}
QString ChatDataStore::getSendZaddr()
{
return _zaddr;
}
void ChatDataStore::setSendZaddr(QString zaddr)
{
_zaddr = zaddr;
}
void ChatDataStore::setPassword(QString password)
{
_password = password;
}
QString ChatDataStore::dump()
{
json chats;
chats["count"] = this->data.size();
json j = {};
for (auto &c: this->data)
{
j.push_back(c.second.toJson());
}
chats["chatitems"] = j;
return QString::fromStdString(chats.dump());
}
std::map<QString, ChatItem> ChatDataStore::getAllRawChatItems()
{
return this->data;
}
std::map<QString, ChatItem> ChatDataStore::getAllNewContactRequests()
{
std::map<QString, ChatItem> filteredItems;
for(auto &c: this->data)
{
if (
(c.second.isOutgoing() == false) &&
(c.second.getType() == "Cont") &&
(c.second.isContact() == false) &&
(c.second.getMemo().startsWith("{"))
)
{
filteredItems[c.first] = c.second;
}
}
return filteredItems;
}
std::map<QString, ChatItem> ChatDataStore::getAllOldContactRequests()
{
std::map<QString, ChatItem> filteredItems;
for(auto &c: this->data)
{
if (
(c.second.isOutgoing() == false) &&
(c.second.getType() == "Cont") &&
(c.second.isContact() == true) &&
(c.second.getMemo().startsWith("{"))
)
{
filteredItems[c.first] = c.second;
}
}
return filteredItems;
}
std::map<QString, ChatItem> ChatDataStore::getAllCashMemosIncoming()
{
std::map<QString, ChatItem> filteredItems;
for(auto &c: this->data)
{
if (
(c.second.isOutgoing() == false) &&
(c.second.getType() == "Money") &&
(c.second.getMemo().startsWith("{"))
)
{
filteredItems[c.first] = c.second;
}
}
return filteredItems;
}
std::map<QString, ChatItem> ChatDataStore::getAllCashMemosOutgoing()
{
std::map<QString, ChatItem> filteredItems;
for(auto &c: this->data)
{
if (
(c.second.isOutgoing() == true) &&
(c.second.getType() == "Money") &&
(c.second.getMemo().startsWith("{"))
)
{
filteredItems[c.first] = c.second;
}
}
return filteredItems;
}
std::map<QString, ChatItem> ChatDataStore::getAllMemos()
{
std::map<QString, ChatItem> filteredItems;
for(auto &c: this->data)
{
if ((c.second.getMemo().startsWith("{") == false) && (c.second.getMemo().isEmpty() == false) ) {
filteredItems[c.first] = c.second;
}
}
return filteredItems;
}
ChatDataStore* ChatDataStore::instance = nullptr;
bool ChatDataStore::instanced = false;

View File

@@ -1,52 +1,52 @@
// Copyright 2019-2024 The Hush developers
// Released under the GPLv3
#ifndef CHATDATASTORE_H
#define CHATDATASTORE_H
#include "../chatmodel.h"
using json = nlohmann::json;
class ChatDataStore
{
private:
static bool instanced;
static ChatDataStore* instance;
Ui::MainWindow* ui;
MainWindow* main;
std::map<QString, ChatItem> data;
ChatDataStore()
{
}
public:
static ChatDataStore* getInstance();
void clear();
void setData(QString key, ChatItem value);
ChatItem getData(QString key);
std::map<QString, ChatItem> getAllRawChatItems();
std::map<QString, ChatItem> getAllNewContactRequests();
std::map<QString, ChatItem> getAllCashMemosOutgoing();
std::map<QString, ChatItem> getAllCashMemosIncoming();
std::map<QString, ChatItem> getAllOldContactRequests();
std::map<QString, ChatItem> getAllMemos();
QString getPassword();
QString getSendZaddr();
void setSendZaddr(QString Password);
QString _password;
void setPassword(QString zaddr);
QString _zaddr;
QString dump();
~ChatDataStore()
{
ChatDataStore::instanced = false;
ChatDataStore::instance = nullptr;
}
};
#endif
// Copyright 2019-2024 The Hush developers
// Released under the GPLv3
#ifndef CHATDATASTORE_H
#define CHATDATASTORE_H
#include "../chatmodel.h"
using json = nlohmann::json;
class ChatDataStore
{
private:
static bool instanced;
static ChatDataStore* instance;
Ui::MainWindow* ui;
MainWindow* main;
std::map<QString, ChatItem> data;
ChatDataStore()
{
}
public:
static ChatDataStore* getInstance();
void clear();
void setData(QString key, ChatItem value);
ChatItem getData(QString key);
std::map<QString, ChatItem> getAllRawChatItems();
std::map<QString, ChatItem> getAllNewContactRequests();
std::map<QString, ChatItem> getAllCashMemosOutgoing();
std::map<QString, ChatItem> getAllCashMemosIncoming();
std::map<QString, ChatItem> getAllOldContactRequests();
std::map<QString, ChatItem> getAllMemos();
QString getPassword();
QString getSendZaddr();
void setSendZaddr(QString Password);
QString _password;
void setPassword(QString zaddr);
QString _zaddr;
QString dump();
~ChatDataStore()
{
ChatDataStore::instanced = false;
ChatDataStore::instance = nullptr;
}
};
#endif

View File

@@ -1,50 +1,50 @@
// Copyright 2019-2024 The Hush developers
// GPLv3
#include "ContactDataStore.h"
#include <string>
ContactDataStore* ContactDataStore::getInstance()
{
if(!ContactDataStore::instanced)
{
ContactDataStore::instanced = true;
ContactDataStore::instance = new ContactDataStore();
}
return ContactDataStore::instance;
}
void ContactDataStore::clear()
{
this->data.clear();
}
void ContactDataStore::setData(QString key, ContactItem value)
{
this->data[key] = value;
}
ContactItem ContactDataStore::getData(QString key)
{
return this->data[key];
}
QString ContactDataStore::dump()
{
json contacts;
contacts["count"] = this->data.size();
json j = {};
for (auto &c: this->data)
{
qDebug() << c.second.toQTString();
c.second.toJson();
j.push_back(c.second.toJson());
}
contacts["contacts"] = j;
return QString::fromStdString(contacts.dump(4));
}
ContactDataStore* ContactDataStore::instance = nullptr;
bool ContactDataStore::instanced = false;
// Copyright 2019-2024 The Hush developers
// GPLv3
#include "ContactDataStore.h"
#include <string>
ContactDataStore* ContactDataStore::getInstance()
{
if(!ContactDataStore::instanced)
{
ContactDataStore::instanced = true;
ContactDataStore::instance = new ContactDataStore();
}
return ContactDataStore::instance;
}
void ContactDataStore::clear()
{
this->data.clear();
}
void ContactDataStore::setData(QString key, ContactItem value)
{
this->data[key] = value;
}
ContactItem ContactDataStore::getData(QString key)
{
return this->data[key];
}
QString ContactDataStore::dump()
{
json contacts;
contacts["count"] = this->data.size();
json j = {};
for (auto &c: this->data)
{
qDebug() << c.second.toQTString();
c.second.toJson();
j.push_back(c.second.toJson());
}
contacts["contacts"] = j;
return QString::fromStdString(contacts.dump(4));
}
ContactDataStore* ContactDataStore::instance = nullptr;
bool ContactDataStore::instanced = false;

View File

@@ -1,36 +1,36 @@
// Copyright 2019-2024 The Hush developers
// Released under the GPLv3
#ifndef CONTACTDATASTORE_H
#define CONTACTDATASTORE_H
#include "../Model/ContactItem.h"
#include <string>
using json = nlohmann::json;
class ContactDataStore
{
private:
static bool instanced;
static ContactDataStore* instance;
std::map<QString, ContactItem> data;
ContactDataStore()
{
}
public:
static ContactDataStore* getInstance();
void clear();
void setData(QString key, ContactItem value);
ContactItem getData(QString key);
QString dump();
~ContactDataStore()
{
ContactDataStore::instanced = false;
ContactDataStore::instance = nullptr;
}
};
#endif
// Copyright 2019-2024 The Hush developers
// Released under the GPLv3
#ifndef CONTACTDATASTORE_H
#define CONTACTDATASTORE_H
#include "../Model/ContactItem.h"
#include <string>
using json = nlohmann::json;
class ContactDataStore
{
private:
static bool instanced;
static ContactDataStore* instance;
std::map<QString, ContactItem> data;
ContactDataStore()
{
}
public:
static ContactDataStore* getInstance();
void clear();
void setData(QString key, ContactItem value);
ContactItem getData(QString key);
QString dump();
~ContactDataStore()
{
ContactDataStore::instanced = false;
ContactDataStore::instance = nullptr;
}
};
#endif

View File

@@ -1,60 +1,60 @@
// Copyright 2019-2024 The Hush developers
// Released under the GPLv3
#ifndef DATASTORE_H
#define DATASTORE_H
#include <QString>
#include <map>
template <class T>
class DataStore
{
private:
static bool instanced;
static DataStore<T>* instance;
std::map<QString, T> data;
DataStore()
{
}
public:
static DataStore<T>* getInstance()
{
if(!DataStore<T>::instanced)
{
DataStore<T>::instanced = true;
DataStore<T>::instance = new DataStore<T>();
}
return DataStore<T>::instance;
}
void clear();
void setData(QString key, T value);
QString getData(QString key);
~DataStore()
{
DataStore<T>::instanced = false;
}
};
template <class T>
void DataStore<T>::clear()
{
this->data.clear();
}
template <class T>
void DataStore<T>::setData(QString key, T value)
{
this->data[key] = value;
}
template <class T>
QString DataStore<T>::getData(QString key)
{
return this->data[key];
}
#endif
// Copyright 2019-2024 The Hush developers
// Released under the GPLv3
#ifndef DATASTORE_H
#define DATASTORE_H
#include <QString>
#include <map>
template <class T>
class DataStore
{
private:
static bool instanced;
static DataStore<T>* instance;
std::map<QString, T> data;
DataStore()
{
}
public:
static DataStore<T>* getInstance()
{
if(!DataStore<T>::instanced)
{
DataStore<T>::instanced = true;
DataStore<T>::instance = new DataStore<T>();
}
return DataStore<T>::instance;
}
void clear();
void setData(QString key, T value);
QString getData(QString key);
~DataStore()
{
DataStore<T>::instanced = false;
}
};
template <class T>
void DataStore<T>::clear()
{
this->data.clear();
}
template <class T>
void DataStore<T>::setData(QString key, T value)
{
this->data[key] = value;
}
template <class T>
QString DataStore<T>::getData(QString key)
{
return this->data[key];
}
#endif

View File

@@ -1,23 +1,23 @@
// Copyright 2019-2024 The Hush developers
// Released under the GPLv3
#include "DataStore.h"
SietchDataStore* DataStore::getSietchDataStore()
{
return SietchDataStore::getInstance();
}
NoteCountDataStore* DataStore::getNoteCountDataStore()
{
return NoteCountDataStore::getInstance();
}
ChatDataStore* DataStore::getChatDataStore()
{
return ChatDataStore::getInstance();
}
ContactDataStore* DataStore::getContactDataStore()
{
return ContactDataStore::getInstance();
}
// Copyright 2019-2024 The Hush developers
// Released under the GPLv3
#include "DataStore.h"
SietchDataStore* DataStore::getSietchDataStore()
{
return SietchDataStore::getInstance();
}
NoteCountDataStore* DataStore::getNoteCountDataStore()
{
return NoteCountDataStore::getInstance();
}
ChatDataStore* DataStore::getChatDataStore()
{
return ChatDataStore::getInstance();
}
ContactDataStore* DataStore::getContactDataStore()
{
return ContactDataStore::getInstance();
}

View File

@@ -1,20 +1,20 @@
// Copyright 2019-2024 The Hush developers
// Released under the GPLv3
#ifndef DATASTORE_H
#define DATASTORE_H
#include "SietchDataStore.h"
#include "NoteCountDataStore.h"
#include "ChatDataStore.h"
#include "ContactDataStore.h"
class DataStore
{
public:
static SietchDataStore* getSietchDataStore();
static NoteCountDataStore* getNoteCountDataStore();
static ChatDataStore* getChatDataStore();
static ContactDataStore* getContactDataStore();
};
#endif
// Copyright 2019-2024 The Hush developers
// Released under the GPLv3
#ifndef DATASTORE_H
#define DATASTORE_H
#include "SietchDataStore.h"
#include "NoteCountDataStore.h"
#include "ChatDataStore.h"
#include "ContactDataStore.h"
class DataStore
{
public:
static SietchDataStore* getSietchDataStore();
static NoteCountDataStore* getNoteCountDataStore();
static ChatDataStore* getChatDataStore();
static ContactDataStore* getContactDataStore();
};
#endif

View File

@@ -1,51 +1,51 @@
#include "NoteCountDataStore.h"
NoteCountDataStore* NoteCountDataStore::instance = nullptr;
bool NoteCountDataStore::instanced = false;
NoteCountDataStore* NoteCountDataStore::getInstance() {
if (!instanced) {
instanced = true;
instance = new NoteCountDataStore();
}
return instance;
}
void NoteCountDataStore::clear() {
data.clear();
}
void NoteCountDataStore::setData(const QString& key, const QString& value) {
data[key] = value;
}
QString NoteCountDataStore::getData(const QString& key) {
return data.value(key);
}
QString NoteCountDataStore::dump() {
QString result;
for (const auto& key : data.keys()) {
result += key + ": " + data[key] + "\n";
}
return result;
}
void NoteCountDataStore::setSpendableNotesCount(int count) {
spendableNotesCount = count;
}
int NoteCountDataStore::getSpendableNotesCount() const {
return spendableNotesCount;
}
void NoteCountDataStore::setAddressWithMaxValue(const QString& address, int value) {
if (value > maxValue) {
maxValue = value;
addressWithMaxValue = address;
}
}
QString NoteCountDataStore::getAddressWithMaxValue() const {
return addressWithMaxValue;
}
#include "NoteCountDataStore.h"
NoteCountDataStore* NoteCountDataStore::instance = nullptr;
bool NoteCountDataStore::instanced = false;
NoteCountDataStore* NoteCountDataStore::getInstance() {
if (!instanced) {
instanced = true;
instance = new NoteCountDataStore();
}
return instance;
}
void NoteCountDataStore::clear() {
data.clear();
}
void NoteCountDataStore::setData(const QString& key, const QString& value) {
data[key] = value;
}
QString NoteCountDataStore::getData(const QString& key) {
return data.value(key);
}
QString NoteCountDataStore::dump() {
QString result;
for (const auto& key : data.keys()) {
result += key + ": " + data[key] + "\n";
}
return result;
}
void NoteCountDataStore::setSpendableNotesCount(int count) {
spendableNotesCount = count;
}
int NoteCountDataStore::getSpendableNotesCount() const {
return spendableNotesCount;
}
void NoteCountDataStore::setAddressWithMaxValue(const QString& address, int value) {
if (value > maxValue) {
maxValue = value;
addressWithMaxValue = address;
}
}
QString NoteCountDataStore::getAddressWithMaxValue() const {
return addressWithMaxValue;
}

View File

@@ -1,36 +1,36 @@
#ifndef NOTECOUNTDATASTORE_H
#define NOTECOUNTDATASTORE_H
#include <QString>
#include <QMap>
class NoteCountDataStore {
private:
static NoteCountDataStore* instance;
static bool instanced;
QMap<QString, QString> data;
int spendableNotesCount;
QString addressWithMaxValue;
int maxValue; // Hinzugefügt, um den maximalen Wert zu speichern
NoteCountDataStore() : spendableNotesCount(0), maxValue(0) {} // Initialisiere maxValue
public:
static NoteCountDataStore* getInstance();
void clear();
void setData(const QString& key, const QString& value);
QString getData(const QString& key);
QString dump();
void setSpendableNotesCount(int count);
int getSpendableNotesCount() const;
void setAddressWithMaxValue(const QString& address, int value);
QString getAddressWithMaxValue() const;
~NoteCountDataStore() {
instanced = false;
instance = nullptr;
}
};
#endif // NOTECOUNTDATASTORE_H
#ifndef NOTECOUNTDATASTORE_H
#define NOTECOUNTDATASTORE_H
#include <QString>
#include <QMap>
class NoteCountDataStore {
private:
static NoteCountDataStore* instance;
static bool instanced;
QMap<QString, QString> data;
int spendableNotesCount;
QString addressWithMaxValue;
int maxValue; // Hinzugefügt, um den maximalen Wert zu speichern
NoteCountDataStore() : spendableNotesCount(0), maxValue(0) {} // Initialisiere maxValue
public:
static NoteCountDataStore* getInstance();
void clear();
void setData(const QString& key, const QString& value);
QString getData(const QString& key);
QString dump();
void setSpendableNotesCount(int count);
int getSpendableNotesCount() const;
void setAddressWithMaxValue(const QString& address, int value);
QString getAddressWithMaxValue() const;
~NoteCountDataStore() {
instanced = false;
instance = nullptr;
}
};
#endif // NOTECOUNTDATASTORE_H

View File

@@ -1,37 +1,37 @@
// Copyright 2019-2024 The Hush developers
// Released under the GPLv3
#include "SietchDataStore.h"
SietchDataStore* SietchDataStore::getInstance()
{
if(!SietchDataStore::instanced)
{
SietchDataStore::instanced = true;
SietchDataStore::instance = new SietchDataStore();
}
return SietchDataStore::instance;
}
void SietchDataStore::clear()
{
this->data.clear();
}
void SietchDataStore::setData(QString key, QString value)
{
this->data[key] = value;
}
QString SietchDataStore::getData(QString key)
{
return this->data[key];
}
QString SietchDataStore::dump()
{
return "";
}
SietchDataStore* SietchDataStore::instance = nullptr;
bool SietchDataStore::instanced = false;
// Copyright 2019-2024 The Hush developers
// Released under the GPLv3
#include "SietchDataStore.h"
SietchDataStore* SietchDataStore::getInstance()
{
if(!SietchDataStore::instanced)
{
SietchDataStore::instanced = true;
SietchDataStore::instance = new SietchDataStore();
}
return SietchDataStore::instance;
}
void SietchDataStore::clear()
{
this->data.clear();
}
void SietchDataStore::setData(QString key, QString value)
{
this->data[key] = value;
}
QString SietchDataStore::getData(QString key)
{
return this->data[key];
}
QString SietchDataStore::dump()
{
return "";
}
SietchDataStore* SietchDataStore::instance = nullptr;
bool SietchDataStore::instanced = false;

View File

@@ -1,33 +1,33 @@
// Copyright 2019-2024 The Hush developers
// Released under the GPLv3
#ifndef SIETCHDATASTORE_H
#define SIETCHDATASTORE_H
using json = nlohmann::json;
class SietchDataStore
{
private:
static bool instanced;
static SietchDataStore* instance;
std::map<QString, QString> data;
SietchDataStore()
{
}
public:
static SietchDataStore* getInstance();
void clear();
void setData(QString key, QString value);
QString getData(QString key);
QString dump();
~SietchDataStore()
{
SietchDataStore::instanced = false;
SietchDataStore::instance = nullptr;
}
};
#endif
// Copyright 2019-2024 The Hush developers
// Released under the GPLv3
#ifndef SIETCHDATASTORE_H
#define SIETCHDATASTORE_H
using json = nlohmann::json;
class SietchDataStore
{
private:
static bool instanced;
static SietchDataStore* instance;
std::map<QString, QString> data;
SietchDataStore()
{
}
public:
static SietchDataStore* getInstance();
void clear();
void setData(QString key, QString value);
QString getData(QString key);
QString dump();
~SietchDataStore()
{
SietchDataStore::instanced = false;
SietchDataStore::instance = nullptr;
}
};
#endif