[Qt] make PaymentServer::ipcParseCommandLine void

- the function only returned true, so make it void
- add a comment about payment request network detection
This commit is contained in:
Philip Kaufmann 2014-11-05 11:42:51 +01:00
parent 4b5b263ac0
commit b82695b89f
3 changed files with 8 additions and 5 deletions

View file

@ -570,9 +570,9 @@ int main(int argc, char *argv[])
} }
#ifdef ENABLE_WALLET #ifdef ENABLE_WALLET
// Parse URIs on command line -- this can affect Params() // Parse URIs on command line -- this can affect Params()
if (!PaymentServer::ipcParseCommandLine(argc, argv)) PaymentServer::ipcParseCommandLine(argc, argv);
exit(0);
#endif #endif
QScopedPointer<const NetworkStyle> networkStyle(NetworkStyle::instantiate(QString::fromStdString(Params().NetworkIDString()))); QScopedPointer<const NetworkStyle> networkStyle(NetworkStyle::instantiate(QString::fromStdString(Params().NetworkIDString())));
assert(!networkStyle.isNull()); assert(!networkStyle.isNull());
// Allow for separate UI settings for testnets // Allow for separate UI settings for testnets

View file

@ -184,7 +184,7 @@ void PaymentServer::LoadRootCAs(X509_STORE* _store)
// Warning: ipcSendCommandLine() is called early in init, // Warning: ipcSendCommandLine() is called early in init,
// so don't use "emit message()", but "QMessageBox::"! // so don't use "emit message()", but "QMessageBox::"!
// //
bool PaymentServer::ipcParseCommandLine(int argc, char* argv[]) void PaymentServer::ipcParseCommandLine(int argc, char* argv[])
{ {
for (int i = 1; i < argc; i++) for (int i = 1; i < argc; i++)
{ {
@ -192,6 +192,10 @@ bool PaymentServer::ipcParseCommandLine(int argc, char* argv[])
if (arg.startsWith("-")) if (arg.startsWith("-"))
continue; continue;
// If the bitcoin: URI contains a payment request, we are not able to detect the
// network as that would require fetching and parsing the payment request.
// That means clicking such an URI which contains a testnet payment request
// will start a mainnet instance and throw a "wrong network" error.
if (arg.startsWith(BITCOIN_IPC_PREFIX, Qt::CaseInsensitive)) // bitcoin: URI if (arg.startsWith(BITCOIN_IPC_PREFIX, Qt::CaseInsensitive)) // bitcoin: URI
{ {
savedPaymentRequests.append(arg); savedPaymentRequests.append(arg);
@ -235,7 +239,6 @@ bool PaymentServer::ipcParseCommandLine(int argc, char* argv[])
qWarning() << "PaymentServer::ipcSendCommandLine : Payment request file does not exist: " << arg; qWarning() << "PaymentServer::ipcSendCommandLine : Payment request file does not exist: " << arg;
} }
} }
return true;
} }
// //

View file

@ -59,7 +59,7 @@ class PaymentServer : public QObject
public: public:
// Parse URIs on command line // Parse URIs on command line
// Returns false on error // Returns false on error
static bool ipcParseCommandLine(int argc, char *argv[]); static void ipcParseCommandLine(int argc, char *argv[]);
// Returns true if there were URIs on the command line // Returns true if there were URIs on the command line
// which were successfully sent to an already-running // which were successfully sent to an already-running