From 57d80467f123741f228910dea8c1245134bbfbfe Mon Sep 17 00:00:00 2001 From: Gavin Andresen Date: Thu, 8 Aug 2013 13:09:07 +1000 Subject: 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. --- src/qt/sendcoinsentry.cpp | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) (limited to 'src/qt/sendcoinsentry.cpp') diff --git a/src/qt/sendcoinsentry.cpp b/src/qt/sendcoinsentry.cpp index 876b7f808b..1c54850a03 100644 --- a/src/qt/sendcoinsentry.cpp +++ b/src/qt/sendcoinsentry.cpp @@ -101,24 +101,21 @@ bool SendCoinsEntry::validate() // Check input validity bool retval = true; - if(!ui->payAmount->validate()) + if(!ui->payTo->hasAcceptableInput() || + (model && !model->validateAddress(ui->payTo->text()))) { + ui->payTo->setValid(false); retval = false; } - else + + if(!ui->payAmount->validate()) { - if(ui->payAmount->value() <= 0) - { - // Cannot send 0 coins or less - ui->payAmount->setValid(false); - retval = false; - } + retval = false; } - if(!ui->payTo->hasAcceptableInput() || - (model && !model->validateAddress(ui->payTo->text()))) - { - ui->payTo->setValid(false); + // Reject dust outputs: + if (retval && GUIUtil::isDust(ui->payTo->text(), ui->payAmount->value())) { + ui->payAmount->setValid(false); retval = false; } -- cgit v1.2.3