aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRussell Yanofsky <russ@yanofsky.org>2017-04-18 17:06:13 -0400
committerJohn Newbery <john@johnnewbery.com>2018-04-04 16:52:40 -0400
commite872c93ee87477130fb877da1a536b4c693bbab9 (patch)
treeb6628020b9d5775ccb1f009852ad692ff2633d96
parent58845587e11140e81f087a74c3db76a4d1fc3a1a (diff)
Remove direct bitcoin access from qt/guiutil.cpp
-rw-r--r--src/qt/guiutil.cpp6
-rw-r--r--src/qt/guiutil.h7
-rw-r--r--src/qt/sendcoinsdialog.cpp2
-rw-r--r--src/qt/sendcoinsentry.cpp4
-rw-r--r--src/qt/sendcoinsentry.h2
5 files changed, 13 insertions, 8 deletions
diff --git a/src/qt/guiutil.cpp b/src/qt/guiutil.cpp
index 7b653a99da..3501f97908 100644
--- a/src/qt/guiutil.cpp
+++ b/src/qt/guiutil.cpp
@@ -13,7 +13,7 @@
#include <chainparams.h>
#include <primitives/transaction.h>
#include <key_io.h>
-#include <init.h>
+#include <interface/node.h>
#include <policy/policy.h>
#include <protocol.h>
#include <script/script.h>
@@ -232,12 +232,12 @@ QString formatBitcoinURI(const SendCoinsRecipient &info)
return ret;
}
-bool isDust(const QString& address, const CAmount& amount)
+bool isDust(interface::Node& node, const QString& address, const CAmount& amount)
{
CTxDestination dest = DecodeDestination(address.toStdString());
CScript script = GetScriptForDestination(dest);
CTxOut txOut(amount, script);
- return IsDust(txOut, ::dustRelayFee);
+ return IsDust(txOut, node.getDustRelayFee());
}
QString HtmlEscape(const QString& str, bool fMultiLine)
diff --git a/src/qt/guiutil.h b/src/qt/guiutil.h
index bbbeaf2c43..40037edb9d 100644
--- a/src/qt/guiutil.h
+++ b/src/qt/guiutil.h
@@ -20,6 +20,11 @@
class QValidatedLineEdit;
class SendCoinsRecipient;
+namespace interface
+{
+ class Node;
+}
+
QT_BEGIN_NAMESPACE
class QAbstractItemView;
class QDateTime;
@@ -49,7 +54,7 @@ namespace GUIUtil
QString formatBitcoinURI(const SendCoinsRecipient &info);
// Returns true if given address+amount meets "dust" definition
- bool isDust(const QString& address, const CAmount& amount);
+ bool isDust(interface::Node& node, const QString& address, const CAmount& amount);
// HTML escaping for rich text controls
QString HtmlEscape(const QString& str, bool fMultiLine=false);
diff --git a/src/qt/sendcoinsdialog.cpp b/src/qt/sendcoinsdialog.cpp
index 98f08bbc59..2363154115 100644
--- a/src/qt/sendcoinsdialog.cpp
+++ b/src/qt/sendcoinsdialog.cpp
@@ -226,7 +226,7 @@ void SendCoinsDialog::on_sendButton_clicked()
SendCoinsEntry *entry = qobject_cast<SendCoinsEntry*>(ui->entries->itemAt(i)->widget());
if(entry)
{
- if(entry->validate())
+ if(entry->validate(model->node()))
{
recipients.append(entry->getValue());
}
diff --git a/src/qt/sendcoinsentry.cpp b/src/qt/sendcoinsentry.cpp
index b7decbb69b..6a961d83ea 100644
--- a/src/qt/sendcoinsentry.cpp
+++ b/src/qt/sendcoinsentry.cpp
@@ -127,7 +127,7 @@ void SendCoinsEntry::useAvailableBalanceClicked()
Q_EMIT useAvailableBalance(this);
}
-bool SendCoinsEntry::validate()
+bool SendCoinsEntry::validate(interface::Node& node)
{
if (!model)
return false;
@@ -158,7 +158,7 @@ bool SendCoinsEntry::validate()
}
// Reject dust outputs:
- if (retval && GUIUtil::isDust(ui->payTo->text(), ui->payAmount->value())) {
+ if (retval && GUIUtil::isDust(node, ui->payTo->text(), ui->payAmount->value())) {
ui->payAmount->setValid(false);
retval = false;
}
diff --git a/src/qt/sendcoinsentry.h b/src/qt/sendcoinsentry.h
index a9fdd5938c..715f4cfde5 100644
--- a/src/qt/sendcoinsentry.h
+++ b/src/qt/sendcoinsentry.h
@@ -30,7 +30,7 @@ public:
~SendCoinsEntry();
void setModel(WalletModel *model);
- bool validate();
+ bool validate(interface::Node& node);
SendCoinsRecipient getValue();
/** Return whether the entry is still empty and unedited */