Skip to content

Commit 3f89e1e

Browse files
committed
Prevent processing duplicate payment requests
1 parent f4a0d27 commit 3f89e1e

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/qt/paymentserver.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ static QString ipcServerName()
8282
// the main GUI window is up and ready to ask the user
8383
// to send payment.
8484

85-
static QList<QString> savedPaymentRequests;
85+
static QSet<QString> savedPaymentRequests;
8686

8787
//
8888
// Sending to the server is done synchronously, at startup.
@@ -107,7 +107,8 @@ void PaymentServer::ipcParseCommandLine(interfaces::Node& node, int argc, char*
107107
// will start a mainnet instance and throw a "wrong network" error.
108108
if (arg.startsWith(BITCOIN_IPC_PREFIX, Qt::CaseInsensitive)) // bitcoin: URI
109109
{
110-
savedPaymentRequests.append(arg);
110+
if (savedPaymentRequests.contains(arg)) continue;
111+
savedPaymentRequests.insert(arg);
111112

112113
SendCoinsRecipient r;
113114
if (GUIUtil::parseBitcoinURI(arg, &r) && !r.address.isEmpty())
@@ -127,7 +128,8 @@ void PaymentServer::ipcParseCommandLine(interfaces::Node& node, int argc, char*
127128
#ifdef ENABLE_BIP70
128129
else if (QFile::exists(arg)) // Filename
129130
{
130-
savedPaymentRequests.append(arg);
131+
if (savedPaymentRequests.contains(arg)) continue;
132+
savedPaymentRequests.insert(arg);
131133

132134
PaymentRequestPlus request;
133135
if (readPaymentRequestFromFile(arg, request))
@@ -280,7 +282,7 @@ void PaymentServer::handleURIOrFile(const QString& s)
280282
{
281283
if (saveURIs)
282284
{
283-
savedPaymentRequests.append(s);
285+
savedPaymentRequests.insert(s);
284286
return;
285287
}
286288

0 commit comments

Comments
 (0)