diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2015-02-09 13:49:51 +0100 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2015-02-09 13:50:56 +0100 |
commit | a9565863e09a32729bd6ce33f31889099b3d75cb (patch) | |
tree | 5c2f7367f506dc03c57ae5842cb83b3e1d69cabf /src/qt/test/paymentservertests.cpp | |
parent | 183ca292bd244973698347a6744836e2e9ea8a89 (diff) | |
parent | a6516686dcf0b93dd0bcae304e74f9ac69cb305c (diff) |
Merge #5629: [Qt] prevent amount overflow problem with payment requests
a651668 [Qt] prevent amount overflow problem with payment requests (Philip Kaufmann)
Diffstat (limited to 'src/qt/test/paymentservertests.cpp')
-rw-r--r-- | src/qt/test/paymentservertests.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/qt/test/paymentservertests.cpp b/src/qt/test/paymentservertests.cpp index 04935192c8..e2ec439b2e 100644 --- a/src/qt/test/paymentservertests.cpp +++ b/src/qt/test/paymentservertests.cpp @@ -7,7 +7,10 @@ #include "optionsmodel.h" #include "paymentrequestdata.h" +#include "amount.h" #include "random.h" +#include "script/script.h" +#include "script/standard.h" #include "util.h" #include "utilstrencodings.h" @@ -184,6 +187,20 @@ void PaymentServerTests::paymentServerTests() tempFile.close(); QCOMPARE(PaymentServer::readPaymentRequestFromFile(tempFile.fileName(), r.paymentRequest), false); + // Payment request with amount overflow (amount is set to 21000001 BTC): + data = DecodeBase64(paymentrequest5_cert2_BASE64); + byteArray = QByteArray((const char*)&data[0], data.size()); + r.paymentRequest.parse(byteArray); + // Ensure the request is initialized + QVERIFY(r.paymentRequest.IsInitialized()); + // Extract address and amount from the request + QList<std::pair<CScript, CAmount> > sendingTos = r.paymentRequest.getPayTo(); + foreach (const PAIRTYPE(CScript, CAmount)& sendingTo, sendingTos) { + CTxDestination dest; + if (ExtractDestination(sendingTo.first, dest)) + QCOMPARE(PaymentServer::verifyAmount(sendingTo.second), false); + } + delete server; } |