Skip to content

Commit 758c6d7

Browse files
committed
Merge #15063: GUI: If BIP70 is disabled, attempt to fall back to BIP21 parsing
84f5315 Travis: Add test without BIP70 (but still full wallet + tests) (Luke Dashjr) 113f000 GUI: If BIP70 is disabled, give a proper error when trying to open a payment request file (Luke Dashjr) 9975282 GUI: If BIP70 is disabled, attempt to fall back to BIP21 parsing (Luke Dashjr) Pull request description: Tree-SHA512: 66a684ce4336d0eac8b0107b405ff3a2cf312258a967f3e1b14734cd39db11e2db3e9b03492755583170d94d54754ef536b0776e5f19a0cc2caca8379eeb4495
2 parents 9b1df4b + 84f5315 commit 758c6d7

File tree

2 files changed

+26
-9
lines changed

2 files changed

+26
-9
lines changed

.travis.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,15 @@ jobs:
132132
GOAL="install"
133133
BITCOIN_CONFIG="--enable-zmq --with-incompatible-bdb --with-gui=qt5 CPPFLAGS=-DDEBUG_LOCKORDER --with-sanitizers=address,integer,undefined CC=clang CXX=clang++"
134134
135+
- stage: test
136+
name: 'x86_64 Linux [GOAL: install] [no BIP70]'
137+
env: >-
138+
HOST=x86_64-unknown-linux-gnu
139+
PACKAGES="clang llvm python3-zmq qtbase5-dev qttools5-dev-tools libssl1.0-dev libevent-dev bsdmainutils libboost-system-dev libboost-filesystem-dev libboost-chrono-dev libboost-test-dev libboost-thread-dev libdb5.3++-dev libminiupnpc-dev libzmq3-dev libqrencode-dev"
140+
NO_DEPENDS=1
141+
GOAL="install"
142+
BITCOIN_CONFIG="--enable-zmq --disable-bip70 --with-incompatible-bdb --with-gui=qt5 CPPFLAGS=-DDEBUG_LOCKORDER --with-sanitizers=address,integer,undefined CC=clang CXX=clang++"
143+
135144
- stage: test
136145
name: 'x86_64 Linux [GOAL: install] [bionic] [no wallet]'
137146
env: >-

src/qt/paymentserver.cpp

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -292,9 +292,9 @@ void PaymentServer::handleURIOrFile(const QString& s)
292292
else if (s.startsWith(BITCOIN_IPC_PREFIX, Qt::CaseInsensitive)) // bitcoin: URI
293293
{
294294
QUrlQuery uri((QUrl(s)));
295+
#ifdef ENABLE_BIP70
295296
if (uri.hasQueryItem("r")) // payment request URI
296297
{
297-
#ifdef ENABLE_BIP70
298298
Q_EMIT message(tr("URI handling"),
299299
tr("You are using a BIP70 URL which will be unsupported in the future."),
300300
CClientUIInterface::ICON_WARNING);
@@ -315,19 +315,23 @@ void PaymentServer::handleURIOrFile(const QString& s)
315315
tr("Payment request fetch URL is invalid: %1").arg(fetchUrl.toString()),
316316
CClientUIInterface::ICON_WARNING);
317317
}
318-
#else
319-
Q_EMIT message(tr("URI handling"),
320-
tr("Cannot process payment request because BIP70 support was not compiled in."),
321-
CClientUIInterface::ICON_WARNING);
322-
#endif
323318
return;
324319
}
325-
else // normal URI
320+
else
321+
#endif
322+
// normal URI
326323
{
327324
SendCoinsRecipient recipient;
328325
if (GUIUtil::parseBitcoinURI(s, &recipient))
329326
{
330327
if (!IsValidDestinationString(recipient.address.toStdString())) {
328+
#ifndef ENABLE_BIP70
329+
if (uri.hasQueryItem("r")) { // payment request
330+
Q_EMIT message(tr("URI handling"),
331+
tr("Cannot process payment request because BIP70 support was not compiled in."),
332+
CClientUIInterface::ICON_WARNING);
333+
}
334+
#endif
331335
Q_EMIT message(tr("URI handling"), tr("Invalid payment address %1").arg(recipient.address),
332336
CClientUIInterface::MSG_ERROR);
333337
}
@@ -343,9 +347,9 @@ void PaymentServer::handleURIOrFile(const QString& s)
343347
}
344348
}
345349

346-
#ifdef ENABLE_BIP70
347350
if (QFile::exists(s)) // payment request file
348351
{
352+
#ifdef ENABLE_BIP70
349353
PaymentRequestPlus request;
350354
SendCoinsRecipient recipient;
351355
if (!readPaymentRequestFromFile(s, request))
@@ -358,8 +362,12 @@ void PaymentServer::handleURIOrFile(const QString& s)
358362
Q_EMIT receivedPaymentRequest(recipient);
359363

360364
return;
361-
}
365+
#else
366+
Q_EMIT message(tr("Payment request file handling"),
367+
tr("Cannot process payment request because BIP70 support was not compiled in."),
368+
CClientUIInterface::ICON_WARNING);
362369
#endif
370+
}
363371
}
364372

365373
void PaymentServer::handleURIConnection()

0 commit comments

Comments
 (0)