Changeset View
Changeset View
Standalone View
Standalone View
src/qt/walletmodel.cpp
Show All 14 Lines | |||||
#include "config.h" | #include "config.h" | ||||
#include "dstencode.h" | #include "dstencode.h" | ||||
#include "keystore.h" | #include "keystore.h" | ||||
#include "net.h" // for g_connman | #include "net.h" // for g_connman | ||||
#include "sync.h" | #include "sync.h" | ||||
#include "ui_interface.h" | #include "ui_interface.h" | ||||
#include "util.h" // for GetBoolArg | #include "util.h" // for GetBoolArg | ||||
#include "validation.h" | #include "validation.h" | ||||
#include "wallet/coincontrol.h" | |||||
#include "wallet/wallet.h" | #include "wallet/wallet.h" | ||||
#include "wallet/walletdb.h" // for BackupWallet | #include "wallet/walletdb.h" // for BackupWallet | ||||
#include <cstdint> | #include <cstdint> | ||||
#include <QDebug> | #include <QDebug> | ||||
#include <QSet> | #include <QSet> | ||||
#include <QTimer> | #include <QTimer> | ||||
▲ Show 20 Lines • Show All 142 Lines • ▼ Show 20 Lines | |||||
bool WalletModel::validateAddress(const QString &address) { | bool WalletModel::validateAddress(const QString &address) { | ||||
return IsValidDestinationString(address.toStdString(), | return IsValidDestinationString(address.toStdString(), | ||||
GetConfig().GetChainParams()); | GetConfig().GetChainParams()); | ||||
} | } | ||||
WalletModel::SendCoinsReturn | WalletModel::SendCoinsReturn | ||||
WalletModel::prepareTransaction(WalletModelTransaction &transaction, | WalletModel::prepareTransaction(WalletModelTransaction &transaction, | ||||
const CCoinControl *coinControl) { | const CCoinControl &coinControl) { | ||||
Amount total = Amount::zero(); | Amount total = Amount::zero(); | ||||
bool fSubtractFeeFromAmount = false; | bool fSubtractFeeFromAmount = false; | ||||
QList<SendCoinsRecipient> recipients = transaction.getRecipients(); | QList<SendCoinsRecipient> recipients = transaction.getRecipients(); | ||||
std::vector<CRecipient> vecSend; | std::vector<CRecipient> vecSend; | ||||
if (recipients.empty()) { | if (recipients.empty()) { | ||||
return OK; | return OK; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 50 Lines • ▼ Show 20 Lines | for (const SendCoinsRecipient &rcp : recipients) { | ||||
total += rcp.amount; | total += rcp.amount; | ||||
} | } | ||||
} | } | ||||
if (setAddress.size() != nAddresses) { | if (setAddress.size() != nAddresses) { | ||||
return DuplicateAddress; | return DuplicateAddress; | ||||
} | } | ||||
Amount nBalance = getBalance(coinControl); | Amount nBalance = getBalance(&coinControl); | ||||
if (total > nBalance) { | if (total > nBalance) { | ||||
return AmountExceedsBalance; | return AmountExceedsBalance; | ||||
} | } | ||||
{ | { | ||||
LOCK2(cs_main, wallet->cs_wallet); | LOCK2(cs_main, wallet->cs_wallet); | ||||
▲ Show 20 Lines • Show All 402 Lines • Show Last 20 Lines |