diff --git a/src/confirm.ui b/src/confirm.ui
index fe9bf27..e4e1a78 100644
--- a/src/confirm.ui
+++ b/src/confirm.ui
@@ -146,6 +146,19 @@
+ -
+
+
+ color: red;
+
+
+ zcashd doesn't seem to have any peers. You might not be connected to the internet, so this Transaction might not work.
+
+
+ true
+
+
+
-
diff --git a/src/rpc.cpp b/src/rpc.cpp
index 5bec7ca..2d7a511 100644
--- a/src/rpc.cpp
+++ b/src/rpc.cpp
@@ -531,10 +531,17 @@ void RPC::getInfoThenRefresh(bool force) {
refreshTransactions();
}
+ int connections = reply["connections"].get();
+ Settings::getInstance()->setPeers(connections);
+
+ if (connections == 0) {
+ // If there are no peers connected, then the internet is probably off or something else is wrong.
+ QIcon i = QApplication::style()->standardIcon(QStyle::SP_MessageBoxWarning);
+ main->statusIcon->setPixmap(i.pixmap(16, 16));
+ }
+
// Get network sol/s
if (ezcashd) {
- int conns = reply["connections"].get();
-
json payload = {
{"jsonrpc", "1.0"},
{"id", "someid"},
@@ -544,7 +551,7 @@ void RPC::getInfoThenRefresh(bool force) {
conn->doRPCIgnoreError(payload, [=](const json& reply) {
qint64 solrate = reply.get();
- ui->numconnections->setText(QString::number(conns));
+ ui->numconnections->setText(QString::number(connections));
ui->solrate->setText(QString::number(solrate) % " Sol/s");
});
}
@@ -596,7 +603,14 @@ void RPC::getInfoThenRefresh(bool force) {
main->statusLabel->setText(statusText);
auto zecPrice = Settings::getUSDFormat(1);
- QString tooltip = QObject::tr("Connected to zcashd");
+ QString tooltip;
+ if (connections > 0) {
+ tooltip = QObject::tr("Connected to zcashd");
+ }
+ else {
+ tooltip = QObject::tr("zcashd has no peer connections");
+ }
+
if (!zecPrice.isEmpty()) {
tooltip = "1 ZEC = " % zecPrice % "\n" % tooltip;
}
diff --git a/src/sendtab.cpp b/src/sendtab.cpp
index f88272e..a273845 100644
--- a/src/sendtab.cpp
+++ b/src/sendtab.cpp
@@ -581,6 +581,9 @@ bool MainWindow::confirmTx(Tx tx) {
// Syncing warning
confirm.syncingWarning->setVisible(Settings::getInstance()->isSyncing());
+ // No peers warning
+ confirm.nopeersWarning->setVisible(Settings::getInstance()->getPeers() == 0);
+
// And FromAddress in the confirm dialog
confirm.sendFrom->setText(fnSplitAddressForWrap(tx.fromAddr));
QString tooltip = tr("Current balance : ") +
diff --git a/src/settings.cpp b/src/settings.cpp
index d729c89..5e9e057 100644
--- a/src/settings.cpp
+++ b/src/settings.cpp
@@ -134,7 +134,13 @@ void Settings::setSaveZtxs(bool save) {
QSettings().setValue("options/savesenttx", save);
}
+void Settings::setPeers(int peers) {
+ _peerConnections = peers;
+}
+int Settings::getPeers() {
+ return _peerConnections;
+}
//=================================
// Static Stuff
//=================================
diff --git a/src/settings.h b/src/settings.h
index e6eee4e..f282fac 100644
--- a/src/settings.h
+++ b/src/settings.h
@@ -53,6 +53,9 @@ public:
void setZECPrice(double p) { zecPrice = p; }
double getZECPrice();
+
+ void setPeers(int peers);
+ int getPeers();
// Static stuff
static const QString txidStatusMessage;
@@ -98,7 +101,7 @@ private:
bool _isSyncing = false;
int _blockNumber = 0;
bool _useEmbedded = false;
-
+ int _peerConnections = 0;
double zecPrice = 0.0;
};