replace boost_foreach

This commit is contained in:
Michel van Kessel
2020-12-28 17:28:05 +01:00
parent b9345ac0f3
commit 83b546163b
47 changed files with 394 additions and 360 deletions

View File

@@ -4,15 +4,15 @@
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#if defined(HAVE_CONFIG_H)
#include "config/bitcoin-config.h"
#include <config/bitcoin-config.h>
#endif
#include "chainparamsbase.h"
#include "clientversion.h"
#include "rpc/client.h"
#include "rpc/protocol.h"
#include "util.h"
#include "utilstrencodings.h"
#include <chainparamsbase.h>
#include <clientversion.h>
#include <rpc/client.h>
#include <rpc/protocol.h>
#include <util.h>
#include <utilstrencodings.h>
#include <boost/filesystem/operations.hpp>
#include <stdio.h>
@@ -82,9 +82,9 @@ static int AppInitRPC(int argc, char* argv[])
std::string strUsage = strprintf(_("%s RPC client version"), _(PACKAGE_NAME)) + " " + FormatFullVersion() + "\n";
if (!mapArgs.count("-version")) {
strUsage += "\n" + _("Usage:") + "\n" +
" bitcoin-cli [options] <command> [params] " + strprintf(_("Send command to %s"), _(PACKAGE_NAME)) + "\n" +
" bitcoin-cli [options] help " + _("List commands") + "\n" +
" bitcoin-cli [options] help <command> " + _("Get help for a command") + "\n";
" blackmore-cli [options] <command> [params] " + strprintf(_("Send command to %s"), _(PACKAGE_NAME)) + "\n" +
" blackmore-cli [options] help " + _("List commands") + "\n" +
" blackmore-cli [options] help <command> " + _("Get help for a command") + "\n";
strUsage += "\n" + HelpMessageCli();
}
@@ -133,8 +133,8 @@ static void http_request_done(struct evhttp_request *req, void *ctx)
{
HTTPReply *reply = static_cast<HTTPReply*>(ctx);
if (req == NULL) {
/* If req is NULL, it means an error occurred while connecting, but
if (req == nullptr) {
/* If req is nullptr, it means an error occurred while connecting, but
* I'm not sure how to find out which one. We also don't really care.
*/
reply->status = 0;
@@ -165,14 +165,14 @@ UniValue CallRPC(const string& strMethod, const UniValue& params)
throw runtime_error("cannot create event_base");
// Synchronously look up hostname
struct evhttp_connection *evcon = evhttp_connection_base_new(base, NULL, host.c_str(), port); // TODO RAII
if (evcon == NULL)
struct evhttp_connection *evcon = evhttp_connection_base_new(base, nullptr, host.c_str(), port); // TODO RAII
if (evcon == nullptr)
throw runtime_error("create connection failed");
evhttp_connection_set_timeout(evcon, GetArg("-rpcclienttimeout", DEFAULT_HTTP_CLIENT_TIMEOUT));
HTTPReply response;
struct evhttp_request *req = evhttp_request_new(http_request_done, (void*)&response); // TODO RAII
if (req == NULL)
if (req == nullptr)
throw runtime_error("create http request failed");
// Get credentials

View File

@@ -3,25 +3,25 @@
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#if defined(HAVE_CONFIG_H)
#include "config/bitcoin-config.h"
#include <config/bitcoin-config.h>
#endif
#include "base58.h"
#include "chainparams.h"
#include "clientversion.h"
#include "coins.h"
#include "consensus/consensus.h"
#include "core_io.h"
#include "dstencode.h"
#include "keystore.h"
#include "policy/policy.h"
#include "primitives/transaction.h"
#include "script/script.h"
#include "script/sign.h"
#include <base58.h>
#include <chainparams.h>
#include <clientversion.h>
#include <coins.h>
#include <consensus/consensus.h>
#include <core_io.h>
#include <dstencode.h>
#include <keystore.h>
#include <policy/policy.h>
#include <primitives/transaction.h>
#include <script/script.h>
#include <script/sign.h>
#include <univalue.h>
#include "util.h"
#include "utilmoneystr.h"
#include "utilstrencodings.h"
#include <util.h>
#include <utilmoneystr.h>
#include <utilstrencodings.h>
#include <stdio.h>
@@ -58,10 +58,10 @@ static int AppInitRawTx(int argc, char* argv[])
if (argc<2 || mapArgs.count("-?") || mapArgs.count("-h") || mapArgs.count("-help"))
{
// First part of help message is specific to this utility
std::string strUsage = strprintf(_("%s bitcoin-tx utility version"), _(PACKAGE_NAME)) + " " + FormatFullVersion() + "\n\n" +
std::string strUsage = strprintf(_("%s blackmore-tx utility version"), _(PACKAGE_NAME)) + " " + FormatFullVersion() + "\n\n" +
_("Usage:") + "\n" +
" bitcoin-tx [options] <hex-tx> [commands] " + _("Update hex-encoded bitcoin transaction") + "\n" +
" bitcoin-tx [options] -create [commands] " + _("Create hex-encoded bitcoin transaction") + "\n" +
" blackmore-tx [options] <hex-tx> [commands] " + _("Update hex-encoded blackcoin transaction") + "\n" +
" blackmore-tx [options] -create [commands] " + _("Create hex-encoded blackcoin transaction") + "\n" +
"\n";
fprintf(stdout, "%s", strUsage.c_str());
@@ -522,7 +522,7 @@ static void MutateTxSign(CMutableTransaction& tx, const string& flagStr)
ProduceSignature(MutableTransactionSignatureCreator(&keystore, &mergedTx, i, amount, nHashType), prevPubKey, sigdata);
// ... and merge in other signatures:
BOOST_FOREACH(const CTransaction& txv, txVariants)
for(const CTransaction& txv: txVariants)
sigdata = CombineSignatures(prevPubKey, MutableTransactionSignatureChecker(&mergedTx, i, amount), sigdata, DataFromTransaction(txv, i));
UpdateTransaction(mergedTx, i, sigdata);
@@ -664,7 +664,7 @@ static int CommandLineRawTx(int argc, char* argv[])
if (argc < 2)
throw runtime_error("too few parameters");
// param: hex-encoded bitcoin transaction
// param: hex-encoded blackcoin transaction
string strHexTx(argv[1]);
if (strHexTx == "-") // "-" implies standard input
strHexTx = readStdin();

View File

@@ -4,20 +4,20 @@
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#if defined(HAVE_CONFIG_H)
#include "config/bitcoin-config.h"
#include <config/bitcoin-config.h>
#endif
#include "chainparams.h"
#include "clientversion.h"
#include "rpc/server.h"
#include "config.h"
#include "init.h"
#include "noui.h"
#include "scheduler.h"
#include "util.h"
#include "httpserver.h"
#include "httprpc.h"
#include "utilstrencodings.h"
#include <chainparams.h>
#include <clientversion.h>
#include <rpc/server.h>
#include <config.h>
#include <init.h>
#include <noui.h>
#include <scheduler.h>
#include <util.h>
#include <httpserver.h>
#include <httprpc.h>
#include <utilstrencodings.h>
#include <boost/algorithm/string/predicate.hpp>
#include <boost/filesystem.hpp>
@@ -75,7 +75,7 @@ bool AppInit(int argc, char* argv[])
//
// Parameters
//
// If Qt is used, parameters/bitcoin.conf are parsed in qt/bitcoin.cpp's main()
// If Qt is used, parameters/blackmore.conf are parsed in qt/bitcoin.cpp's main()
ParseParameters(argc, argv);
// Process help and version before taking care about datadir
@@ -113,6 +113,7 @@ bool AppInit(int argc, char* argv[])
fprintf(stderr,"Error reading configuration file: %s\n", e.what());
return false;
}
// Check for -testnet or -regtest parameter (Params() calls are only valid after this clause)
try {
SelectParams(ChainNameFromCommandLine());

View File

@@ -37,7 +37,6 @@
#endif
#include <boost/algorithm/string/case_conv.hpp> // for to_lower()
#include <boost/foreach.hpp>
/** Maximum size of http request (request line + headers) */
static const size_t MAX_HEADERS_SIZE = 8192;

View File

@@ -9,8 +9,6 @@
#include "pubkey.h"
#include "util.h"
#include <boost/foreach.hpp>
bool CKeyStore::AddKey(const CKey &key) {
return AddKeyPubKey(key, key.GetPubKey());
}

View File

@@ -5047,7 +5047,7 @@ void static ProcessGetData(CNode* pfrom, const Consensus::Params& consensusParam
// Thus, the protocol spec specified allows for us to provide duplicate txn here,
// however we MUST always provide at least what the remote peer needs
typedef std::pair<unsigned int, uint256> PairType;
BOOST_FOREACH(PairType& pair, merkleBlock.vMatchedTxn)
for(PairType& pair: merkleBlock.vMatchedTxn)
pfrom->PushMessage(NetMsgType::TX, block.vtx[pair.first]);
}
// else

View File

@@ -13,7 +13,6 @@
#include <set>
#include <vector>
#include <boost/foreach.hpp>
#include <boost/unordered_set.hpp>
#include <boost/unordered_map.hpp>

View File

@@ -3,30 +3,36 @@
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include "miner.h"
#include <miner.h>
#include "amount.h"
#include "chain.h"
#include "chainparams.h"
#include "coins.h"
#include "consensus/consensus.h"
#include "consensus/merkle.h"
#include "consensus/validation.h"
#include "crypto/scrypt.h"
#include "hash.h"
#include "main.h"
#include "net.h"
#include "policy/policy.h"
#include "pos.h"
#include "pow.h"
#include "primitives/transaction.h"
#include "script/standard.h"
#include "timedata.h"
#include "txmempool.h"
#include "util.h"
#include "utilmoneystr.h"
#include "validationinterface.h"
#include "wallet/wallet.h"
#include <amount.h>
#include <base58.h>
#include <chain.h>
#include <chainparams.h>
#include <coins.h>
#include <consensus/consensus.h>
#include <consensus/merkle.h>
#include <consensus/validation.h>
#include <core_io.h>
#include <crypto/scrypt.h>
#include <hash.h>
#include <init.h>
#include <main.h>
#include <net.h>
#include <policy/policy.h>
#include <pos.h>
#include <pow.h>
#include <primitives/transaction.h>
#include <script/sign.h>
#include <script/standard.h>
#include <timedata.h>
#include <txmempool.h>
#include <util.h>
#include <utiltime.h>
#include <utilmoneystr.h>
#include <validationinterface.h>
#include <versionbits.h>
#include <wallet/wallet.h>
#include <algorithm>
#include <boost/thread.hpp>
@@ -37,7 +43,7 @@ using namespace std;
//////////////////////////////////////////////////////////////////////////////
//
// BitcoinMiner
// Blackcoin-Staker
//
//
@@ -125,7 +131,7 @@ CBlockTemplate* BlockAssembler::CreateNewBlock(const CScript& scriptPubKeyIn, in
pblocktemplate.reset(new CBlockTemplate());
if(!pblocktemplate.get())
return NULL;
return nullptr;
CBlock *pblock = &pblocktemplate->block; // pointer for convenience
@@ -198,7 +204,7 @@ CBlockTemplate* BlockAssembler::CreateNewBlock(const CScript& scriptPubKeyIn, in
bool BlockAssembler::isStillDependent(CTxMemPool::txiter iter)
{
BOOST_FOREACH(CTxMemPool::txiter parent, mempool.GetMemPoolParents(iter))
for(CTxMemPool::txiter parent: mempool.GetMemPoolParents(iter))
{
if (!inBlock.count(parent)) {
return true;
@@ -236,7 +242,7 @@ bool BlockAssembler::TestPackage(uint64_t packageSize, int64_t packageSigOps)
bool BlockAssembler::TestPackageTransactions(const CTxMemPool::setEntries& package)
{
uint64_t nPotentialBlockSize = nBlockSize; // only used with fNeedSizeAccounting
BOOST_FOREACH (const CTxMemPool::txiter it, package) {
for(const CTxMemPool::txiter it: package) {
if (!IsFinalTx(it->GetTx(), nHeight, nLockTimeCutoff))
return false;
uint64_t nTxSize = ::GetSerializeSize(it->GetTx(), SER_NETWORK, PROTOCOL_VERSION);
@@ -314,11 +320,11 @@ void BlockAssembler::AddToBlock(CTxMemPool::txiter iter)
void BlockAssembler::UpdatePackagesForAdded(const CTxMemPool::setEntries& alreadyAdded,
indexed_modified_transaction_set &mapModifiedTx)
{
BOOST_FOREACH(const CTxMemPool::txiter it, alreadyAdded) {
for(const CTxMemPool::txiter it: alreadyAdded) {
CTxMemPool::setEntries descendants;
mempool.CalculateDescendants(it, descendants);
// Insert all descendants (not yet in block) into the modified set
BOOST_FOREACH(CTxMemPool::txiter desc, descendants) {
for(CTxMemPool::txiter desc: descendants) {
if (alreadyAdded.count(desc))
continue;
modtxiter mit = mapModifiedTx.find(desc);
@@ -547,7 +553,7 @@ void BlockAssembler::addPriorityTxs(int64_t nBlockTime, bool fProofOfStake)
// This tx was successfully added, so
// add transactions that depend on this one to the priority queue to try again
BOOST_FOREACH(CTxMemPool::txiter child, mempool.GetMemPoolChildren(iter))
for(CTxMemPool::txiter child: mempool.GetMemPoolChildren(iter))
{
waitPriIter wpiter = waitPriMap.find(child);
if (wpiter != waitPriMap.end()) {

View File

@@ -6,11 +6,16 @@
#ifndef BITCOIN_MINER_H
#define BITCOIN_MINER_H
#include "primitives/block.h"
#include "txmempool.h"
#include <primitives/block.h>
#include <txmempool.h>
#include <pos.h>
#include <stdint.h>
#include <string>
#include <memory>
#include <boost/multi_index_container.hpp>
#include <boost/multi_index/ordered_index.hpp>
#include <wallet/wallet.h>
class CBlockIndex;
class CChainParams;
@@ -22,6 +27,7 @@ class CBlock;
namespace Consensus { struct Params; };
static const bool DEFAULT_PRINTPRIORITY = false;
static const int DEFAULT_GENERATE_THREADS = 1;
CAmount GetProofOfWorkReward();

View File

@@ -3,15 +3,15 @@
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include "policy/fees.h"
#include "policy/policy.h"
#include <policy/fees.h>
#include <policy/policy.h>
#include "amount.h"
#include "primitives/transaction.h"
#include "random.h"
#include "streams.h"
#include "txmempool.h"
#include "util.h"
#include <amount.h>
#include <primitives/transaction.h>
#include <random.h>
#include <streams.h>
#include <txmempool.h>
#include <util.h>
void TxConfirmStats::Initialize(std::vector<double>& defaultBuckets,
unsigned int maxConfirms, double _decay, std::string _dataTypeString)
@@ -295,7 +295,7 @@ void CBlockPolicyEstimator::removeTx(uint256 hash)
unsigned int entryHeight = pos->second.blockHeight;
unsigned int bucketIndex = pos->second.bucketIndex;
if (stats != NULL)
if (stats != nullptr)
stats->removeTx(entryHeight, nBestSeenHeight, bucketIndex);
mapMemPoolTxs.erase(hash);
}
@@ -347,7 +347,7 @@ void CBlockPolicyEstimator::processTransaction(const CTxMemPoolEntry& entry, boo
{
unsigned int txHeight = entry.GetHeight();
uint256 hash = entry.GetTx().GetHash();
if (mapMemPoolTxs[hash].stats != NULL) {
if (mapMemPoolTxs[hash].stats != nullptr) {
LogPrint("estimatefee", "Blockpolicy error mempool tx %s already being tracked\n",
hash.ToString().c_str());
return;
@@ -371,7 +371,7 @@ void CBlockPolicyEstimator::processTransaction(const CTxMemPoolEntry& entry, boo
return;
}
// Fees are stored and reported as BTC-per-kb:
// Fees are stored and reported as BLK-per-kb:
CFeeRate feeRate(entry.GetFee(), entry.GetTxSize());
// Want the priority of the tx at confirmation. However we don't know
@@ -417,7 +417,7 @@ void CBlockPolicyEstimator::processBlockTx(unsigned int nBlockHeight, const CTxM
return;
}
// Fees are stored and reported as BTC-per-kb:
// Fees are stored and reported as BLK-per-kb:
CFeeRate feeRate(entry.GetFee(), entry.GetTxSize());
// Want the priority of the tx at confirmation. The priority when it

View File

@@ -5,8 +5,8 @@
#ifndef BITCOIN_POLICYESTIMATOR_H
#define BITCOIN_POLICYESTIMATOR_H
#include "amount.h"
#include "uint256.h"
#include <amount.h>
#include <uint256.h>
#include <map>
#include <string>

View File

@@ -5,31 +5,29 @@
// NOTE: This file is intended to be customised by the end user, and includes only local node policy logic
#include "policy/policy.h"
#include <policy/policy.h>
#include "main.h"
#include "tinyformat.h"
#include "util.h"
#include "utilstrencodings.h"
#include <main.h>
#include <tinyformat.h>
#include <util.h>
#include <utilstrencodings.h>
#include <boost/foreach.hpp>
/**
* Check transaction inputs to mitigate two
* potential denial-of-service attacks:
*
* 1. scriptSigs with extra data stuffed into them,
* not consumed by scriptPubKey (or P2SH script)
* 2. P2SH scripts with a crazy number of expensive
* CHECKSIG/CHECKMULTISIG operations
*
* Why bother? To avoid denial-of-service attacks; an attacker
* can submit a standard HASH... OP_EQUAL transaction,
* which will get accepted into blocks. The redemption
* script can be anything; an attacker could use a very
* expensive-to-check-upon-redemption script like:
* DUP CHECKSIG DROP ... repeated 100 times... OP_1
*/
/**
* Check transaction inputs to mitigate two
* potential denial-of-service attacks:
*
* 1. scriptSigs with extra data stuffed into them,
* not consumed by scriptPubKey (or P2SH script)
* 2. P2SH scripts with a crazy number of expensive
* CHECKSIG/CHECKMULTISIG operations
*
* Why bother? To avoid denial-of-service attacks; an attacker
* can submit a standard HASH... OP_EQUAL transaction,
* which will get accepted into blocks. The redemption
* script can be anything; an attacker could use a very
* expensive-to-check-upon-redemption script like:
* DUP CHECKSIG DROP ... repeated 100 times... OP_1
*/
bool IsStandard(const CScript& scriptPubKey, txnouttype& whichType)
{
@@ -79,7 +77,7 @@ bool IsStandardTx(const CTransaction& tx, std::string& reason)
return false;
}
BOOST_FOREACH(const CTxIn& txin, tx.vin)
for(const CTxIn& txin: tx.vin)
{
// Biggest 'standard' txin is a 15-of-15 P2SH multisig with compressed
// keys (remember the 520 byte limit on redeemScript size). That works
@@ -100,7 +98,7 @@ bool IsStandardTx(const CTransaction& tx, std::string& reason)
unsigned int nDataOut = 0;
txnouttype whichType;
BOOST_FOREACH(const CTxOut& txout, tx.vout) {
for(const CTxOut& txout: tx.vout) {
if (!::IsStandard(txout.scriptPubKey, whichType)) {
reason = "scriptpubkey";
return false;

View File

@@ -6,9 +6,9 @@
#ifndef BITCOIN_POLICY_POLICY_H
#define BITCOIN_POLICY_POLICY_H
#include "consensus/consensus.h"
#include "script/interpreter.h"
#include "script/standard.h"
#include <consensus/consensus.h>
#include <script/interpreter.h>
#include <script/standard.h>
#include <string>

View File

@@ -3,18 +3,25 @@
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#if defined(HAVE_CONFIG_H)
#include "config/bitcoin-config.h"
#include <config/bitcoin-config.h>
#endif
#include "addressbookpage.h"
#include "ui_addressbookpage.h"
#include <qt/addressbookpage.h>
#include <ui_addressbookpage.h>
#include "addresstablemodel.h"
#include "bitcoingui.h"
#include "csvmodelwriter.h"
#include "editaddressdialog.h"
#include "guiutil.h"
#include "platformstyle.h"
#include <qt/addresstablemodel.h>
#include <base58.h>
#include <main.h>
#include <qt/bitcoingui.h>
#include <qt/csvmodelwriter.h>
#include <qt/editaddressdialog.h>
#include <qt/guiutil.h>
#include <qt/platformstyle.h>
#ifdef ENABLE_WALLET
#include <wallet/wallet.h>
#include <qt/walletmodel.h>
#endif
#include <QIcon>
#include <QMenu>
@@ -254,7 +261,7 @@ void AddressBookPage::done(int retval)
// Figure out which address was selected, and return it
QModelIndexList indexes = table->selectionModel()->selectedRows(AddressTableModel::Address);
Q_FOREACH (const QModelIndex& index, indexes) {
for (const QModelIndex& index: indexes) {
QVariant address = table->model()->data(index);
returnValue = address.toString();
}
@@ -273,7 +280,7 @@ void AddressBookPage::on_exportButton_clicked()
// CSV is currently the only supported format
QString filename = GUIUtil::getSaveFileName(this,
tr("Export Address List"), QString(),
tr("Comma separated file (*.csv)"), NULL);
tr("Comma separated file (*.csv)"), nullptr);
if (filename.isNull())
return;

View File

@@ -10,8 +10,6 @@
#include "dstencode.h"
#include "wallet/wallet.h"
#include <boost/foreach.hpp>
#include <QFont>
#include <QDebug>

View File

@@ -3,40 +3,53 @@
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#if defined(HAVE_CONFIG_H)
#include "config/bitcoin-config.h"
#include <config/bitcoin-config.h>
#endif
#include "bitcoingui.h"
#include "bitcoinunits.h"
#include "clientmodel.h"
#include "guiconstants.h"
#include "guiutil.h"
#include "modaloverlay.h"
#include "networkstyle.h"
#include "notificator.h"
#include "openuridialog.h"
#include "optionsdialog.h"
#include "optionsmodel.h"
#include "platformstyle.h"
#include "rpcconsole.h"
#include "utilitydialog.h"
#include <main.h>
#include <qt/bitcoingui.h>
#include <qt/bitcoinunits.h>
#include <clientversion.h>
#include <qt/clientmodel.h>
#include <qt/guiconstants.h>
#include <qt/guiutil.h>
#include <qt/modaloverlay.h>
#include <qt/networkstyle.h>
#include <qt/notificator.h>
#include <qt/openuridialog.h>
#include <qt/optionsdialog.h>
#include <qt/optionsmodel.h>
#include <qt/platformstyle.h>
#include <qt/rpcconsole.h>
#include <qt/utilitydialog.h>
#include <qt/walletmodel.h>
#include <wallet/rpcwallet.h>
#ifdef ENABLE_WALLET
#include "walletframe.h"
#include "walletmodel.h"
#include "wallet/wallet.h"
#include <qt/walletframe.h>
#include <qt/walletmodel.h>
#include <qt/walletview.h>
#include <wallet/wallet.h>
#endif // ENABLE_WALLET
#ifdef Q_OS_MAC
#include "macdockiconhandler.h"
#include <qt/macdockiconhandler.h>
#endif
#include "init.h"
#include "ui_interface.h"
#include "util.h"
#include <chainparams.h>
#include <init.h>
#include <miner.h>
#include <ui_interface.h>
#include <util.h>
#include <pos.h>
#include <main.h>
#include <iostream>
#include <thread>
#include <boost/lexical_cast.hpp>
#include <boost/property_tree/json_parser.hpp>
#include <boost/property_tree/ptree.hpp>
#include <QAction>
#include <QApplication>
@@ -998,7 +1011,7 @@ void BitcoinGUI::dropEvent(QDropEvent *event)
{
if(event->mimeData()->hasUrls())
{
Q_FOREACH(const QUrl &uri, event->mimeData()->urls())
for(const QUrl &uri: event->mimeData()->urls())
{
Q_EMIT receivedURI(uri.toString());
}
@@ -1262,7 +1275,7 @@ UnitDisplayStatusBarControl::UnitDisplayStatusBarControl(const PlatformStyle *pl
QList<BitcoinUnits::Unit> units = BitcoinUnits::availableUnits();
int max_width = 0;
const QFontMetrics fm(font());
Q_FOREACH (const BitcoinUnits::Unit unit, units)
for(const BitcoinUnits::Unit unit: units)
{
max_width = qMax(max_width, fm.width(BitcoinUnits::name(unit)));
}
@@ -1281,7 +1294,7 @@ void UnitDisplayStatusBarControl::mousePressEvent(QMouseEvent *event)
void UnitDisplayStatusBarControl::createContextMenu()
{
menu = new QMenu(this);
Q_FOREACH(BitcoinUnits::Unit u, BitcoinUnits::availableUnits())
for(BitcoinUnits::Unit u: BitcoinUnits::availableUnits())
{
QAction *menuAction = new QAction(QString(BitcoinUnits::name(u)), this);
menuAction->setData(QVariant(u));

View File

@@ -2,20 +2,20 @@
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include "clientmodel.h"
#include <qt/clientmodel.h>
#include "bantablemodel.h"
#include "guiconstants.h"
#include "guiutil.h"
#include "peertablemodel.h"
#include <qt/bantablemodel.h>
#include <qt/guiconstants.h>
#include <guiutil.h>
#include <qt/peertablemodel.h>
#include "chainparams.h"
#include "checkpoints.h"
#include "clientversion.h"
#include "net.h"
#include "txmempool.h"
#include "ui_interface.h"
#include "util.h"
#include <chainparams.h>
#include <checkpoints.h>
#include <clientversion.h>
#include <net.h>
#include <txmempool.h>
#include <ui_interface.h>
#include <util.h>
#include <stdint.h>
@@ -55,7 +55,7 @@ int ClientModel::getNumConnections(unsigned int flags) const
return vNodes.size();
int nNum = 0;
BOOST_FOREACH(const CNode* pnode, vNodes)
for(const CNode* pnode: vNodes)
if (flags & (pnode->fInbound ? CONNECTIONS_IN : CONNECTIONS_OUT))
nNum++;

View File

@@ -8,6 +8,8 @@
#include <QObject>
#include <QDateTime>
#include <atomic>
class AddressTableModel;
class BanTableModel;
class OptionsModel;
@@ -35,7 +37,7 @@ enum NumConnections {
CONNECTIONS_ALL = (CONNECTIONS_IN | CONNECTIONS_OUT),
};
/** Model for Bitcoin network client. */
/** Model for Blackcoin network client. */
class ClientModel : public QObject
{
Q_OBJECT
@@ -53,11 +55,12 @@ public:
int getNumBlocks() const;
int getHeaderTipHeight() const;
int64_t getHeaderTipTime() const;
//! Return number of transactions in the mempool
long getMempoolSize() const;
//! Return the dynamic memory usage of the mempool
size_t getMempoolDynamicUsage() const;
quint64 getTotalBytesRecv() const;
quint64 getTotalBytesSent() const;

View File

@@ -2,22 +2,22 @@
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include "coincontroldialog.h"
#include "ui_coincontroldialog.h"
#include <qt/coincontroldialog.h>
#include <ui_coincontroldialog.h>
#include "addresstablemodel.h"
#include "bitcoinunits.h"
#include "guiutil.h"
#include "optionsmodel.h"
#include "platformstyle.h"
#include "txmempool.h"
#include "walletmodel.h"
#include <qt/addresstablemodel.h>
#include <qt/bitcoinunits.h>
#include <qt/guiutil.h>
#include <qt/optionsmodel.h>
#include <qt/platformstyle.h>
#include <txmempool.h>
#include <qt/walletmodel.h>
#include "coincontrol.h"
#include "dstencode.h"
#include "init.h"
#include "main.h" // For minRelayTxFee
#include "wallet/wallet.h"
#include <coincontrol.h>
#include <dstencode.h>
#include <init.h>
#include <main.h> // For minRelayTxFee
#include <wallet/wallet.h>
#include <boost/assign/list_of.hpp> // for 'map_list_of()'
@@ -425,7 +425,7 @@ void CoinControlDialog::updateLabels(WalletModel *model, QDialog* dialog)
CAmount nPayAmount = 0;
bool fDust = false;
CMutableTransaction txDummy;
Q_FOREACH(const CAmount &amount, CoinControlDialog::payAmounts)
for(const CAmount &amount: CoinControlDialog::payAmounts)
{
nPayAmount += amount;
@@ -455,7 +455,7 @@ void CoinControlDialog::updateLabels(WalletModel *model, QDialog* dialog)
coinControl->ListSelected(vCoinControl);
model->getOutputs(vCoinControl, vOutputs);
BOOST_FOREACH(const COutput& out, vOutputs) {
for(const COutput& out: vOutputs) {
// unselect already spent, very unlikely scenario, this could happen
// when selected are spent elsewhere, like rpc or another computer
uint256 txhash = out.tx->GetHash();
@@ -636,7 +636,7 @@ void CoinControlDialog::updateView()
std::map<QString, std::vector<COutput> > mapCoins;
model->listCoins(mapCoins);
BOOST_FOREACH(const PAIRTYPE(QString, std::vector<COutput>)& coins, mapCoins) {
for(const PAIRTYPE(QString, std::vector<COutput>)& coins: mapCoins) {
CCoinControlWidgetItem *itemWalletAddress = new CCoinControlWidgetItem();
itemWalletAddress->setCheckState(COLUMN_CHECKBOX, Qt::Unchecked);
QString sWalletAddress = coins.first;
@@ -661,7 +661,7 @@ void CoinControlDialog::updateView()
CAmount nSum = 0;
int nChildren = 0;
BOOST_FOREACH(const COutput& out, coins.second) {
for(const COutput& out: coins.second) {
nSum += out.tx->vout[out.i].nValue;
nChildren++;

View File

@@ -5,7 +5,7 @@
#ifndef BITCOIN_QT_COINCONTROLDIALOG_H
#define BITCOIN_QT_COINCONTROLDIALOG_H
#include "amount.h"
#include <amount.h>
#include <QAbstractButton>
#include <QAction>

View File

@@ -3,22 +3,25 @@
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#if defined(HAVE_CONFIG_H)
#include "config/bitcoin-config.h"
#include <config/bitcoin-config.h>
#endif
#include "optionsdialog.h"
#include "ui_optionsdialog.h"
#include <qt/optionsdialog.h>
#include <ui_optionsdialog.h>
#include "bitcoinunits.h"
#include "guiutil.h"
#include "optionsmodel.h"
#include <qt/guiutil.h>
#include <qt/bitcoinunits.h>
#include <qt/optionsmodel.h>
#include <qt/platformstyle.h>
#include "main.h" // for DEFAULT_SCRIPTCHECK_THREADS and MAX_SCRIPTCHECK_THREADS
#include "netbase.h"
#include "txdb.h" // for -dbcache defaults
#include <chainparams.h>
#include <main.h> // for DEFAULT_SCRIPTCHECK_THREADS and MAX_SCRIPTCHECK_THREADS
#include <miner.h>
#include <netbase.h>
#include <txdb.h> // for -dbcache defaults
#ifdef ENABLE_WALLET
#include "wallet/wallet.h" // for CWallet::GetRequiredFee()
#include <wallet/wallet.h> // for CWallet::GetRequiredFee()
#endif
#include <boost/thread.hpp>
@@ -71,10 +74,14 @@ OptionsDialog::OptionsDialog(QWidget *parent, bool enableWallet) :
ui->tabWidget->removeTab(ui->tabWidget->indexOf(ui->tabWindow));
#endif
#ifdef ENABLE_WALLET
/* remove Wallet tab in case of -disablewallet */
if (!enableWallet) {
if (GetBoolArg("-disablewallet", false)) {
#endif // ENABLE_WALLET
ui->tabWidget->removeTab(ui->tabWidget->indexOf(ui->tabWallet));
#ifdef ENABLE_WALLET
}
#endif
/* Display elements init */
QDir translations(":translations");
@@ -84,7 +91,7 @@ OptionsDialog::OptionsDialog(QWidget *parent, bool enableWallet) :
ui->lang->setToolTip(ui->lang->toolTip().arg(tr(PACKAGE_NAME)));
ui->lang->addItem(QString("(") + tr("default") + QString(")"), QVariant(""));
Q_FOREACH(const QString &langStr, translations.entryList())
for(const QString &langStr: translations.entryList())
{
QLocale locale(langStr);
@@ -220,8 +227,8 @@ void OptionsDialog::on_resetButton_clicked()
{
// confirmation dialog
QMessageBox::StandardButton btnRetVal = QMessageBox::question(this, tr("Confirm options reset"),
tr("Client restart required to activate changes.") + "<br><br>" + tr("Client will be shut down. Do you want to proceed?"),
QMessageBox::Yes | QMessageBox::Cancel, QMessageBox::Cancel);
tr("Client restart required to activate changes.") + "<br><br>" + tr("Client will be shut down. Do you want to proceed?"),
QMessageBox::Yes | QMessageBox::Cancel, QMessageBox::Cancel);
if(btnRetVal == QMessageBox::Cancel)
return;
@@ -331,7 +338,7 @@ void OptionsDialog::updateDefaultProxyNets()
}
ProxyAddressValidator::ProxyAddressValidator(QObject *parent) :
QValidator(parent)
QValidator(parent)
{
}

View File

@@ -3,25 +3,25 @@
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#if defined(HAVE_CONFIG_H)
#include "config/bitcoin-config.h"
#include <config/bitcoin-config.h>
#endif
#include "optionsmodel.h"
#include <qt/optionsmodel.h>
#include "bitcoinunits.h"
#include "guiutil.h"
#include <qt/bitcoinunits.h>
#include <qt/guiutil.h>
#include "amount.h"
#include "init.h"
#include "main.h" // For DEFAULT_SCRIPTCHECK_THREADS
#include "net.h"
#include "netbase.h"
#include "txdb.h" // for -dbcache defaults
#include "intro.h"
#include <amount.h>
#include <init.h>
#include <main.h> // For DEFAULT_SCRIPTCHECK_THREADS
#include <net.h>
#include <netbase.h>
#include <txdb.h> // for -dbcache defaults
#include <intro.h>
#ifdef ENABLE_WALLET
#include "wallet/wallet.h"
#include "wallet/walletdb.h"
#include <wallet/wallet.h>
#include <wallet/walletdb.h>
#endif
#include <QNetworkProxy>
@@ -57,7 +57,7 @@ void OptionsModel::Init(bool resetSettings)
settings.setValue("fHideTrayIcon", false);
fHideTrayIcon = settings.value("fHideTrayIcon").toBool();
Q_EMIT hideTrayIconChanged(fHideTrayIcon);
if (!settings.contains("fMinimizeToTray"))
settings.setValue("fMinimizeToTray", false);
fMinimizeToTray = settings.value("fMinimizeToTray").toBool() && !fHideTrayIcon;
@@ -267,7 +267,7 @@ bool OptionsModel::setData(const QModelIndex & index, const QVariant & value, in
case HideTrayIcon:
fHideTrayIcon = value.toBool();
settings.setValue("fHideTrayIcon", fHideTrayIcon);
Q_EMIT hideTrayIconChanged(fHideTrayIcon);
Q_EMIT hideTrayIconChanged(fHideTrayIcon);
break;
case MinimizeToTray:
fMinimizeToTray = value.toBool();

View File

@@ -5,7 +5,7 @@
#ifndef BITCOIN_QT_OPTIONSMODEL_H
#define BITCOIN_QT_OPTIONSMODEL_H
#include "amount.h"
#include <amount.h>
#include <QAbstractListModel>
@@ -13,7 +13,7 @@ QT_BEGIN_NAMESPACE
class QNetworkProxy;
QT_END_NAMESPACE
/** Interface from Qt to configuration data structure for Bitcoin client.
/** Interface from Qt to configuration data structure for Blackcoin client.
To Qt, the options are presented as a list with the different options
laid out vertically.
This can be changed to a tree once the settings become sufficiently

View File

@@ -2,19 +2,20 @@
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include "paymentserver.h"
#include <qt/paymentserver.h>
#include "bitcoinunits.h"
#include "guiutil.h"
#include "optionsmodel.h"
#include <qt/bitcoinunits.h>
#include <qt/guiutil.h>
#include <qt/optionsmodel.h>
#include "chainparams.h"
#include "config.h"
#include "dstencode.h"
#include "main.h" // For minRelayTxFee
#include "ui_interface.h"
#include "util.h"
#include "wallet/wallet.h"
#include <base58.h>
#include <chainparams.h>
#include <config.h>
#include <dstencode.h>
#include <main.h> // For minRelayTxFee
#include <ui_interface.h>
#include <util.h>
#include <wallet/wallet.h>
#include <cstdlib>
@@ -147,7 +148,7 @@ void PaymentServer::LoadRootCAs(X509_STORE* _store)
int nRootCerts = 0;
const QDateTime currentTime = QDateTime::currentDateTime();
Q_FOREACH (const QSslCertificate& cert, certList) {
for (const QSslCertificate& cert: certList) {
// Don't log NULL certificates
if (cert.isNull())
continue;
@@ -318,14 +319,14 @@ void PaymentServer::ipcParseCommandLine(int argc, char* argv[])
bool PaymentServer::ipcSendCommandLine()
{
bool fResult = false;
Q_FOREACH (const QString& r, savedPaymentRequests)
for (const QString& r: savedPaymentRequests)
{
QLocalSocket* socket = new QLocalSocket();
socket->connectToServer(ipcServerName(), QIODevice::WriteOnly);
if (!socket->waitForConnected(BITCOIN_IPC_CONNECT_TIMEOUT))
{
delete socket;
socket = NULL;
socket = nullptr;
return false;
}
@@ -341,7 +342,7 @@ bool PaymentServer::ipcSendCommandLine()
socket->disconnectFromServer();
delete socket;
socket = NULL;
socket = nullptr;
fResult = true;
}
@@ -416,7 +417,7 @@ void PaymentServer::initNetManager()
{
if (!optionsModel)
return;
if (netManager != NULL)
if (netManager != nullptr)
delete netManager;
// netManager is used to fetch paymentrequests given in blackcoin: URIs
@@ -444,7 +445,7 @@ void PaymentServer::uiReady()
initNetManager();
saveURIs = false;
Q_FOREACH (const QString& s, savedPaymentRequests)
for (const QString& s: savedPaymentRequests)
{
handleURIOrFile(s);
}
@@ -628,25 +629,24 @@ bool PaymentServer::processPaymentRequest(const PaymentRequestPlus& request, Sen
QList<std::pair<CScript, CAmount> > sendingTos = request.getPayTo();
QStringList addresses;
Q_FOREACH(const PAIRTYPE(CScript, CAmount)& sendingTo, sendingTos) {
for(const PAIRTYPE(CScript, CAmount)& sendingTo: sendingTos) {
// Extract and check destination addresses
CTxDestination dest;
if (ExtractDestination(sendingTo.first, dest)) {
// Append destination address
addresses.append(QString::fromStdString(EncodeDestination(dest)));
}
else if (!recipient.authenticatedMerchant.isEmpty())
{
// Unauthenticated payment requests to custom bitcoin addresses are
// not supported (there is no good way to tell the user where they
// are paying in a way they'd have a chance of understanding).
else if (!recipient.authenticatedMerchant.isEmpty()) {
// Unauthenticated payment requests to custom blackcoin addresses are not supported
// (there is no good way to tell the user where they are paying in a way they'd
// have a chance of understanding).
Q_EMIT message(tr("Payment request rejected"),
tr("Unverified payment requests to custom payment scripts are unsupported."),
CClientUIInterface::MSG_ERROR);
return false;
}
// Bitcoin amounts are stored as (optional) uint64 in the protobuf messages (see paymentrequest.proto),
// Blackcoin amounts are stored as (optional) uint64 in the protobuf messages (see paymentrequest.proto),
// but CAmount is defined as int64_t. Because of that we need to verify that amounts are in a valid range
// and no overflow has happened.
if (!verifyAmount(sendingTo.second)) {
@@ -816,7 +816,7 @@ void PaymentServer::reportSslErrors(QNetworkReply* reply, const QList<QSslError>
Q_UNUSED(reply);
QString errString;
Q_FOREACH (const QSslError& err, errs) {
for (const QSslError& err: errs) {
qWarning() << "PaymentServer::reportSslErrors: " << err;
errString += err.errorString() + "\n";
}

View File

@@ -2,13 +2,13 @@
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include "peertablemodel.h"
#include <qt/peertablemodel.h>
#include "clientmodel.h"
#include "guiconstants.h"
#include "guiutil.h"
#include <qt/clientmodel.h>
#include <qt/guiconstants.h>
#include <qt/guiutil.h>
#include "sync.h"
#include <sync.h>
#include <QDebug>
#include <QList>
@@ -64,7 +64,7 @@ public:
#if QT_VERSION >= 0x040700
cachedNodeStats.reserve(vNodes.size());
#endif
Q_FOREACH (CNode* pnode, vNodes)
for (CNode* pnode: vNodes)
{
CNodeCombinedStats stats;
stats.nodeStateStats.nMisbehavior = 0;
@@ -81,7 +81,7 @@ public:
TRY_LOCK(cs_main, lockMain);
if (lockMain)
{
BOOST_FOREACH(CNodeCombinedStats &stats, cachedNodeStats)
for(CNodeCombinedStats &stats: cachedNodeStats)
stats.fNodeStateStatsAvailable = GetNodeStateStats(stats.nodeStats.nodeid, stats.nodeStateStats);
}
}
@@ -93,7 +93,7 @@ public:
// build index map
mapNodeRows.clear();
int row = 0;
Q_FOREACH (const CNodeCombinedStats& stats, cachedNodeStats)
for (const CNodeCombinedStats& stats: cachedNodeStats)
mapNodeRows.insert(std::pair<NodeId, int>(stats.nodeStats.nodeid, row++));
}

View File

@@ -5,8 +5,8 @@
#ifndef BITCOIN_QT_PEERTABLEMODEL_H
#define BITCOIN_QT_PEERTABLEMODEL_H
#include "main.h" // For CNodeStateStats
#include "net.h"
#include <main.h> // For CNodeStateStats
#include <net.h>
#include <QAbstractTableModel>
#include <QStringList>

View File

@@ -2,9 +2,9 @@
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include "platformstyle.h"
#include <qt/platformstyle.h>
#include "guiconstants.h"
#include <qt/guiconstants.h>
#include <QApplication>
#include <QColor>
@@ -49,7 +49,7 @@ QIcon ColorizeIcon(const QIcon& ico, const QColor& colorbase)
{
QIcon new_ico;
QSize sz;
Q_FOREACH(sz, ico.availableSizes())
for(QSize sz: ico.availableSizes())
{
QImage img(ico.pixmap(sz).toImage());
MakeSingleColorImage(img, colorbase);

View File

@@ -2,19 +2,19 @@
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include "receivecoinsdialog.h"
#include "ui_receivecoinsdialog.h"
#include <qt/receivecoinsdialog.h>
#include <ui_receivecoinsdialog.h>
#include "addressbookpage.h"
#include "addresstablemodel.h"
#include "bitcoinunits.h"
#include "config.h"
#include "guiutil.h"
#include "optionsmodel.h"
#include "platformstyle.h"
#include "receiverequestdialog.h"
#include "recentrequeststablemodel.h"
#include "walletmodel.h"
#include <qt/addressbookpage.h>
#include <qt/addresstablemodel.h>
#include <qt/bitcoinunits.h>
#include <config.h>
#include <qt/guiutil.h>
#include <qt/optionsmodel.h>
#include <qt/platformstyle.h>
#include <qt/receiverequestdialog.h>
#include <qt/recentrequeststablemodel.h>
#include <qt/walletmodel.h>
#include <QAction>
#include <QCursor>
@@ -193,7 +193,7 @@ void ReceiveCoinsDialog::on_showRequestButton_clicked()
return;
QModelIndexList selection = ui->recentRequestsView->selectionModel()->selectedRows();
Q_FOREACH (const QModelIndex& index, selection) {
for (const QModelIndex& index: selection) {
on_recentRequestsView_doubleClicked(index);
}
}

View File

@@ -5,7 +5,7 @@
#ifndef BITCOIN_QT_RECEIVECOINSDIALOG_H
#define BITCOIN_QT_RECEIVECOINSDIALOG_H
#include "guiutil.h"
#include <qt/guiutil.h>
#include <QDialog>
#include <QHeaderView>
@@ -28,7 +28,7 @@ QT_BEGIN_NAMESPACE
class QModelIndex;
QT_END_NAMESPACE
/** Dialog for requesting payment of bitcoins */
/** Dialog for requesting payment of blackcoin */
class ReceiveCoinsDialog : public QDialog
{
Q_OBJECT

View File

@@ -2,16 +2,14 @@
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include "recentrequeststablemodel.h"
#include <qt/recentrequeststablemodel.h>
#include "bitcoinunits.h"
#include "guiutil.h"
#include "optionsmodel.h"
#include <qt/bitcoinunits.h>
#include <qt/guiutil.h>
#include <qt/optionsmodel.h>
#include "clientversion.h"
#include "streams.h"
#include <boost/foreach.hpp>
#include <clientversion.h>
#include <streams.h>
RecentRequestsTableModel::RecentRequestsTableModel(CWallet *wallet, WalletModel *parent) :
QAbstractTableModel(parent), walletModel(parent)
@@ -22,7 +20,7 @@ RecentRequestsTableModel::RecentRequestsTableModel(CWallet *wallet, WalletModel
// Load entries from wallet
std::vector<std::string> vReceiveRequests;
parent->loadReceiveRequests(vReceiveRequests);
BOOST_FOREACH(const std::string& request, vReceiveRequests)
for(const std::string& request: vReceiveRequests)
addNewRequest(request);
/* These columns must match the indices in the ColumnIndex enumeration */
@@ -125,7 +123,7 @@ void RecentRequestsTableModel::updateAmountColumnTitle()
/** Gets title for amount column including current display unit if optionsModel reference available. */
QString RecentRequestsTableModel::getAmountTitle()
{
return (this->walletModel->getOptionsModel() != NULL) ? tr("Requested") + " ("+BitcoinUnits::name(this->walletModel->getOptionsModel()->getDisplayUnit()) + ")" : "";
return (this->walletModel->getOptionsModel() != nullptr) ? tr("Requested") + " ("+BitcoinUnits::name(this->walletModel->getOptionsModel()->getDisplayUnit()) + ")" : "";
}
QModelIndex RecentRequestsTableModel::index(int row, int column, const QModelIndex &parent) const

View File

@@ -5,7 +5,7 @@
#ifndef BITCOIN_QT_RECENTREQUESTSTABLEMODEL_H
#define BITCOIN_QT_RECENTREQUESTSTABLEMODEL_H
#include "walletmodel.h"
#include <qt/walletmodel.h>
#include <QAbstractTableModel>
#include <QStringList>
@@ -53,8 +53,7 @@ private:
Qt::SortOrder order;
};
/**
* Model for list of recently generated payment requests / blackcoin: URIs.
/** Model for list of recently generated payment requests / blackcoin: URIs.
* Part of wallet model.
*/
class RecentRequestsTableModel: public QAbstractTableModel

View File

@@ -2,25 +2,31 @@
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include "sendcoinsdialog.h"
#include "ui_sendcoinsdialog.h"
#include <qt/sendcoinsdialog.h>
#include <ui_sendcoinsdialog.h>
#include "addresstablemodel.h"
#include "bitcoinunits.h"
#include "clientmodel.h"
#include "coincontroldialog.h"
#include "guiutil.h"
#include "optionsmodel.h"
#include "platformstyle.h"
#include "sendcoinsentry.h"
#include "walletmodel.h"
#include <qt/addresstablemodel.h>
#include <qt/bitcoinunits.h>
#include <qt/clientmodel.h>
#include <qt/coincontroldialog.h>
#include <qt/guiutil.h>
#include <qt/optionsmodel.h>
#include <qt/platformstyle.h>
#include <qt/sendcoinsentry.h>
#include <qt/walletmodel.h>
#include <net.h>
#include <util.h>
#include <utilstrencodings.h>
#include "coincontrol.h"
#include "dstencode.h"
#include "main.h" // mempool and minRelayTxFee
#include "ui_interface.h"
#include "txmempool.h"
#include "wallet/wallet.h"
#include <base58.h>
#include <coincontrol.h>
#include <dstencode.h>
#include <main.h> // mempool and minRelayTxFee
#include <ui_interface.h>
#include <txmempool.h>
#include <wallet/wallet.h>
#include <stdexcept>
#include <QMessageBox>
#include <QScrollBar>
@@ -228,6 +234,7 @@ void SendCoinsDialog::on_sendButton_clicked()
// prepare transaction for getting txFee earlier
WalletModelTransaction currentTransaction(recipients);
WalletModel::SendCoinsReturn prepareStatus;
if (model->getOptionsModel()->getCoinControlFeatures()) // coin control enabled
prepareStatus = model->prepareTransaction(currentTransaction, CoinControlDialog::coinControl);
@@ -247,7 +254,7 @@ void SendCoinsDialog::on_sendButton_clicked()
// Format confirmation message
QStringList formatted;
Q_FOREACH(const SendCoinsRecipient &rcp, currentTransaction.getRecipients())
for(const SendCoinsRecipient &rcp: currentTransaction.getRecipients())
{
// generate bold amount string
QString amount = "<b>" + BitcoinUnits::formatHtmlWithUnit(model->getOptionsModel()->getDisplayUnit(), rcp.amount);
@@ -285,23 +292,23 @@ void SendCoinsDialog::on_sendButton_clicked()
QString questionString = tr("Are you sure you want to send?");
questionString.append("<br /><br />%1");
if(txFee > 0)
{
// append fee string if a fee is required
questionString.append("<hr /><span style='color:#aa0000;'>");
questionString.append(BitcoinUnits::formatHtmlWithUnit(model->getOptionsModel()->getDisplayUnit(), txFee));
questionString.append("</span> ");
questionString.append(tr("added as transaction fee"));
if(txFee > 0)
{
// append fee string if a fee is required
questionString.append("<hr /><span style='color:#aa0000;'>");
questionString.append(BitcoinUnits::formatHtmlWithUnit(model->getOptionsModel()->getDisplayUnit(), txFee));
questionString.append("</span> ");
questionString.append(tr("added as transaction fee"));
// append transaction size
questionString.append(" (" + QString::number((double)currentTransaction.getTransactionSize() / 1000) + " kB)");
// append transaction size
questionString.append(" (" + QString::number((double)currentTransaction.getTransactionSize() / 1000) + " kB)");
}
// add total amount in all subdivision units
questionString.append("<hr />");
CAmount totalAmount = currentTransaction.getTotalTransactionAmount() + txFee;
QStringList alternativeUnits;
Q_FOREACH(BitcoinUnits::Unit u, BitcoinUnits::availableUnits())
for(BitcoinUnits::Unit u: BitcoinUnits::availableUnits())
{
if(u != model->getOptionsModel()->getDisplayUnit())
alternativeUnits.append(BitcoinUnits::formatHtmlWithUnit(u, totalAmount));
@@ -309,7 +316,7 @@ void SendCoinsDialog::on_sendButton_clicked()
questionString.append(tr("Total Amount %1")
.arg(BitcoinUnits::formatHtmlWithUnit(model->getOptionsModel()->getDisplayUnit(), totalAmount)));
questionString.append(QString("<span style='font-size:10pt;font-weight:normal;'><br />(=%2)</span>")
.arg(alternativeUnits.join(" " + tr("or") + "<br />")));
.arg(alternativeUnits.join(" " + tr("or") + " ")));
SendConfirmationDialog confirmationDialog(tr("Confirm send coins"),
questionString.arg(formatted.join("<br />")), SEND_CONFIRM_DELAY, this);

View File

@@ -5,7 +5,7 @@
#ifndef BITCOIN_QT_SENDCOINSDIALOG_H
#define BITCOIN_QT_SENDCOINSDIALOG_H
#include "walletmodel.h"
#include <qt/walletmodel.h>
#include <QDialog>
#include <QMessageBox>
@@ -28,7 +28,7 @@ QT_END_NAMESPACE
const int defaultConfirmTarget = 25;
/** Dialog for sending bitcoins */
/** Dialog for sending blackcoin */
class SendCoinsDialog : public QDialog
{
Q_OBJECT

View File

@@ -83,7 +83,7 @@ void WalletModelTransaction::reassignAmounts(int nChangePosRet)
CAmount WalletModelTransaction::getTotalTransactionAmount()
{
CAmount totalTransactionAmount = 0;
Q_FOREACH(const SendCoinsRecipient &rcp, recipients)
for(const SendCoinsRecipient &rcp: recipients)
{
totalTransactionAmount += rcp.amount;
}

View File

@@ -19,7 +19,6 @@
#include <boost/assign/list_of.hpp> // for 'map_list_of()'
#include <boost/date_time/posix_time/posix_time_types.hpp>
#include <boost/foreach.hpp>
#include <boost/test/unit_test.hpp>
// Tests this internal-to-main.cpp method:

View File

@@ -15,7 +15,6 @@
#include "utilstrencodings.h"
#include "test/test_bitcoin.h"
#include <boost/foreach.hpp>
#include <boost/test/unit_test.hpp>
#include <univalue.h>

View File

@@ -84,7 +84,7 @@ void RunTest(const TestVector &test) {
CExtPubKey pubkey;
key.SetMaster(&seed[0], seed.size());
pubkey = key.Neuter();
BOOST_FOREACH(const TestDerivation &derive, test.vDerive) {
for(const TestDerivation &derive: test.vDerive) {
unsigned char data[74];
key.Encode(data);
pubkey.Encode(data);

View File

@@ -159,7 +159,7 @@ BOOST_AUTO_TEST_CASE(coins_cache_simulation_test)
missed_an_entry = true;
}
}
BOOST_FOREACH(const CCoinsViewCacheTest *test, stack) {
for(const CCoinsViewCacheTest *test: stack) {
test->SelfTest();
}
}

View File

@@ -9,7 +9,6 @@
#include <vector>
#include <boost/algorithm/string.hpp>
#include <boost/foreach.hpp>
#include <boost/test/unit_test.hpp>
BOOST_FIXTURE_TEST_SUITE(getarg_tests, BasicTestingSetup)
@@ -25,7 +24,7 @@ static void ResetArgs(const std::string& strArg)
// Convert to char*:
std::vector<const char*> vecChar;
BOOST_FOREACH(std::string& s, vecArg)
for(std::string& s: vecArg)
vecChar.push_back(s.c_str());
ParseParameters(vecChar.size(), &vecChar[0]);

View File

@@ -494,7 +494,7 @@ BOOST_AUTO_TEST_CASE(CreateNewBlock_validity)
TestPackageSelection(chainparams, scriptPubKey, txFirst);
BOOST_FOREACH(CTransaction *_tx, txFirst)
for(CTransaction *_tx: txFirst)
delete _tx;
fCheckpointsEnabled = true;

View File

@@ -16,8 +16,6 @@
#include "uint256.h"
#include "test/test_bitcoin.h"
#include <boost/foreach.hpp>
#include <boost/test/unit_test.hpp>
using namespace std;
@@ -33,7 +31,7 @@ sign_multisig(CScript scriptPubKey, vector<CKey> keys, CTransaction transaction,
CScript result;
result << OP_0; // CHECKMULTISIG bug workaround
BOOST_FOREACH(const CKey &key, keys)
for(const CKey &key: keys)
{
vector<unsigned char> vchSig;
BOOST_CHECK(key.Sign(hash, vchSig));

View File

@@ -3,14 +3,16 @@
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include <vector>
#include "prevector.h"
#include "random.h"
#include <prevector.h>
#include <random.h>
#include "serialize.h"
#include "streams.h"
#include <serialize.h>
#include <streams.h>
#include "test/test_bitcoin.h"
#include <test/test_bitcoin.h>
#include <boost/foreach.hpp>
#include <boost/range/adaptor/reversed.hpp>
#include <boost/test/unit_test.hpp>
BOOST_FIXTURE_TEST_SUITE(PrevectorTests, TestingSetup)
@@ -41,13 +43,13 @@ class prevector_tester {
BOOST_CHECK(pretype(real_vector.begin(), real_vector.end()) == pre_vector);
BOOST_CHECK(pretype(pre_vector.begin(), pre_vector.end()) == pre_vector);
size_t pos = 0;
BOOST_FOREACH(const T& v, pre_vector) {
for(const T& v: pre_vector) {
BOOST_CHECK(v == real_vector[pos++]);
}
BOOST_REVERSE_FOREACH(const T& v, pre_vector) {
BOOST_CHECK(v == real_vector[--pos]);
}
BOOST_FOREACH(const T& v, const_pre_vector) {
for(const T& v: const_pre_vector) {
BOOST_CHECK(v == real_vector[pos++]);
}
BOOST_REVERSE_FOREACH(const T& v, const_pre_vector) {

View File

@@ -24,7 +24,6 @@
#include <string>
#include <vector>
#include <boost/foreach.hpp>
#include <boost/test/unit_test.hpp>
#include <univalue.h>
@@ -698,7 +697,7 @@ BOOST_AUTO_TEST_CASE(script_build)
std::string strGen;
BOOST_FOREACH(TestBuilder& test, tests) {
for(TestBuilder& test: tests) {
test.Test();
std::string str = JSONPrettyPrint(test.GetJSON());
#ifndef UPDATE_JSON_TESTS
@@ -797,7 +796,7 @@ sign_multisig(CScript scriptPubKey, std::vector<CKey> keys, CTransaction transac
// and vice-versa)
//
result << OP_0;
BOOST_FOREACH(const CKey &key, keys)
for(const CKey &key: keys)
{
vector<unsigned char> vchSig;
BOOST_CHECK(key.Sign(hash, vchSig));

View File

@@ -12,7 +12,6 @@
#include <vector>
#include <boost/foreach.hpp>
#include <boost/test/unit_test.hpp>
using namespace std;

View File

@@ -110,7 +110,7 @@ TestChain100Setup::CreateAndProcessBlock(const std::vector<CMutableTransaction>&
// Replace mempool-selected txns with just coinbase plus passed-in txns:
block.vtx.resize(1);
BOOST_FOREACH(const CMutableTransaction& tx, txns)
for(const CMutableTransaction& tx: txns)
block.vtx.push_back(tx);
// IncrementExtraNonce creates a valid coinbase and merkleRoot
unsigned int extraNonce = 0;

View File

@@ -63,7 +63,7 @@ unsigned int ParseScriptFlags(string strFlags)
vector<string> words;
boost::algorithm::split(words, strFlags, boost::algorithm::is_any_of(","));
BOOST_FOREACH(string word, words)
for(string word: words)
{
if (!mapFlagNames.count(word))
BOOST_ERROR("Bad test: unknown verification flag '" << word << "'");

View File

@@ -1273,7 +1273,7 @@ void ListTransactions(const CWalletTx& wtx, const string& strAccount, int nMinDe
// Sent
if ((!listSent.empty() || nFee != 0) && (fAllAccounts || strAccount == strSentAccount))
{
BOOST_FOREACH(const COutputEntry& s, listSent)
for(const COutputEntry& s: listSent)
{
UniValue entry(UniValue::VOBJ);
if(involvesWatchonly || (::IsMine(*pwalletMain, s.destination) & ISMINE_WATCH_ONLY))
@@ -1296,7 +1296,7 @@ void ListTransactions(const CWalletTx& wtx, const string& strAccount, int nMinDe
// Received
if (listReceived.size() > 0 && wtx.GetDepthInMainChain() >= nMinDepth)
{
BOOST_FOREACH(const COutputEntry& r, listReceived)
for(const COutputEntry& r: listReceived)
{
string account;
if (pwalletMain->mapAddressBook.count(r.destination))
@@ -1600,7 +1600,7 @@ UniValue listsinceblock(const UniValue& params, bool fHelp)
LOCK2(cs_main, pwalletMain->cs_wallet);
CBlockIndex *pindex = NULL;
CBlockIndex *pindex = nullptr;
int target_confirms = 1;
isminefilter filter = ISMINE_SPENDABLE;
@@ -2385,10 +2385,10 @@ UniValue listunspent(const UniValue& params, bool fHelp)
UniValue results(UniValue::VARR);
vector<COutput> vecOutputs;
assert(pwalletMain != NULL);
assert(pwalletMain != nullptr);
LOCK2(cs_main, pwalletMain->cs_wallet);
pwalletMain->AvailableCoins(vecOutputs, false, NULL, true);
BOOST_FOREACH(const COutput& out, vecOutputs) {
pwalletMain->AvailableCoins(vecOutputs, false, nullptr, true);
for(const COutput& out: vecOutputs) {
if (out.nDepth < nMinDepth || out.nDepth > nMaxDepth)
continue;