mirror of
https://github.com/dashpay/dash.git
synced 2024-12-26 12:32:48 +01:00
Remove direct bitcoin access from qt/guiutil.cpp
This commit is contained in:
parent
155324e867
commit
e4e00cbbdd
@ -14,7 +14,7 @@
|
||||
#include <qt/walletmodel.h>
|
||||
|
||||
#include <primitives/transaction.h>
|
||||
#include <init.h>
|
||||
#include <interface/node.h>
|
||||
#include <policy/policy.h>
|
||||
#include <protocol.h>
|
||||
#include <script/script.h>
|
||||
@ -457,12 +457,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)
|
||||
|
@ -23,6 +23,11 @@ class QValidatedLineEdit;
|
||||
class OptionsModel;
|
||||
class SendCoinsRecipient;
|
||||
|
||||
namespace interface
|
||||
{
|
||||
class Node;
|
||||
}
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QAbstractButton;
|
||||
class QAbstractItemView;
|
||||
@ -116,7 +121,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);
|
||||
|
@ -263,7 +263,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());
|
||||
}
|
||||
|
@ -132,7 +132,7 @@ void SendCoinsEntry::useAvailableBalanceClicked()
|
||||
Q_EMIT useAvailableBalance(this);
|
||||
}
|
||||
|
||||
bool SendCoinsEntry::validate()
|
||||
bool SendCoinsEntry::validate(interface::Node& node)
|
||||
{
|
||||
if (!model)
|
||||
return false;
|
||||
@ -163,7 +163,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;
|
||||
}
|
||||
|
@ -29,7 +29,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 */
|
||||
|
Loading…
Reference in New Issue
Block a user