Skip to content

Commit

Permalink
Merge #15063: GUI: If BIP70 is disabled, attempt to fall back to BIP2…
Browse files Browse the repository at this point in the history
…1 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
  • Loading branch information
jonasschnelli committed Feb 14, 2019
2 parents 9b1df4b + 84f5315 commit 758c6d7
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 9 deletions.
9 changes: 9 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,15 @@ jobs:
GOAL="install"
BITCOIN_CONFIG="--enable-zmq --with-incompatible-bdb --with-gui=qt5 CPPFLAGS=-DDEBUG_LOCKORDER --with-sanitizers=address,integer,undefined CC=clang CXX=clang++"
- stage: test
name: 'x86_64 Linux [GOAL: install] [no BIP70]'
env: >-
HOST=x86_64-unknown-linux-gnu
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"
NO_DEPENDS=1
GOAL="install"
BITCOIN_CONFIG="--enable-zmq --disable-bip70 --with-incompatible-bdb --with-gui=qt5 CPPFLAGS=-DDEBUG_LOCKORDER --with-sanitizers=address,integer,undefined CC=clang CXX=clang++"
- stage: test
name: 'x86_64 Linux [GOAL: install] [bionic] [no wallet]'
env: >-
Expand Down
26 changes: 17 additions & 9 deletions src/qt/paymentserver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -292,9 +292,9 @@ void PaymentServer::handleURIOrFile(const QString& s)
else if (s.startsWith(BITCOIN_IPC_PREFIX, Qt::CaseInsensitive)) // bitcoin: URI
{
QUrlQuery uri((QUrl(s)));
#ifdef ENABLE_BIP70
if (uri.hasQueryItem("r")) // payment request URI
{
#ifdef ENABLE_BIP70
Q_EMIT message(tr("URI handling"),
tr("You are using a BIP70 URL which will be unsupported in the future."),
CClientUIInterface::ICON_WARNING);
Expand All @@ -315,19 +315,23 @@ void PaymentServer::handleURIOrFile(const QString& s)
tr("Payment request fetch URL is invalid: %1").arg(fetchUrl.toString()),
CClientUIInterface::ICON_WARNING);
}
#else
Q_EMIT message(tr("URI handling"),
tr("Cannot process payment request because BIP70 support was not compiled in."),
CClientUIInterface::ICON_WARNING);
#endif
return;
}
else // normal URI
else
#endif
// normal URI
{
SendCoinsRecipient recipient;
if (GUIUtil::parseBitcoinURI(s, &recipient))
{
if (!IsValidDestinationString(recipient.address.toStdString())) {
#ifndef ENABLE_BIP70
if (uri.hasQueryItem("r")) { // payment request
Q_EMIT message(tr("URI handling"),
tr("Cannot process payment request because BIP70 support was not compiled in."),
CClientUIInterface::ICON_WARNING);
}
#endif
Q_EMIT message(tr("URI handling"), tr("Invalid payment address %1").arg(recipient.address),
CClientUIInterface::MSG_ERROR);
}
Expand All @@ -343,9 +347,9 @@ void PaymentServer::handleURIOrFile(const QString& s)
}
}

#ifdef ENABLE_BIP70
if (QFile::exists(s)) // payment request file
{
#ifdef ENABLE_BIP70
PaymentRequestPlus request;
SendCoinsRecipient recipient;
if (!readPaymentRequestFromFile(s, request))
Expand All @@ -358,8 +362,12 @@ void PaymentServer::handleURIOrFile(const QString& s)
Q_EMIT receivedPaymentRequest(recipient);

return;
}
#else
Q_EMIT message(tr("Payment request file handling"),
tr("Cannot process payment request because BIP70 support was not compiled in."),
CClientUIInterface::ICON_WARNING);
#endif
}
}

void PaymentServer::handleURIConnection()
Expand Down

0 comments on commit 758c6d7

Please sign in to comment.