Skip to content

Commit b82695b

Browse files
author
Philip Kaufmann
committed
[Qt] make PaymentServer::ipcParseCommandLine void
- the function only returned true, so make it void - add a comment about payment request network detection
1 parent 4b5b263 commit b82695b

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

src/qt/bitcoin.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -570,9 +570,9 @@ int main(int argc, char *argv[])
570570
}
571571
#ifdef ENABLE_WALLET
572572
// Parse URIs on command line -- this can affect Params()
573-
if (!PaymentServer::ipcParseCommandLine(argc, argv))
574-
exit(0);
573+
PaymentServer::ipcParseCommandLine(argc, argv);
575574
#endif
575+
576576
QScopedPointer<const NetworkStyle> networkStyle(NetworkStyle::instantiate(QString::fromStdString(Params().NetworkIDString())));
577577
assert(!networkStyle.isNull());
578578
// Allow for separate UI settings for testnets

src/qt/paymentserver.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,14 +184,18 @@ void PaymentServer::LoadRootCAs(X509_STORE* _store)
184184
// Warning: ipcSendCommandLine() is called early in init,
185185
// so don't use "emit message()", but "QMessageBox::"!
186186
//
187-
bool PaymentServer::ipcParseCommandLine(int argc, char* argv[])
187+
void PaymentServer::ipcParseCommandLine(int argc, char* argv[])
188188
{
189189
for (int i = 1; i < argc; i++)
190190
{
191191
QString arg(argv[i]);
192192
if (arg.startsWith("-"))
193193
continue;
194194

195+
// If the bitcoin: URI contains a payment request, we are not able to detect the
196+
// network as that would require fetching and parsing the payment request.
197+
// That means clicking such an URI which contains a testnet payment request
198+
// will start a mainnet instance and throw a "wrong network" error.
195199
if (arg.startsWith(BITCOIN_IPC_PREFIX, Qt::CaseInsensitive)) // bitcoin: URI
196200
{
197201
savedPaymentRequests.append(arg);
@@ -235,7 +239,6 @@ bool PaymentServer::ipcParseCommandLine(int argc, char* argv[])
235239
qWarning() << "PaymentServer::ipcSendCommandLine : Payment request file does not exist: " << arg;
236240
}
237241
}
238-
return true;
239242
}
240243

241244
//

src/qt/paymentserver.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ class PaymentServer : public QObject
5959
public:
6060
// Parse URIs on command line
6161
// Returns false on error
62-
static bool ipcParseCommandLine(int argc, char *argv[]);
62+
static void ipcParseCommandLine(int argc, char *argv[]);
6363

6464
// Returns true if there were URIs on the command line
6565
// which were successfully sent to an already-running

0 commit comments

Comments
 (0)