Browse Source

Add TLS Support yes/no to hushd screen, since SD could be talking to an old hushd

pull/208/head
Duke Leto 4 years ago
parent
commit
bc30b4e1d1
  1. 24
      src/mainwindow.ui
  2. 12
      src/rpc.cpp
  3. 6
      src/settings.cpp
  4. 6
      src/settings.h
  5. 3
      src/websockets.cpp

24
src/mainwindow.ui

@ -1386,6 +1386,7 @@
</property>
</widget>
</item>
<item row="20" column="0">
<widget class="QLabel" name="chaintxcountlabel">
<property name="text">
@ -1407,6 +1408,29 @@
</property>
</widget>
</item>
<item row="21" column="0">
<widget class="QLabel" name="tlssupportlabel">
<property name="text">
<string>TLS Support</string>
</property>
</widget>
</item>
<item row="21" column="2">
<widget class="QLabel" name="tlssupport">
<property name="text">
<string>Loading...</string>
</property>
</widget>
</item>
<item row="21" column="1">
<widget class="QLabel" name="tlssupportspacer">
<property name="text">
<string>|</string>
</property>
</widget>
</item>
<item row="3" column="2">
<widget class="QLabel" name="solrate">
<property name="text">

12
src/rpc.cpp

@ -613,12 +613,14 @@ void RPC::getInfoThenRefresh(bool force) {
main->statusIcon->setPixmap(i.pixmap(16, 16));
}
ui->numconnections->setText(QString::number(connections) + " (" + QString::number(tlsconnections) + " TLS)" );
ui->tlssupport->setText(hasTLS ? "Yes" : "No");
// Get network sol/s
QString method = "getnetworksolps";
conn->doRPCIgnoreError(makePayload(method), [=](const QJsonValue& reply) {
qint64 solrate = reply.toInt();
ui->numconnections->setText(QString::number(connections) + " (" + QString::number(tlsconnections) + " TLS)" );
ui->solrate->setText(QString::number(solrate) % " Sol/s");
});
@ -1125,7 +1127,7 @@ void RPC::refreshPrice() {
} else {
qDebug() << reply->errorString();
}
s->setZECPrice(0);
s->setHUSHPrice(0);
s->setBTCPrice(0);
return;
}
@ -1133,7 +1135,7 @@ void RPC::refreshPrice() {
qDebug() << "No network errors";
if (parsed.isEmpty()) {
s->setZECPrice(0);
s->setHUSHPrice(0);
s->setBTCPrice(0);
return;
}
@ -1154,7 +1156,7 @@ void RPC::refreshPrice() {
qDebug() << "HUSH = " << QString::number(hush["eur"].toDouble()) << " EUR";
qDebug() << "HUSH = " << QString::number((int) 100000000 * hush["btc"].toDouble()) << " sat ";
s->setZECPrice( hush[ticker].toDouble() );
s->setHUSHPrice( hush[ticker].toDouble() );
s->setBTCPrice( (unsigned int) 100000000 * hush["btc"].toDouble() );
ticker = ticker.toLower();
@ -1199,7 +1201,7 @@ void RPC::refreshPrice() {
}
// If nothing, then set the price to 0;
Settings::getInstance()->setZECPrice(0);
Settings::getInstance()->setHUSHPrice(0);
Settings::getInstance()->setBTCPrice(0);
});
}

6
src/settings.cpp

@ -159,8 +159,8 @@ bool Settings::isSaplingActive() {
return (isTestnet() && getBlockNumber() > 0) || (!isTestnet() && getBlockNumber() > 0);
}
double Settings::getZECPrice() {
return zecPrice;
double Settings::getHUSHPrice() {
return hushPrice;
}
double Settings::get_price(QString currency) {
@ -282,7 +282,7 @@ void Settings::saveRestore(QDialog* d) {
QString Settings::getUSDFormat(double bal) {
//TODO: respect current locale!
return QLocale(QLocale::English).toString(bal * Settings::getInstance()->getZECPrice(), 'f', 8) + " " +Settings::getInstance()->get_currency_name();
return QLocale(QLocale::English).toString(bal * Settings::getInstance()->getHUSHPrice(), 'f', 8) + " " +Settings::getInstance()->get_currency_name();
}
QString Settings::getDecimalString(double amt) {

6
src/settings.h

@ -91,10 +91,10 @@ public:
void setUsingZcashConf(QString confLocation);
const QString& getZcashdConfLocation() { return _confLocation; }
void setZECPrice(double p) { zecPrice = p; }
void setHUSHPrice(double p) { hushPrice = p; }
void set_fiat_price(double p) { fiat_price = p; }
void setBTCPrice(unsigned int p) { btcPrice = p; }
double getZECPrice();
double getHUSHPrice();
double get_fiat_price();
unsigned int getBTCPrice();
double get_price(QString currency);
@ -162,7 +162,7 @@ private:
bool _headless = false;
int _peerConnections = 0;
double zecPrice = 0.0;
double hushPrice = 0.0;
double fiat_price = 0.0;
unsigned int btcPrice = 0;
std::map<QString, double> prices;

3
src/websockets.cpp

@ -855,7 +855,8 @@ void AppDataServer::processGetInfo(QJsonObject jobj, MainWindow* mainWindow, std
{"maxspendable", maxSpendable},
{"maxzspendable", maxZSpendable},
{"tokenName", Settings::getTokenName()},
{"zecprice", Settings::getInstance()->getZECPrice()},
// changing this will break SDA
{"zecprice", Settings::getInstance()->getHUSHPrice()},
{"serverversion", QString(APP_VERSION)}
}).toJson();
pClient->sendTextMessage(encryptOutgoing(r));

Loading…
Cancel
Save