aboutsummaryrefslogtreecommitdiff
path: root/src/qt/guiutil.cpp
diff options
context:
space:
mode:
authorGavin Andresen <[email protected]>2013-08-08 13:09:07 +1000
committerGavin Andresen <[email protected]>2013-08-22 11:05:44 +1000
commit57d80467f123741f228910dea8c1245134bbfbfe (patch)
treeabdc71a4ec2d9ccb3f31e3027abe768b3db330c0 /src/qt/guiutil.cpp
parentMerge pull request #2919 from gmaxwell/bloom_faster (diff)
downloaddiscoin-57d80467f123741f228910dea8c1245134bbfbfe.tar.xz
discoin-57d80467f123741f228910dea8c1245134bbfbfe.zip
Reject dust amounts during validation
Replaces the validation check for "amount == 0" with an isDust check, so very small output amounts are caught before the wallet is unlocked, a transaction is created, etc.
Diffstat (limited to 'src/qt/guiutil.cpp')
-rw-r--r--src/qt/guiutil.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/qt/guiutil.cpp b/src/qt/guiutil.cpp
index 32131bc39..c951b21b8 100644
--- a/src/qt/guiutil.cpp
+++ b/src/qt/guiutil.cpp
@@ -148,6 +148,14 @@ bool parseBitcoinURI(QString uri, SendCoinsRecipient *out)
return parseBitcoinURI(uriInstance, out);
}
+bool isDust(const QString& address, qint64 amount)
+{
+ CTxDestination dest = CBitcoinAddress(address.toStdString()).Get();
+ CScript script; script.SetDestination(dest);
+ CTxOut txOut(amount, script);
+ return txOut.IsDust(CTransaction::nMinRelayTxFee);
+}
+
QString HtmlEscape(const QString& str, bool fMultiLine)
{
#if QT_VERSION < 0x050000