Skip to content

Commit e872c93

Browse files
ryanofskyjnewbery
authored andcommitted
Remove direct bitcoin access from qt/guiutil.cpp
1 parent 5884558 commit e872c93

File tree

5 files changed

+13
-8
lines changed

5 files changed

+13
-8
lines changed

src/qt/guiutil.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
#include <chainparams.h>
1414
#include <primitives/transaction.h>
1515
#include <key_io.h>
16-
#include <init.h>
16+
#include <interface/node.h>
1717
#include <policy/policy.h>
1818
#include <protocol.h>
1919
#include <script/script.h>
@@ -232,12 +232,12 @@ QString formatBitcoinURI(const SendCoinsRecipient &info)
232232
return ret;
233233
}
234234

235-
bool isDust(const QString& address, const CAmount& amount)
235+
bool isDust(interface::Node& node, const QString& address, const CAmount& amount)
236236
{
237237
CTxDestination dest = DecodeDestination(address.toStdString());
238238
CScript script = GetScriptForDestination(dest);
239239
CTxOut txOut(amount, script);
240-
return IsDust(txOut, ::dustRelayFee);
240+
return IsDust(txOut, node.getDustRelayFee());
241241
}
242242

243243
QString HtmlEscape(const QString& str, bool fMultiLine)

src/qt/guiutil.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@
2020
class QValidatedLineEdit;
2121
class SendCoinsRecipient;
2222

23+
namespace interface
24+
{
25+
class Node;
26+
}
27+
2328
QT_BEGIN_NAMESPACE
2429
class QAbstractItemView;
2530
class QDateTime;
@@ -49,7 +54,7 @@ namespace GUIUtil
4954
QString formatBitcoinURI(const SendCoinsRecipient &info);
5055

5156
// Returns true if given address+amount meets "dust" definition
52-
bool isDust(const QString& address, const CAmount& amount);
57+
bool isDust(interface::Node& node, const QString& address, const CAmount& amount);
5358

5459
// HTML escaping for rich text controls
5560
QString HtmlEscape(const QString& str, bool fMultiLine=false);

src/qt/sendcoinsdialog.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ void SendCoinsDialog::on_sendButton_clicked()
226226
SendCoinsEntry *entry = qobject_cast<SendCoinsEntry*>(ui->entries->itemAt(i)->widget());
227227
if(entry)
228228
{
229-
if(entry->validate())
229+
if(entry->validate(model->node()))
230230
{
231231
recipients.append(entry->getValue());
232232
}

src/qt/sendcoinsentry.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ void SendCoinsEntry::useAvailableBalanceClicked()
127127
Q_EMIT useAvailableBalance(this);
128128
}
129129

130-
bool SendCoinsEntry::validate()
130+
bool SendCoinsEntry::validate(interface::Node& node)
131131
{
132132
if (!model)
133133
return false;
@@ -158,7 +158,7 @@ bool SendCoinsEntry::validate()
158158
}
159159

160160
// Reject dust outputs:
161-
if (retval && GUIUtil::isDust(ui->payTo->text(), ui->payAmount->value())) {
161+
if (retval && GUIUtil::isDust(node, ui->payTo->text(), ui->payAmount->value())) {
162162
ui->payAmount->setValid(false);
163163
retval = false;
164164
}

src/qt/sendcoinsentry.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class SendCoinsEntry : public QStackedWidget
3030
~SendCoinsEntry();
3131

3232
void setModel(WalletModel *model);
33-
bool validate();
33+
bool validate(interface::Node& node);
3434
SendCoinsRecipient getValue();
3535

3636
/** Return whether the entry is still empty and unedited */

0 commit comments

Comments
 (0)