Skip to content

Commit

Permalink
Fix Qt test cases by moving address checks to parseBitcoinURI
Browse files Browse the repository at this point in the history
Makes sense in case bitcoin URIs eventually allow invalid addresses
as a part of some larger future payment scheme.
  • Loading branch information
TheBlueMatt authored and Matt Corallo committed Aug 7, 2012
1 parent 319236a commit 2bc1583
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
6 changes: 0 additions & 6 deletions src/qt/guiutil.cpp
Expand Up @@ -4,7 +4,6 @@
#include "bitcoinunits.h"
#include "util.h"
#include "init.h"
#include "base58.h"

#include <QString>
#include <QDateTime>
Expand Down Expand Up @@ -81,11 +80,6 @@ bool parseBitcoinURI(const QUrl &uri, SendCoinsRecipient *out)
if(uri.scheme() != QString("bitcoin"))
return false;

// check if the address is valid
CBitcoinAddress addressFromUri(uri.path().toStdString());
if (!addressFromUri.IsValid())
return false;

SendCoinsRecipient rv;
rv.address = uri.path();
rv.amount = 0;
Expand Down
4 changes: 4 additions & 0 deletions src/qt/sendcoinsdialog.cpp
Expand Up @@ -7,6 +7,7 @@
#include "sendcoinsentry.h"
#include "guiutil.h"
#include "askpassphrasedialog.h"
#include "base58.h"

#include <QMessageBox>
#include <QLocale>
Expand Down Expand Up @@ -273,6 +274,9 @@ bool SendCoinsDialog::handleURI(const QString &uri)
// URI has to be valid
if (GUIUtil::parseBitcoinURI(uri, &rv))
{
CBitcoinAddress address(rv.address.toStdString());
if (!address.IsValid())
return false;
pasteEntry(rv);
return true;
}
Expand Down

0 comments on commit 2bc1583

Please sign in to comment.