diff --git a/configure.ac b/configure.ac --- a/configure.ac +++ b/configure.ac @@ -198,6 +198,11 @@ [disable ZMQ notifications])], [use_zmq=$enableval], [use_zmq=yes]) +AC_ARG_ENABLE([bip70], + [AS_HELP_STRING([--disable-bip70], + [disable BIP70 (payment protocol) support in GUI (enabled by default)])], + [enable_bip70=$enableval], + [enable_bip70=yes]) AC_ARG_WITH([protoc-bindir],[AS_HELP_STRING([--with-protoc-bindir=BIN_DIR],[specify protoc bin path])], [protoc_bin_path=$withval], []) @@ -924,7 +929,9 @@ [ PKG_CHECK_MODULES([SSL], [libssl],, [AC_MSG_ERROR(openssl not found.)]) PKG_CHECK_MODULES([CRYPTO], [libcrypto],,[AC_MSG_ERROR(libcrypto not found.)]) - BITCOIN_QT_CHECK([PKG_CHECK_MODULES([PROTOBUF], [protobuf], [have_protobuf=yes], [BITCOIN_QT_FAIL(libprotobuf not found)])]) + if test x$enable_bip70 != xno; then + BITCOIN_QT_CHECK([PKG_CHECK_MODULES([PROTOBUF], [protobuf], [have_protobuf=yes], [BITCOIN_QT_FAIL(libprotobuf not found)])]) + fi if test x$use_qr != xno; then BITCOIN_QT_CHECK([PKG_CHECK_MODULES([QR], [libqrencode], [have_qrencode=yes], [have_qrencode=no])]) fi @@ -984,7 +991,9 @@ esac fi - BITCOIN_QT_CHECK(AC_CHECK_LIB([protobuf] ,[main],[PROTOBUF_LIBS=-lprotobuf], BITCOIN_QT_FAIL(libprotobuf not found))) + if test x$enable_bip70 != xno; then + BITCOIN_QT_CHECK(AC_CHECK_LIB([protobuf] ,[main],[PROTOBUF_LIBS=-lprotobuf], BITCOIN_QT_FAIL(libprotobuf not found))) + fi if test x$use_qr != xno; then BITCOIN_QT_CHECK([AC_CHECK_LIB([qrencode], [main],[QR_LIBS=-lqrencode], [have_qrencode=no])]) BITCOIN_QT_CHECK([AC_CHECK_HEADER([qrencode.h],, have_qrencode=no)]) @@ -1046,7 +1055,9 @@ AC_SUBST(UNIVALUE_CFLAGS) AC_SUBST(UNIVALUE_LIBS) -BITCOIN_QT_PATH_PROGS([PROTOC], [protoc],$protoc_bin_path) +if test x$enable_bip70 != xno; then + BITCOIN_QT_PATH_PROGS([PROTOC], [protoc],$protoc_bin_path) +fi AC_MSG_CHECKING([whether to build bitcoind]) AM_CONDITIONAL([BUILD_BITCOIND], [test x$build_bitcoind = xyes]) @@ -1164,6 +1175,15 @@ else AC_MSG_RESULT([no]) fi + + AC_MSG_CHECKING([whether to build BIP70 support]) + if test x$enable_bip70 != xno; then + AC_DEFINE([ENABLE_BIP70],[1],[Define if BIP70 support should be compiled in]) + enable_bip70=yes + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + fi fi AM_CONDITIONAL([ENABLE_ZMQ], [test "x$use_zmq" = "xyes"]) @@ -1205,6 +1225,7 @@ AM_CONDITIONAL([ENABLE_SEEDER_TESTS],[test x$BUILD_SEEDER_TEST = xyes]) AM_CONDITIONAL([ENABLE_QT],[test x$bitcoin_enable_qt = xyes]) AM_CONDITIONAL([ENABLE_QT_TESTS],[test x$BUILD_TEST_QT = xyes]) +AM_CONDITIONAL([ENABLE_BIP70],[test x$enable_bip70 = xyes]) AM_CONDITIONAL([ENABLE_BENCH],[test x$use_bench = xyes]) AM_CONDITIONAL([USE_QRCODE], [test x$use_qr = xyes]) AM_CONDITIONAL([USE_LCOV],[test x$use_lcov = xyes]) @@ -1333,6 +1354,7 @@ echo " with wallet = $enable_wallet" echo " with gui / qt = $bitcoin_enable_qt" if test x$bitcoin_enable_qt != xno; then + echo " with bip70 = $enable_bip70" echo " with qr = $use_qr" fi echo " with zmq = $use_zmq" diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -16,6 +16,7 @@ option(BUILD_BITCOIN_TX "Build bitcoin-tx" ON) option(BUILD_BITCOIN_QT "Build bitcoin-qt" ON) option(BUILD_LIBBITCOINCONSENSUS "Build the bitcoinconsenus shared library" ON) +option(ENABLE_BIP70 "Enable BIP70 (payment protocol) support in GUI" ON) option(ENABLE_HARDENING "Harden the executables" ON) option(ENABLE_REDUCE_EXPORTS "Reduce the amount of exported symbols" OFF) option(ENABLE_STATIC_LIBSTDCXX "Statically link libstdc++" OFF) diff --git a/src/Makefile.am b/src/Makefile.am --- a/src/Makefile.am +++ b/src/Makefile.am @@ -668,9 +668,11 @@ $(AM_V_at) READELF=$(READELF) OBJDUMP=$(OBJDUMP) $(top_srcdir)/contrib/devtools/security-check.py < $(bin_PROGRAMS) endif +if ENABLE_BIP70 %.pb.cc %.pb.h: %.proto @test -f $(PROTOC) $(AM_V_GEN) $(PROTOC) --cpp_out=$(@D) --proto_path=$(setCurrentWallet(walletModel); } +#ifdef ENABLE_BIP70 connect(walletModel, &WalletModel::coinsSent, paymentServer, &PaymentServer::fetchPaymentACK); +#endif connect(walletModel, &WalletModel::unload, this, &BitcoinApplication::removeWallet); @@ -398,7 +400,9 @@ // guaranteed complete. qWarning() << "Platform customization:" << platformStyle->getName(); #ifdef ENABLE_WALLET +#ifdef ENABLE_BIP70 PaymentServer::LoadRootCAs(); +#endif if (paymentServer) { paymentServer->setOptionsModel(optionsModel); } @@ -477,7 +481,7 @@ } static void SetupUIArgs() { -#ifdef ENABLE_WALLET +#if defined(ENABLE_WALLET) && defined(ENABLE_BIP70) gArgs.AddArg("-allowselfsignedrootcertificates", strprintf("Allow self signed root certificates (default: %d)", DEFAULT_SELFSIGNED_ROOTCERTS), diff --git a/src/qt/coincontroldialog.cpp b/src/qt/coincontroldialog.cpp --- a/src/qt/coincontroldialog.cpp +++ b/src/qt/coincontroldialog.cpp @@ -2,9 +2,14 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. +#if defined(HAVE_CONFIG_H) +#include +#endif + #include #include +#include #include #include #include diff --git a/src/qt/paymentserver.h b/src/qt/paymentserver.h --- a/src/qt/paymentserver.h +++ b/src/qt/paymentserver.h @@ -28,7 +28,13 @@ // to the server. // +#if defined(HAVE_CONFIG_H) +#include +#endif + +#ifdef ENABLE_BIP70 #include +#endif #include #include @@ -71,6 +77,7 @@ // OptionsModel is used for getting proxy settings and display unit void setOptionsModel(OptionsModel *optionsModel); +#ifdef ENABLE_BIP70 // Load root certificate authorities. Pass nullptr (default) to read from // the file specified in the -rootcertificates setting, or, if that's not // set, to use the system default root certificates. If you pass in a store, @@ -90,6 +97,7 @@ static bool verifySize(qint64 requestSize); // Verify the payment request amount is valid static bool verifyAmount(const Amount requestAmount); +#endif Q_SIGNALS: // Fired when a valid payment request is received @@ -99,8 +107,10 @@ void message(const QString &title, const QString &message, unsigned int style); +#ifdef ENABLE_BIP70 // Fired when a valid PaymentACK is received void receivedPaymentACK(const QString &paymentACKMsg); +#endif public Q_SLOTS: // Signal this when the main window's UI is ready to display payment @@ -110,16 +120,20 @@ // Handle an incoming URI, URI with local file scheme or file void handleURIOrFile(const QString &s); +#ifdef ENABLE_BIP70 // Submit Payment message to a merchant, get back PaymentACK: void fetchPaymentACK(WalletModel *walletModel, const SendCoinsRecipient &recipient, QByteArray transaction); +#endif private Q_SLOTS: void handleURIConnection(); +#ifdef ENABLE_BIP70 void netRequestFinished(QNetworkReply *); void reportSslErrors(QNetworkReply *, const QList &); void handlePaymentACK(const QString &paymentACKMsg); +#endif protected: // Constructor registers this on the parent QApplication to receive @@ -134,6 +148,7 @@ bool handleURI(const CChainParams ¶ms, const QString &s); +#ifdef ENABLE_BIP70 static bool readPaymentRequestFromFile(const QString &filename, PaymentRequestPlus &request); bool processPaymentRequest(const PaymentRequestPlus &request, @@ -145,6 +160,7 @@ // Used to fetch payment requests QNetworkAccessManager *netManager; +#endif }; #endif // BITCOIN_QT_PAYMENTSERVER_H diff --git a/src/qt/paymentserver.cpp b/src/qt/paymentserver.cpp --- a/src/qt/paymentserver.cpp +++ b/src/qt/paymentserver.cpp @@ -2,6 +2,10 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. +#if defined(HAVE_CONFIG_H) +#include +#endif + #include #include @@ -44,6 +48,7 @@ #include const int BITCOIN_IPC_CONNECT_TIMEOUT = 1000; // milliseconds +#ifdef ENABLE_BIP70 // BIP70 payment protocol messages const char *BIP70_MESSAGE_PAYMENTACK = "PaymentACK"; const char *BIP70_MESSAGE_PAYMENTREQUEST = "PaymentRequest"; @@ -52,6 +57,7 @@ const char *BIP71_MIMETYPE_PAYMENTACK = "application/bitcoincash-paymentack"; const char *BIP71_MIMETYPE_PAYMENTREQUEST = "application/bitcoincash-paymentrequest"; +#endif // // Create a name that is unique for: @@ -142,6 +148,7 @@ } } +#ifdef ENABLE_BIP70 if (!itemNetwork && QFile::exists(arg)) { // Filename PaymentRequestPlus request; @@ -153,6 +160,7 @@ } } } +#endif if (itemNetwork == nullptr) { // Printing to debug.log is about the best we can do here, the GUI @@ -163,6 +171,7 @@ continue; } +#ifdef ENABLE_BIP70 if (chosenNetwork && chosenNetwork != itemNetwork) { qWarning() << "PaymentServer::ipcSendCommandLine: Payment request " "from network " @@ -173,6 +182,7 @@ } savedPaymentRequests.append(arg); +#endif chosenNetwork = itemNetwork; } @@ -217,11 +227,18 @@ } PaymentServer::PaymentServer(QObject *parent, bool startLocalServer) - : QObject(parent), saveURIs(true), uriServer(0), optionsModel(0), - netManager(0) { + : QObject(parent), saveURIs(true), uriServer(0), optionsModel(0) +// clang-format off +#ifdef ENABLE_BIP70 + ,netManager(0) +#endif +// clang-format on +{ +#ifdef ENABLE_BIP70 // Verify that the version of the library that we linked against is // compatible with the version of the headers we compiled against. GOOGLE_PROTOBUF_VERIFY_VERSION; +#endif // Install global event filter to catch QFileOpenEvents // on Mac: sent when you click bitcoincash: links @@ -246,14 +263,18 @@ } else { connect(uriServer, &QLocalServer::newConnection, this, &PaymentServer::handleURIConnection); +#ifdef ENABLE_BIP70 connect(this, &PaymentServer::receivedPaymentACK, this, &PaymentServer::handlePaymentACK); +#endif } } } PaymentServer::~PaymentServer() { +#ifdef ENABLE_BIP70 google::protobuf::ShutdownProtobufLibrary(); +#endif } // @@ -277,7 +298,9 @@ } void PaymentServer::uiReady() { +#ifdef ENABLE_BIP70 initNetManager(); +#endif saveURIs = false; for (const QString &s : savedPaymentRequests) { @@ -293,8 +316,9 @@ } QUrlQuery uri((QUrl(s))); + // payment request URI if (uri.hasQueryItem("r")) { - // payment request URI +#ifdef ENABLE_BIP70 QByteArray temp; temp.append(uri.queryItemValue("r")); QString decoded = QUrl::fromPercentEncoding(temp); @@ -313,6 +337,12 @@ 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 true; } @@ -350,6 +380,7 @@ return; } +#ifdef ENABLE_BIP70 // payment request file if (QFile::exists(s)) { PaymentRequestPlus request; @@ -365,6 +396,7 @@ return; } +#endif } void PaymentServer::handleURIConnection() { @@ -392,6 +424,7 @@ this->optionsModel = _optionsModel; } +#ifdef ENABLE_BIP70 struct X509StoreDeleter { void operator()(X509_STORE *b) { X509_STORE_free(b); } }; @@ -879,3 +912,4 @@ X509_STORE *PaymentServer::getCertStore() { return certStore.get(); } +#endif diff --git a/src/qt/sendcoinsdialog.cpp b/src/qt/sendcoinsdialog.cpp --- a/src/qt/sendcoinsdialog.cpp +++ b/src/qt/sendcoinsdialog.cpp @@ -2,6 +2,10 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. +#if defined(HAVE_CONFIG_H) +#include +#endif + #include #include @@ -309,8 +313,11 @@ QString recipientElement; recipientElement = "
"; +#ifdef ENABLE_BIP70 // normal payment - if (!rcp.paymentRequest.IsInitialized()) { + if (!rcp.paymentRequest.IsInitialized()) +#endif + { if (rcp.label.length() > 0) { // label with address recipientElement.append( @@ -320,8 +327,10 @@ // just address recipientElement.append(tr("%1 to %2").arg(amount, address)); } - } else if (!rcp.authenticatedMerchant.isEmpty()) { - // authenticated payment request + } +#ifdef ENABLE_BIP70 + // authenticated payment request + else if (!rcp.authenticatedMerchant.isEmpty()) { recipientElement.append( tr("%1 to %2") .arg(amount, @@ -330,6 +339,7 @@ // unauthenticated payment request recipientElement.append(tr("%1 to %2").arg(amount, address)); } +#endif formatted.append(recipientElement); } diff --git a/src/qt/sendcoinsentry.cpp b/src/qt/sendcoinsentry.cpp --- a/src/qt/sendcoinsentry.cpp +++ b/src/qt/sendcoinsentry.cpp @@ -2,6 +2,10 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. +#if defined(HAVE_CONFIG_H) +#include +#endif + #include #include @@ -151,10 +155,12 @@ // Check input validity bool retval = true; +#ifdef ENABLE_BIP70 // Skip checks for payment request if (recipient.paymentRequest.IsInitialized()) { return retval; } +#endif if (!model->validateAddress(ui->payTo->text())) { ui->payTo->setValid(false); @@ -183,10 +189,12 @@ } SendCoinsRecipient SendCoinsEntry::getValue() { +#ifdef ENABLE_BIP70 // Payment request if (recipient.paymentRequest.IsInitialized()) { return recipient; } +#endif // Normal payment recipient.address = ui->payTo->text(); @@ -214,6 +222,7 @@ void SendCoinsEntry::setValue(const SendCoinsRecipient &value) { recipient = value; +#ifdef ENABLE_BIP70 // payment request if (recipient.paymentRequest.IsInitialized()) { // unauthenticated @@ -236,7 +245,9 @@ } // normal payment - else { + else +#endif + { // message ui->messageTextLabel->setText(recipient.message); ui->messageTextLabel->setVisible(!recipient.message.isEmpty()); diff --git a/src/qt/test/CMakeLists.txt b/src/qt/test/CMakeLists.txt --- a/src/qt/test/CMakeLists.txt +++ b/src/qt/test/CMakeLists.txt @@ -28,10 +28,16 @@ target_sources(test_bitcoin-qt PRIVATE addressbooktests.cpp - paymentservertests.cpp wallettests.cpp ../../wallet/test/wallet_test_fixture.cpp ) + if(ENABLE_BIP70) + target_sources(test_bitcoin-qt + PRIVATE + paymentservertests.cpp + ) + endif() + target_link_libraries(test_bitcoin-qt wallet) endif() diff --git a/src/qt/test/compattests.cpp b/src/qt/test/compattests.cpp --- a/src/qt/test/compattests.cpp +++ b/src/qt/test/compattests.cpp @@ -2,10 +2,18 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. +#if defined(HAVE_CONFIG_H) +#include +#endif + #include +#if defined(ENABLE_WALLET) && defined(ENABLE_BIP70) +// this includes protobuf's port.h which defines its own bswap macos +#include +#endif + #include -#include // this includes protobuf's port.h which defines its own bswap macos void CompatTests::bswapTests() { // Sibling in bitcoin/src/test/bswap_tests.cpp diff --git a/src/qt/test/test_main.cpp b/src/qt/test/test_main.cpp --- a/src/qt/test/test_main.cpp +++ b/src/qt/test/test_main.cpp @@ -21,15 +21,19 @@ #include #ifdef ENABLE_WALLET #include +#ifdef ENABLE_BIP70 #include +#endif // ENABLE_BIP70 #include -#endif +#endif // ENABLE_WALLET #include #include #include +#ifdef ENABLE_BIP70 #include +#endif #if defined(QT_STATICPLUGIN) #include @@ -74,9 +78,11 @@ BitcoinApplication app(*node, argc, argv); app.setApplicationName("BitcoinABC-Qt-test"); +#ifdef ENABLE_BIP70 // This is necessary to initialize openssl on the test framework // (at least on Darwin). SSL_library_init(); +#endif AppTests app_tests(app); if (QTest::qExec(&app_tests) != 0) { @@ -86,7 +92,7 @@ if (QTest::qExec(&test1) != 0) { fInvalid = true; } -#ifdef ENABLE_WALLET +#if defined(ENABLE_WALLET) && defined(ENABLE_BIP70) PaymentServerTests test2; if (QTest::qExec(&test2) != 0) { fInvalid = true; diff --git a/src/qt/test/wallettests.cpp b/src/qt/test/wallettests.cpp --- a/src/qt/test/wallettests.cpp +++ b/src/qt/test/wallettests.cpp @@ -1,6 +1,7 @@ #include #include +#include #include #include #include diff --git a/src/qt/transactiondesc.cpp b/src/qt/transactiondesc.cpp --- a/src/qt/transactiondesc.cpp +++ b/src/qt/transactiondesc.cpp @@ -2,6 +2,10 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. +#ifdef HAVE_CONFIG_H +#include +#endif + #include #include @@ -311,6 +315,7 @@ } } +#ifdef ENABLE_BIP70 // // PaymentRequest info: // @@ -326,6 +331,7 @@ } } } +#endif if (wtx.is_coinbase) { quint32 numBlocksToMaturity = COINBASE_MATURITY + 1; diff --git a/src/qt/utilitydialog.cpp b/src/qt/utilitydialog.cpp --- a/src/qt/utilitydialog.cpp +++ b/src/qt/utilitydialog.cpp @@ -17,7 +17,9 @@ #include #include #include +#ifdef ENABLE_BIP70 #include +#endif #include #include diff --git a/src/qt/walletmodel.h b/src/qt/walletmodel.h --- a/src/qt/walletmodel.h +++ b/src/qt/walletmodel.h @@ -7,7 +7,14 @@ #include #include + +#if defined(HAVE_CONFIG_H) +#include +#endif + +#ifdef ENABLE_BIP70 #include +#endif #include #include @@ -60,8 +67,14 @@ // If from a payment request, this is used for storing the memo QString message; +#ifdef ENABLE_BIP70 // If from a payment request, paymentRequest.IsInitialized() will be true PaymentRequestPlus paymentRequest; +#else + // If building with BIP70 is disabled, keep the payment request around as + // serialized string to ensure load/store is lossless + std::string sPaymentRequest; +#endif // Empty if no authentication or invalid signature/cert/etc. QString authenticatedMerchant; @@ -78,10 +91,12 @@ std::string sAddress = address.toStdString(); std::string sLabel = label.toStdString(); std::string sMessage = message.toStdString(); +#ifdef ENABLE_BIP70 std::string sPaymentRequest; if (!ser_action.ForRead() && paymentRequest.IsInitialized()) { paymentRequest.SerializeToString(&sPaymentRequest); } +#endif std::string sAuthenticatedMerchant = authenticatedMerchant.toStdString(); @@ -98,10 +113,12 @@ address = QString::fromStdString(sAddress); label = QString::fromStdString(sLabel); message = QString::fromStdString(sMessage); +#ifdef ENABLE_BIP70 if (!sPaymentRequest.empty()) { paymentRequest.parse(QByteArray::fromRawData( sPaymentRequest.data(), sPaymentRequest.size())); } +#endif authenticatedMerchant = QString::fromStdString(sAuthenticatedMerchant); diff --git a/src/qt/walletmodel.cpp b/src/qt/walletmodel.cpp --- a/src/qt/walletmodel.cpp +++ b/src/qt/walletmodel.cpp @@ -2,6 +2,10 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. +#if defined(HAVE_CONFIG_H) +#include +#endif + #include #include @@ -132,6 +136,7 @@ for (const SendCoinsRecipient &rcp : recipients) { if (rcp.fSubtractFeeFromAmount) fSubtractFeeFromAmount = true; +#ifdef ENABLE_BIP70 // PaymentRequest... if (rcp.paymentRequest.IsInitialized()) { Amount subtotal = Amount::zero(); @@ -157,8 +162,12 @@ return InvalidAmount; } total += subtotal; - } else { - // User-entered bitcoin address / amount: + } + + // User-entered bitcoin address / amount: + else +#endif + { if (!validateAddress(rcp.address)) { return InvalidAddress; } @@ -226,6 +235,7 @@ std::vector> vOrderForm; for (const SendCoinsRecipient &rcp : transaction.getRecipients()) { +#ifdef ENABLE_BIP70 if (rcp.paymentRequest.IsInitialized()) { // Make sure any payment requests involved are still valid. if (PaymentServer::verifyExpired(rcp.paymentRequest.getDetails())) { @@ -236,7 +246,9 @@ std::string value; rcp.paymentRequest.SerializeToString(&value); vOrderForm.emplace_back("PaymentRequest", std::move(value)); - } else if (!rcp.message.isEmpty()) { + } else +#endif + if (!rcp.message.isEmpty()) { // Message from normal bitcoincash:URI // (bitcoincash:123...?message=example) vOrderForm.emplace_back("Message", rcp.message.toStdString()); @@ -259,7 +271,10 @@ // emit coinsSent signal for each recipient for (const SendCoinsRecipient &rcp : transaction.getRecipients()) { // Don't touch the address book when we have a payment request - if (!rcp.paymentRequest.IsInitialized()) { +#ifdef ENABLE_BIP70 + if (!rcp.paymentRequest.IsInitialized()) +#endif + { std::string strAddress = rcp.address.toStdString(); CTxDestination dest = DecodeDestination(strAddress, getChainParams()); diff --git a/src/qt/walletmodeltransaction.h b/src/qt/walletmodeltransaction.h --- a/src/qt/walletmodeltransaction.h +++ b/src/qt/walletmodeltransaction.h @@ -7,6 +7,8 @@ #include +#include + #include #include diff --git a/src/qt/walletmodeltransaction.cpp b/src/qt/walletmodeltransaction.cpp --- a/src/qt/walletmodeltransaction.cpp +++ b/src/qt/walletmodeltransaction.cpp @@ -2,6 +2,10 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. +#ifdef HAVE_CONFIG_H +#include +#endif + #include #include @@ -35,6 +39,7 @@ const CTransaction *walletTransaction = &wtx->get(); int i = 0; for (SendCoinsRecipient &rcp : recipients) { +#ifdef ENABLE_BIP70 if (rcp.paymentRequest.IsInitialized()) { Amount subtotal = Amount::zero(); const payments::PaymentDetails &details = @@ -53,8 +58,12 @@ i++; } rcp.amount = subtotal; - } else { - // normal recipient (no payment request) + } + + // normal recipient (no payment request) + else +#endif + { if (i == nChangePosRet) { i++; }