Sending to the server is done synchronously, at startup. If the server isn't already running, startup continues, and the items in savedPaymentRequest will be handled when uiReady() is called. Warning: ipcSendCommandLine() is called early in init, so don't use "Q_EMIT message()", but "QMessageBox::"!
| 74 | // so don't use "Q_EMIT message()", but "QMessageBox::"! |
| 75 | // |
| 76 | void PaymentServer::ipcParseCommandLine(int argc, char* argv[]) |
| 77 | { |
| 78 | for (int i = 1; i < argc; i++) |
| 79 | { |
| 80 | QString arg(argv[i]); |
| 81 | if (arg.startsWith("-")) |
| 82 | continue; |
| 83 | |
| 84 | // If the bitcoin: URI contains a payment request, we are not able to detect the |
| 85 | // network as that would require fetching and parsing the payment request. |
| 86 | // That means clicking such an URI which contains a testnet payment request |
| 87 | // will start a mainnet instance and throw a "wrong network" error. |
| 88 | if (arg.startsWith(BITCOIN_IPC_PREFIX, Qt::CaseInsensitive)) // bitcoin: URI |
| 89 | { |
| 90 | if (savedPaymentRequests.contains(arg)) continue; |
| 91 | savedPaymentRequests.insert(arg); |
| 92 | |
| 93 | SendCoinsRecipient r; |
| 94 | if (GUIUtil::parseBitcoinURI(arg, &r) && !r.address.isEmpty()) |
| 95 | { |
| 96 | auto tempChainParams = CreateChainParams(gArgs, CBaseChainParams::MAIN); |
| 97 | |
| 98 | if (IsValidDestinationString(r.address.toStdString(), *tempChainParams)) { |
| 99 | SelectParams(CBaseChainParams::MAIN); |
| 100 | } else { |
| 101 | tempChainParams = CreateChainParams(gArgs, CBaseChainParams::TESTNET); |
| 102 | if (IsValidDestinationString(r.address.toStdString(), *tempChainParams)) { |
| 103 | SelectParams(CBaseChainParams::TESTNET); |
| 104 | } |
| 105 | } |
| 106 | } |
| 107 | } |
| 108 | } |
| 109 | } |
| 110 | |
| 111 | // |
| 112 | // Sending to the server is done synchronously, at startup. |
nothing calls this directly
no test coverage detected