mirror of
https://github.com/feather-wallet/feather.git
synced 2024-11-17 09:47:36 +00:00
Merge pull request 'Nodes: Fallback to hardcoded list if nothing cached' (#304) from tobtoht/feather:nodes_json into master
Reviewed-on: https://git.wownero.com/feather/feather/pulls/304
This commit is contained in:
commit
e6532ab706
3 changed files with 69 additions and 0 deletions
|
@ -4,6 +4,7 @@
|
|||
<file>assets/ack.txt</file>
|
||||
<file>assets/contributors.txt</file>
|
||||
<file>assets/feather.desktop</file>
|
||||
<file>assets/nodes.json</file>
|
||||
<file>assets/images/appicons/32x32.png</file>
|
||||
<file>assets/images/appicons/48x48.png</file>
|
||||
<file>assets/images/appicons/64x64.png</file>
|
||||
|
|
37
src/assets/nodes.json
Normal file
37
src/assets/nodes.json
Normal file
|
@ -0,0 +1,37 @@
|
|||
{
|
||||
"mainnet": {
|
||||
"tor": [
|
||||
"xmrtolujkxnlinre.onion:18081",
|
||||
"xmrag4hf5xlabmob.onion:18081",
|
||||
"monero26mmldsallmxok2kwamne4ve3mybvvn2yijsvss7ey63hc4yyd.onion:18081",
|
||||
"monero5sjoz5xmjn.onion:18081",
|
||||
"mxcd4577fldb3ppzy7obmmhnu3tf57gbcbd4qhwr2kxyjj2qi3dnbfqd.onion:18081",
|
||||
"moneroxmrxw44lku6qniyarpwgznpcwml4drq7vb24ppatlcg4kmxpqd.onion:18089",
|
||||
"3hvpnd4xejtzcuowvru2wfjum5wjf7synigm44rrizr3k4v5vzam2bad.onion:18081",
|
||||
"3t7v5zpcfxq2tocdofdcwxgrldco3elotz3iis4jtbbnscy5alezw7yd.onion:18081",
|
||||
"4mslnrs5sfjxrb35.onion:18081",
|
||||
"aytzr6aoxsegx2y6.onion:18081"
|
||||
],
|
||||
"clearnet": [
|
||||
"eu-west.node.xmr.pm:18089",
|
||||
"eu-west-2.node.xmr.pm:18089",
|
||||
"usa-east-va.node.xmr.pm:18089",
|
||||
"canada.node.xmr.pm:18089",
|
||||
"singapore.node.xmr.pm:18089",
|
||||
"nodes.hashvault.pro:18081",
|
||||
"node.supportxmr.com:18081",
|
||||
"xmr-node-eu.cakewallet.com:18081",
|
||||
"xmr-node-usa-east.cakewallet.com:18081",
|
||||
"node.xmr.ru:18081",
|
||||
"selsta1.featherwallet.net:18081",
|
||||
"selsta2.featherwallet.net:18081"
|
||||
]
|
||||
},
|
||||
"stagenet": {
|
||||
"tor": [],
|
||||
"clearnet": [
|
||||
"run.your.own.node.xmr.pm:38089",
|
||||
"super.fast.node.xmr.pm:38089"
|
||||
]
|
||||
}
|
||||
}
|
|
@ -83,6 +83,37 @@ void Nodes::loadConfig() {
|
|||
qDebug() << QString("Loaded %1 custom nodes from config").arg(m_customNodes.count());
|
||||
}
|
||||
|
||||
// No nodes cached, fallback to hardcorded list
|
||||
if (m_websocketNodes.count() == 0) {
|
||||
QByteArray file = Utils::fileOpenQRC(":/assets/nodes.json");
|
||||
QJsonDocument nodes_json = QJsonDocument::fromJson(file);
|
||||
QJsonObject nodes_obj = nodes_json.object();
|
||||
|
||||
QString netKey;
|
||||
if (m_ctx->networkType == NetworkType::MAINNET) {
|
||||
netKey = "mainnet";
|
||||
} else if (m_ctx->networkType == NetworkType::STAGENET) {
|
||||
netKey = "stagenet";
|
||||
}
|
||||
|
||||
if (nodes_obj.contains(netKey)) {
|
||||
QJsonArray nodes_list;
|
||||
if (m_ctx->isTails || m_ctx->isWhonix || m_ctx->isTorSocks) {
|
||||
nodes_list = nodes_json[netKey].toObject()["tor"].toArray();
|
||||
} else {
|
||||
nodes_list = nodes_json[netKey].toObject()["clearnet"].toArray();
|
||||
}
|
||||
for (auto node: nodes_list) {
|
||||
auto wsNode = FeatherNode(node.toString());
|
||||
wsNode.custom = false;
|
||||
wsNode.online = true;
|
||||
m_websocketNodes.append(wsNode);
|
||||
}
|
||||
}
|
||||
|
||||
qDebug() << QString("Loaded %1 nodes from hardcoded list").arg(m_websocketNodes.count());
|
||||
}
|
||||
|
||||
m_configJson[key] = obj;
|
||||
this->writeConfig();
|
||||
this->updateModels();
|
||||
|
|
Loading…
Reference in a new issue