From 3f89e1eb237efcbd6415ca2cd0acddb6596153d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Barbosa?= Date: Wed, 2 Oct 2019 21:55:52 +0100 Subject: [PATCH] Prevent processing duplicate payment requests --- src/qt/paymentserver.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/qt/paymentserver.cpp b/src/qt/paymentserver.cpp index 00d83d23dda..806cc3c41ef 100644 --- a/src/qt/paymentserver.cpp +++ b/src/qt/paymentserver.cpp @@ -82,7 +82,7 @@ static QString ipcServerName() // the main GUI window is up and ready to ask the user // to send payment. -static QList savedPaymentRequests; +static QSet savedPaymentRequests; // // Sending to the server is done synchronously, at startup. @@ -107,7 +107,8 @@ void PaymentServer::ipcParseCommandLine(interfaces::Node& node, int argc, char* // will start a mainnet instance and throw a "wrong network" error. if (arg.startsWith(BITCOIN_IPC_PREFIX, Qt::CaseInsensitive)) // bitcoin: URI { - savedPaymentRequests.append(arg); + if (savedPaymentRequests.contains(arg)) continue; + savedPaymentRequests.insert(arg); SendCoinsRecipient r; if (GUIUtil::parseBitcoinURI(arg, &r) && !r.address.isEmpty()) @@ -127,7 +128,8 @@ void PaymentServer::ipcParseCommandLine(interfaces::Node& node, int argc, char* #ifdef ENABLE_BIP70 else if (QFile::exists(arg)) // Filename { - savedPaymentRequests.append(arg); + if (savedPaymentRequests.contains(arg)) continue; + savedPaymentRequests.insert(arg); PaymentRequestPlus request; if (readPaymentRequestFromFile(arg, request)) @@ -280,7 +282,7 @@ void PaymentServer::handleURIOrFile(const QString& s) { if (saveURIs) { - savedPaymentRequests.append(s); + savedPaymentRequests.insert(s); return; }