Ignore errors for background ops
This commit is contained in:
12
src/rpc.cpp
12
src/rpc.cpp
@@ -486,7 +486,9 @@ void RPC::getInfoThenRefresh(bool force) {
|
|||||||
{"method", "getinfo"}
|
{"method", "getinfo"}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static bool prevCallSucceeded = false;
|
||||||
conn->doRPC(payload, [=] (const json& reply) {
|
conn->doRPC(payload, [=] (const json& reply) {
|
||||||
|
prevCallSucceeded = true;
|
||||||
// Testnet?
|
// Testnet?
|
||||||
if (!reply["testnet"].is_null()) {
|
if (!reply["testnet"].is_null()) {
|
||||||
Settings::getInstance()->setTestnet(reply["testnet"].get<json::boolean_t>());
|
Settings::getInstance()->setTestnet(reply["testnet"].get<json::boolean_t>());
|
||||||
@@ -575,8 +577,12 @@ void RPC::getInfoThenRefresh(bool force) {
|
|||||||
}, [=](QNetworkReply* reply, const json& replyJson) {
|
}, [=](QNetworkReply* reply, const json& replyJson) {
|
||||||
// zcashd has probably disappeared.
|
// zcashd has probably disappeared.
|
||||||
this->noConnection();
|
this->noConnection();
|
||||||
QMessageBox::critical(main, "Connection Error", "There was an error connecting to zcashd. The error was: \n\n"
|
if (prevCallSucceeded) { // show error only first time
|
||||||
+ reply->errorString(), QMessageBox::StandardButton::Ok);
|
QMessageBox::critical(main, "Connection Error", "There was an error connecting to zcashd. The error was: \n\n"
|
||||||
|
+ reply->errorString(), QMessageBox::StandardButton::Ok);
|
||||||
|
}
|
||||||
|
|
||||||
|
prevCallSucceeded = false;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -774,7 +780,7 @@ void RPC::watchTxStatus() {
|
|||||||
{"method", "z_getoperationstatus"},
|
{"method", "z_getoperationstatus"},
|
||||||
};
|
};
|
||||||
|
|
||||||
conn->doRPCWithDefaultErrorHandling(payload, [=] (const json& reply) {
|
conn->doRPCIgnoreError(payload, [=] (const json& reply) {
|
||||||
// There's an array for each item in the status
|
// There's an array for each item in the status
|
||||||
for (auto& it : reply.get<json::array_t>()) {
|
for (auto& it : reply.get<json::array_t>()) {
|
||||||
// If we were watching this Tx and its status became "success", then we'll show a status bar alert
|
// If we were watching this Tx and its status became "success", then we'll show a status bar alert
|
||||||
|
|||||||
Reference in New Issue
Block a user