diff --git a/src/addrman.cpp b/src/addrman.cpp --- a/src/addrman.cpp +++ b/src/addrman.cpp @@ -37,8 +37,8 @@ int CAddrInfo::GetBucketPosition(const uint256 &nKey, bool fNew, int nBucket) const { - uint64_t hash1 = (CHashWriter(SER_GETHASH, 0) << nKey << (fNew ? 'N' : 'K') - << nBucket << GetKey()) + uint64_t hash1 = (CHashWriter(SER_GETHASH, 0) + << nKey << (fNew ? 'N' : 'K') << nBucket << GetKey()) .GetHash() .GetCheapHash(); return hash1 % ADDRMAN_BUCKET_SIZE; diff --git a/src/bench/bench.h b/src/bench/bench.h --- a/src/bench/bench.h +++ b/src/bench/bench.h @@ -73,7 +73,7 @@ static void RunAll(double elapsedTimeForOne = 1.0); }; -} +} // namespace benchmark // BENCHMARK(foo) expands to: benchmark::BenchRunner bench_11foo("foo", foo); #define BENCHMARK(n) \ diff --git a/src/cashaddrenc.cpp b/src/cashaddrenc.cpp --- a/src/cashaddrenc.cpp +++ b/src/cashaddrenc.cpp @@ -84,7 +84,7 @@ const CChainParams ¶ms; }; -} // anon ns +} // namespace std::string EncodeCashAddr(const CTxDestination &dst, const CChainParams ¶ms) { diff --git a/src/checkqueue.h b/src/checkqueue.h --- a/src/checkqueue.h +++ b/src/checkqueue.h @@ -106,8 +106,8 @@ // helping. // * Don't do batches smaller than 1 (duh), or larger than // nBatchSize. - nNow = std::max( - 1U, std::min(nBatchSize, (unsigned int)queue.size() / + nNow = std::max(1U, std::min(nBatchSize, + (unsigned int)queue.size() / (nTotal + nIdle + 1))); vChecks.resize(nNow); for (unsigned int i = 0; i < nNow; i++) { diff --git a/src/compat/glibc_sanity.cpp b/src/compat/glibc_sanity.cpp --- a/src/compat/glibc_sanity.cpp +++ b/src/compat/glibc_sanity.cpp @@ -50,7 +50,7 @@ } #endif -} // anon namespace +} // namespace bool glibc_sanity_test() { #if defined(HAVE_SYS_SELECT_H) diff --git a/src/compat/glibcxx_sanity.cpp b/src/compat/glibcxx_sanity.cpp --- a/src/compat/glibcxx_sanity.cpp +++ b/src/compat/glibcxx_sanity.cpp @@ -34,7 +34,7 @@ return true; } -} // anon namespace +} // namespace // trigger: string::at(x) on an empty string to trigger // __throw_out_of_range_fmt. diff --git a/src/crypto/ctaes/ctaes.c b/src/crypto/ctaes/ctaes.c --- a/src/crypto/ctaes/ctaes.c +++ b/src/crypto/ctaes/ctaes.c @@ -1,8 +1,8 @@ /********************************************************************* -* Copyright (c) 2016 Pieter Wuille * -* Distributed under the MIT software license, see the accompanying * -* file COPYING or http://www.opensource.org/licenses/mit-license.php.* -**********************************************************************/ + * Copyright (c) 2016 Pieter Wuille * + * Distributed under the MIT software license, see the accompanying * + * file COPYING or http://www.opensource.org/licenses/mit-license.php.* + **********************************************************************/ /* Constant time, unoptimized, concise, plain C, AES implementation * Based On: diff --git a/src/crypto/ctaes/test.c b/src/crypto/ctaes/test.c --- a/src/crypto/ctaes/test.c +++ b/src/crypto/ctaes/test.c @@ -1,8 +1,8 @@ /********************************************************************* -* Copyright (c) 2016 Pieter Wuille * -* Distributed under the MIT software license, see the accompanying * -* file COPYING or http://www.opensource.org/licenses/mit-license.php.* -**********************************************************************/ + * Copyright (c) 2016 Pieter Wuille * + * Distributed under the MIT software license, see the accompanying * + * file COPYING or http://www.opensource.org/licenses/mit-license.php.* + **********************************************************************/ #include "ctaes.h" diff --git a/src/cuckoocache.h b/src/cuckoocache.h --- a/src/cuckoocache.h +++ b/src/cuckoocache.h @@ -221,14 +221,14 @@ * @returns std::array of deterministic hashes derived from e */ inline std::array compute_hashes(const Element &e) const { - return {{hash_function.template operator() < 0 > (e)&hash_mask, - hash_function.template operator() < 1 > (e)&hash_mask, - hash_function.template operator() < 2 > (e)&hash_mask, - hash_function.template operator() < 3 > (e)&hash_mask, - hash_function.template operator() < 4 > (e)&hash_mask, - hash_function.template operator() < 5 > (e)&hash_mask, - hash_function.template operator() < 6 > (e)&hash_mask, - hash_function.template operator() < 7 > (e)&hash_mask}}; + return {{hash_function.template operator()<0>(e) & hash_mask, + hash_function.template operator()<1>(e) & hash_mask, + hash_function.template operator()<2>(e) & hash_mask, + hash_function.template operator()<3>(e) & hash_mask, + hash_function.template operator()<4>(e) & hash_mask, + hash_function.template operator()<5>(e) & hash_mask, + hash_function.template operator()<6>(e) & hash_mask, + hash_function.template operator()<7>(e) & hash_mask}}; } /* end diff --git a/src/dbwrapper.h b/src/dbwrapper.h --- a/src/dbwrapper.h +++ b/src/dbwrapper.h @@ -42,7 +42,7 @@ * specific database. */ const std::vector &GetObfuscateKey(const CDBWrapper &w); -}; +}; // namespace dbwrapper_private /** Batch of changes queued to be written to a CDBWrapper */ class CDBBatch { diff --git a/src/dbwrapper.cpp b/src/dbwrapper.cpp --- a/src/dbwrapper.cpp +++ b/src/dbwrapper.cpp @@ -218,4 +218,4 @@ const std::vector &GetObfuscateKey(const CDBWrapper &w) { return w.obfuscate_key; } -}; +}; // namespace dbwrapper_private diff --git a/src/init.cpp b/src/init.cpp --- a/src/init.cpp +++ b/src/init.cpp @@ -446,8 +446,9 @@ _("Discover own IP addresses (default: 1 when " "listening and no -externalip or -proxy)")); strUsage += HelpMessageOpt( - "-dns", _("Allow DNS lookups for -addnode, -seednode and -connect") + - " " + strprintf(_("(default: %d)"), DEFAULT_NAME_LOOKUP)); + "-dns", + _("Allow DNS lookups for -addnode, -seednode and -connect") + " " + + strprintf(_("(default: %d)"), DEFAULT_NAME_LOOKUP)); strUsage += HelpMessageOpt( "-dnsseed", _("Query for peer addresses via DNS lookup, if low on " "addresses (default: 1 unless -connect/-noconnect)")); @@ -1888,11 +1889,11 @@ // total cache cannot be greater than nMaxDbcache nTotalCache = std::min(nTotalCache, nMaxDbCache << 20); int64_t nBlockTreeDBCache = nTotalCache / 8; - nBlockTreeDBCache = - std::min(nBlockTreeDBCache, (GetBoolArg("-txindex", DEFAULT_TXINDEX) - ? nMaxBlockDBAndTxIndexCache - : nMaxBlockDBCache) - << 20); + nBlockTreeDBCache = std::min(nBlockTreeDBCache, + (GetBoolArg("-txindex", DEFAULT_TXINDEX) + ? nMaxBlockDBAndTxIndexCache + : nMaxBlockDBCache) + << 20); nTotalCache -= nBlockTreeDBCache; // use 25%-50% of the remainder for disk cache int64_t nCoinDBCache = @@ -2048,8 +2049,9 @@ _("Do you want to rebuild the block database now?"), strLoadError + ".\nPlease restart with -reindex or " "-reindex-chainstate to recover.", - "", CClientUIInterface::MSG_ERROR | - CClientUIInterface::BTN_ABORT); + "", + CClientUIInterface::MSG_ERROR | + CClientUIInterface::BTN_ABORT); if (fRet) { fReindex = true; fRequestShutdown = false; diff --git a/src/memusage.h b/src/memusage.h --- a/src/memusage.h +++ b/src/memusage.h @@ -178,6 +178,6 @@ m.size() + MallocUsage(sizeof(void *) * m.bucket_count()); } -} +} // namespace memusage #endif // BITCOIN_MEMUSAGE_H diff --git a/src/net.cpp b/src/net.cpp --- a/src/net.cpp +++ b/src/net.cpp @@ -344,8 +344,9 @@ /// debug print LogPrint(BCLog::NET, "trying connection %s lastseen=%.1fhrs\n", pszDest ? pszDest : addrConnect.ToString(), - pszDest ? 0.0 : (double)(GetAdjustedTime() - addrConnect.nTime) / - 3600.0); + pszDest + ? 0.0 + : (double)(GetAdjustedTime() - addrConnect.nTime) / 3600.0); // Connect SOCKET hSocket; @@ -853,10 +854,11 @@ break; } - nBytes = send( - pnode->hSocket, reinterpret_cast(data.data()) + - pnode->nSendOffset, - data.size() - pnode->nSendOffset, MSG_NOSIGNAL | MSG_DONTWAIT); + nBytes = send(pnode->hSocket, + reinterpret_cast(data.data()) + + pnode->nSendOffset, + data.size() - pnode->nSendOffset, + MSG_NOSIGNAL | MSG_DONTWAIT); } if (nBytes == 0) { @@ -2122,8 +2124,9 @@ std::unique_lock lock(mutexMsgProc); if (!fMoreWork) { - condMsgProc.wait_until(lock, std::chrono::steady_clock::now() + - std::chrono::milliseconds(100), + condMsgProc.wait_until(lock, + std::chrono::steady_clock::now() + + std::chrono::milliseconds(100), [this] { return fMsgProcWake; }); } fMsgProcWake = false; diff --git a/src/net_processing.cpp b/src/net_processing.cpp --- a/src/net_processing.cpp +++ b/src/net_processing.cpp @@ -514,10 +514,11 @@ lNodesAnnouncingHeaderAndIDs.pop_front(); } fAnnounceUsingCMPCTBLOCK = true; - connman.PushMessage(pfrom, CNetMsgMaker(pfrom->GetSendVersion()) - .Make(NetMsgType::SENDCMPCT, - fAnnounceUsingCMPCTBLOCK, - nCMPCTBLOCKVersion)); + connman.PushMessage(pfrom, + CNetMsgMaker(pfrom->GetSendVersion()) + .Make(NetMsgType::SENDCMPCT, + fAnnounceUsingCMPCTBLOCK, + nCMPCTBLOCKVersion)); lNodesAnnouncingHeaderAndIDs.push_back(pfrom->GetId()); return true; }); @@ -1249,8 +1250,9 @@ } if (sendMerkleBlock) { connman.PushMessage( - pfrom, msgMaker.Make(NetMsgType::MERKLEBLOCK, - merkleBlock)); + pfrom, + msgMaker.Make(NetMsgType::MERKLEBLOCK, + merkleBlock)); // CMerkleBlock just contains hashes, so also push // any transactions in the block the client did not // see. This avoids hurting performance by @@ -1284,13 +1286,15 @@ chainActive.Height() - MAX_CMPCTBLOCK_DEPTH) { CBlockHeaderAndShortTxIDs cmpctblock(block); connman.PushMessage( - pfrom, msgMaker.Make(nSendFlags, - NetMsgType::CMPCTBLOCK, - cmpctblock)); + pfrom, + msgMaker.Make(nSendFlags, + NetMsgType::CMPCTBLOCK, + cmpctblock)); } else { - connman.PushMessage( - pfrom, msgMaker.Make(nSendFlags, - NetMsgType::BLOCK, block)); + connman.PushMessage(pfrom, + msgMaker.Make(nSendFlags, + NetMsgType::BLOCK, + block)); } } @@ -1325,9 +1329,10 @@ // a MEMPOOL request. if (txinfo.tx && txinfo.nTime <= pfrom->timeLastMempoolReq) { - connman.PushMessage(pfrom, msgMaker.Make(nSendFlags, - NetMsgType::TX, - *txinfo.tx)); + connman.PushMessage(pfrom, + msgMaker.Make(nSendFlags, + NetMsgType::TX, + *txinfo.tx)); push = true; } } @@ -1667,9 +1672,10 @@ // as well, because they may wish to request compact blocks from us. bool fAnnounceUsingCMPCTBLOCK = false; uint64_t nCMPCTBLOCKVersion = 1; - connman.PushMessage(pfrom, msgMaker.Make(NetMsgType::SENDCMPCT, - fAnnounceUsingCMPCTBLOCK, - nCMPCTBLOCKVersion)); + connman.PushMessage(pfrom, + msgMaker.Make(NetMsgType::SENDCMPCT, + fAnnounceUsingCMPCTBLOCK, + nCMPCTBLOCKVersion)); } pfrom->fSuccessfullyConnected = true; } @@ -2253,11 +2259,12 @@ // Never send AcceptToMemoryPool's internal codes over P2P. if (state.GetRejectCode() < REJECT_INTERNAL) { connman.PushMessage( - pfrom, msgMaker.Make(NetMsgType::REJECT, strCommand, - uint8_t(state.GetRejectCode()), - state.GetRejectReason().substr( - 0, MAX_REJECT_MESSAGE_LENGTH), - inv.hash)); + pfrom, + msgMaker.Make(NetMsgType::REJECT, strCommand, + uint8_t(state.GetRejectCode()), + state.GetRejectReason().substr( + 0, MAX_REJECT_MESSAGE_LENGTH), + inv.hash)); } if (nDoS > 0) { Misbehaving(pfrom, nDoS, state.GetRejectReason()); @@ -2532,9 +2539,8 @@ LOCK(cs_main); std::map::iterator>>::iterator it = - mapBlocksInFlight.find(resp.blockhash); + std::pair::iterator>>:: + iterator it = mapBlocksInFlight.find(resp.blockhash); if (it == mapBlocksInFlight.end() || !it->second.second->partialBlock || it->second.first != pfrom->GetId()) { @@ -2652,10 +2658,11 @@ mapBlockIndex.end() && nCount < MAX_BLOCKS_TO_ANNOUNCE) { nodestate->nUnconnectingHeaders++; - connman.PushMessage(pfrom, msgMaker.Make(NetMsgType::GETHEADERS, - chainActive.GetLocator( - pindexBestHeader), - uint256())); + connman.PushMessage( + pfrom, + msgMaker.Make(NetMsgType::GETHEADERS, + chainActive.GetLocator(pindexBestHeader), + uint256())); LogPrint(BCLog::NET, "received header %s: missing prev block " "%s, sending getheaders (%d) to end " "(peer=%d, nUnconnectingHeaders=%d)\n", @@ -2725,9 +2732,10 @@ "more getheaders (%d) to end to peer=%d (startheight:%d)\n", pindexLast->nHeight, pfrom->id, pfrom->nStartingHeight); connman.PushMessage( - pfrom, msgMaker.Make(NetMsgType::GETHEADERS, - chainActive.GetLocator(pindexLast), - uint256())); + pfrom, + msgMaker.Make(NetMsgType::GETHEADERS, + chainActive.GetLocator(pindexLast), + uint256())); } bool fCanDirectFetch = CanDirectFetch(chainparams.GetConsensus()); @@ -3052,10 +3060,11 @@ for (const CBlockReject &reject : state.rejects) { connman.PushMessage( - pnode, CNetMsgMaker(INIT_PROTO_VERSION) - .Make(NetMsgType::REJECT, (std::string)NetMsgType::BLOCK, - reject.chRejectCode, reject.strRejectReason, - reject.hashBlock)); + pnode, + CNetMsgMaker(INIT_PROTO_VERSION) + .Make(NetMsgType::REJECT, (std::string)NetMsgType::BLOCK, + reject.chRejectCode, reject.strRejectReason, + reject.hashBlock)); } state.rejects.clear(); @@ -3180,10 +3189,11 @@ fMoreWork = true; } } catch (const std::ios_base::failure &e) { - connman.PushMessage( - pfrom, CNetMsgMaker(INIT_PROTO_VERSION) - .Make(NetMsgType::REJECT, strCommand, REJECT_MALFORMED, - std::string("error parsing message"))); + connman.PushMessage(pfrom, + CNetMsgMaker(INIT_PROTO_VERSION) + .Make(NetMsgType::REJECT, strCommand, + REJECT_MALFORMED, + std::string("error parsing message"))); if (strstr(e.what(), "end of data")) { // Allow exceptions from under-length message on vRecv LogPrintf( @@ -3473,9 +3483,10 @@ bool ret = ReadBlockFromDisk(block, pBestIndex, config); assert(ret); CBlockHeaderAndShortTxIDs cmpctblock(block); - connman.PushMessage( - pto, msgMaker.Make(nSendFlags, NetMsgType::CMPCTBLOCK, - cmpctblock)); + connman.PushMessage(pto, + msgMaker.Make(nSendFlags, + NetMsgType::CMPCTBLOCK, + cmpctblock)); } state.pindexBestHeaderSent = pBestIndex; } else if (state.fPreferHeaders) { @@ -3733,8 +3744,9 @@ state.nBlocksInFlight < MAX_BLOCKS_IN_TRANSIT_PER_PEER) { std::vector vToDownload; NodeId staller = -1; - FindNextBlocksToDownload(pto->GetId(), MAX_BLOCKS_IN_TRANSIT_PER_PEER - - state.nBlocksInFlight, + FindNextBlocksToDownload(pto->GetId(), + MAX_BLOCKS_IN_TRANSIT_PER_PEER - + state.nBlocksInFlight, vToDownload, staller, consensusParams); for (const CBlockIndex *pindex : vToDownload) { uint32_t nFetchFlags = diff --git a/src/protocol.h b/src/protocol.h --- a/src/protocol.h +++ b/src/protocol.h @@ -242,7 +242,7 @@ * @since protocol version 70014 as described by BIP 152 */ extern const char *BLOCKTXN; -}; +}; // namespace NetMsgType /* Get a vector of all valid message types (see above) */ const std::vector &getAllNetMessageTypes(); diff --git a/src/protocol.cpp b/src/protocol.cpp --- a/src/protocol.cpp +++ b/src/protocol.cpp @@ -39,7 +39,7 @@ const char *CMPCTBLOCK = "cmpctblock"; const char *GETBLOCKTXN = "getblocktxn"; const char *BLOCKTXN = "blocktxn"; -}; +}; // namespace NetMsgType /** * All known message types. Keep this in the same order as the list of messages diff --git a/src/pubkey.cpp b/src/pubkey.cpp --- a/src/pubkey.cpp +++ b/src/pubkey.cpp @@ -10,7 +10,7 @@ namespace { /* Global secp256k1_context object used for verification. */ secp256k1_context *secp256k1_context_verify = nullptr; -} +} // namespace /** * This function is taken from the libsecp256k1 distribution and implements DER @@ -209,9 +209,9 @@ } uint8_t pub[65]; size_t publen = 65; - secp256k1_ec_pubkey_serialize(secp256k1_context_verify, pub, &publen, - &pubkey, fComp ? SECP256K1_EC_COMPRESSED - : SECP256K1_EC_UNCOMPRESSED); + secp256k1_ec_pubkey_serialize( + secp256k1_context_verify, pub, &publen, &pubkey, + fComp ? SECP256K1_EC_COMPRESSED : SECP256K1_EC_UNCOMPRESSED); Set(pub, pub + publen); return true; } diff --git a/src/qt/bitcoinamountfield.h b/src/qt/bitcoinamountfield.h --- a/src/qt/bitcoinamountfield.h +++ b/src/qt/bitcoinamountfield.h @@ -16,7 +16,7 @@ QT_END_NAMESPACE /** Widget for entering bitcoin amounts. - */ + */ class BitcoinAmountField : public QWidget { Q_OBJECT diff --git a/src/qt/coincontroldialog.cpp b/src/qt/coincontroldialog.cpp --- a/src/qt/coincontroldialog.cpp +++ b/src/qt/coincontroldialog.cpp @@ -763,9 +763,10 @@ // label if (!(sAddress == sWalletAddress)) { // change tooltip from where the change comes from - itemOutput->setToolTip(COLUMN_LABEL, tr("change from %1 (%2)") - .arg(sWalletLabel) - .arg(sWalletAddress)); + itemOutput->setToolTip(COLUMN_LABEL, + tr("change from %1 (%2)") + .arg(sWalletLabel) + .arg(sWalletAddress)); itemOutput->setText(COLUMN_LABEL, tr("(change)")); } else if (!treeMode) { QString sLabel = diff --git a/src/qt/openuridialog.cpp b/src/qt/openuridialog.cpp --- a/src/qt/openuridialog.cpp +++ b/src/qt/openuridialog.cpp @@ -42,6 +42,6 @@ this, tr("Select payment request file to open"), "", "", nullptr); if (filename.isEmpty()) return; QUrl fileUri = QUrl::fromLocalFile(filename); - ui->uriEdit->setText(GUIUtil::bitcoinURIScheme(*cfg) + ":?r=" + - QUrl::toPercentEncoding(fileUri.toString())); + ui->uriEdit->setText(GUIUtil::bitcoinURIScheme(*cfg) + + ":?r=" + QUrl::toPercentEncoding(fileUri.toString())); } diff --git a/src/qt/platformstyle.cpp b/src/qt/platformstyle.cpp --- a/src/qt/platformstyle.cpp +++ b/src/qt/platformstyle.cpp @@ -61,7 +61,7 @@ QIcon ColorizeIcon(const QString &filename, const QColor &colorbase) { return QIcon(QPixmap::fromImage(ColorizeImage(filename, colorbase))); } -} +} // namespace PlatformStyle::PlatformStyle(const QString &_name, bool _imagesOnButtons, bool _colorizeIcons, bool _useExtraSpacing) diff --git a/src/qt/receiverequestdialog.cpp b/src/qt/receiverequestdialog.cpp --- a/src/qt/receiverequestdialog.cpp +++ b/src/qt/receiverequestdialog.cpp @@ -112,7 +112,7 @@ // This converts to clients current configuration. QString ToCurrentEncoding(const QString &addr, const Config &cfg) { if (!IsValidDestinationString(addr.toStdString(), cfg.GetChainParams())) { - // We have something sketchy as input. Do not try to convert. + // We have something sketchy as input. Do not try to convert. return addr; } CTxDestination dst = @@ -141,19 +141,19 @@ html += "" + tr("Payment information") + "
"; html += "" + tr("URI") + ": "; html += "" + GUIUtil::HtmlEscape(uri) + "
"; - html += "" + tr("Address") + ": " + - GUIUtil::HtmlEscape(info.address) + "
"; + html += "" + tr("Address") + + ": " + GUIUtil::HtmlEscape(info.address) + "
"; if (info.amount != Amount(0)) - html += "" + tr("Amount") + ": " + - BitcoinUnits::formatHtmlWithUnit(model->getDisplayUnit(), - info.amount) + + html += "" + tr("Amount") + + ": " + BitcoinUnits::formatHtmlWithUnit( + model->getDisplayUnit(), info.amount) + "
"; if (!info.label.isEmpty()) - html += "" + tr("Label") + ": " + - GUIUtil::HtmlEscape(info.label) + "
"; + html += "" + tr("Label") + + ": " + GUIUtil::HtmlEscape(info.label) + "
"; if (!info.message.isEmpty()) - html += "" + tr("Message") + ": " + - GUIUtil::HtmlEscape(info.message) + "
"; + html += "" + tr("Message") + + ": " + GUIUtil::HtmlEscape(info.message) + "
"; ui->outUri->setText(html); #ifdef USE_QRCODE diff --git a/src/qt/rpcconsole.cpp b/src/qt/rpcconsole.cpp --- a/src/qt/rpcconsole.cpp +++ b/src/qt/rpcconsole.cpp @@ -71,10 +71,10 @@ << "walletpassphrase" << "walletpassphrasechange" << "encryptwallet"; -} +} // namespace /* Object for executing console RPC commands in a separate thread. -*/ + */ class RPCExecutor : public QObject { Q_OBJECT diff --git a/src/qt/test/guiutiltests.cpp b/src/qt/test/guiutiltests.cpp --- a/src/qt/test/guiutiltests.cpp +++ b/src/qt/test/guiutiltests.cpp @@ -24,7 +24,7 @@ bool useCashAddr; }; -} // anon ns +} // namespace void GUIUtilTests::dummyAddressTest() { CChainParams ¶ms = Params(CBaseChainParams::MAIN); diff --git a/src/qt/test/rpcnestedtests.cpp b/src/qt/test/rpcnestedtests.cpp --- a/src/qt/test/rpcnestedtests.cpp +++ b/src/qt/test/rpcnestedtests.cpp @@ -6,7 +6,6 @@ #include "chainparams.h" #include "config.h" -#include "config.h" #include "consensus/validation.h" #include "fs.h" #include "rpc/register.h" diff --git a/src/qt/test/uritests.cpp b/src/qt/test/uritests.cpp --- a/src/qt/test/uritests.cpp +++ b/src/qt/test/uritests.cpp @@ -184,7 +184,7 @@ std::string net; }; -} // anon ns +} // namespace void URITests::uriTestFormatURI() { { diff --git a/src/qt/transactiondesc.cpp b/src/qt/transactiondesc.cpp --- a/src/qt/transactiondesc.cpp +++ b/src/qt/transactiondesc.cpp @@ -357,11 +357,11 @@ } strHTML = strHTML + " " + tr("Amount") + "=" + BitcoinUnits::formatHtmlWithUnit(unit, vout.nValue); - strHTML = - strHTML + " IsMine=" + - (wallet->IsMine(vout) & ISMINE_SPENDABLE ? tr("true") - : tr("false")) + - ""; + strHTML = strHTML + + " IsMine=" + (wallet->IsMine(vout) & ISMINE_SPENDABLE + ? tr("true") + : tr("false")) + + ""; strHTML = strHTML + " IsWatchOnly=" + (wallet->IsMine(vout) & ISMINE_WATCH_ONLY ? tr("true") diff --git a/src/qt/transactionrecord.h b/src/qt/transactionrecord.h --- a/src/qt/transactionrecord.h +++ b/src/qt/transactionrecord.h @@ -26,7 +26,7 @@ enum Status { /**< Have 6 or more confirmations (normal tx) or fully mature (mined tx) - **/ + **/ Confirmed, /// Normal (sent/received) transactions /**< Transaction not yet final, waiting for date */ @@ -38,7 +38,7 @@ /**< Not yet mined into a block **/ Unconfirmed, /**< Confirmed, but waiting for the recommended number of confirmations - **/ + **/ Confirming, /**< Conflicts with other transaction or mempool **/ Conflicted, @@ -48,7 +48,7 @@ /**< Mined but waiting for maturity */ Immature, /**< Transaction will likely not mature because no nodes have confirmed - */ + */ MaturesWarning, /**< Mined but not accepted */ NotAccepted diff --git a/src/qt/transactiontablemodel.cpp b/src/qt/transactiontablemodel.cpp --- a/src/qt/transactiontablemodel.cpp +++ b/src/qt/transactiontablemodel.cpp @@ -108,11 +108,11 @@ if (!showTransaction && inModel) status = CT_DELETED; } - qDebug() << " inModel=" + QString::number(inModel) + " Index=" + - QString::number(lowerIndex) + "-" + - QString::number(upperIndex) + " showTransaction=" + - QString::number(showTransaction) + " derivedStatus=" + - QString::number(status); + qDebug() << " inModel=" + QString::number(inModel) + + " Index=" + QString::number(lowerIndex) + "-" + + QString::number(upperIndex) + + " showTransaction=" + QString::number(showTransaction) + + " derivedStatus=" + QString::number(status); switch (status) { case CT_NEW: @@ -713,8 +713,8 @@ void invoke(QObject *ttm) { QString strHash = QString::fromStdString(hash.GetHex()); - qDebug() << "NotifyTransactionChanged: " + strHash + " status= " + - QString::number(status); + qDebug() << "NotifyTransactionChanged: " + strHash + + " status= " + QString::number(status); QMetaObject::invokeMethod(ttm, "updateTransaction", Qt::QueuedConnection, Q_ARG(QString, strHash), Q_ARG(int, status), diff --git a/src/qt/transactionview.cpp b/src/qt/transactionview.cpp --- a/src/qt/transactionview.cpp +++ b/src/qt/transactionview.cpp @@ -507,9 +507,10 @@ transactionView->selectionModel()->selectedRows(0); if (!selection.isEmpty()) QDesktopServices::openUrl(QUrl::fromUserInput( - url.replace("%s", selection.at(0) - .data(TransactionTableModel::TxHashRole) - .toString()))); + url.replace("%s", + selection.at(0) + .data(TransactionTableModel::TxHashRole) + .toString()))); } QWidget *TransactionView::createDateRangeWidget() { diff --git a/src/qt/walletmodel.cpp b/src/qt/walletmodel.cpp --- a/src/qt/walletmodel.cpp +++ b/src/qt/walletmodel.cpp @@ -437,8 +437,9 @@ QString strPurpose = QString::fromStdString(purpose); qDebug() << "NotifyAddressBookChanged: " + strAddress + " " + strLabel + - " isMine=" + QString::number(isMine) + " purpose=" + - strPurpose + " status=" + QString::number(status); + " isMine=" + QString::number(isMine) + + " purpose=" + strPurpose + + " status=" + QString::number(status); QMetaObject::invokeMethod(walletmodel, "updateAddressBook", Qt::QueuedConnection, Q_ARG(QString, strAddress), Q_ARG(QString, strLabel), Q_ARG(bool, isMine), diff --git a/src/rpc/misc.cpp b/src/rpc/misc.cpp --- a/src/rpc/misc.cpp +++ b/src/rpc/misc.cpp @@ -103,13 +103,14 @@ obj.push_back(Pair("blocks", (int)chainActive.Height())); obj.push_back(Pair("timeoffset", GetTimeOffset())); if (g_connman) - obj.push_back(Pair("connections", (int)g_connman->GetNodeCount( - CConnman::CONNECTIONS_ALL))); + obj.push_back( + Pair("connections", + (int)g_connman->GetNodeCount(CConnman::CONNECTIONS_ALL))); obj.push_back(Pair("proxy", (proxy.IsValid() ? proxy.proxy.ToStringIPPort() : std::string()))); obj.push_back(Pair("difficulty", double(GetDifficulty(chainActive.Tip())))); - obj.push_back(Pair("testnet", Params().NetworkIDString() == - CBaseChainParams::TESTNET)); + obj.push_back(Pair( + "testnet", Params().NetworkIDString() == CBaseChainParams::TESTNET)); #ifdef ENABLE_WALLET if (pwalletMain) { obj.push_back( diff --git a/src/rpc/net.cpp b/src/rpc/net.cpp --- a/src/rpc/net.cpp +++ b/src/rpc/net.cpp @@ -469,9 +469,9 @@ obj.push_back(Pair("name", GetNetworkName(network))); obj.push_back(Pair("limited", IsLimited(network))); obj.push_back(Pair("reachable", IsReachable(network))); - obj.push_back(Pair("proxy", proxy.IsValid() - ? proxy.proxy.ToStringIPPort() - : std::string())); + obj.push_back(Pair("proxy", + proxy.IsValid() ? proxy.proxy.ToStringIPPort() + : std::string())); obj.push_back( Pair("proxy_randomize_credentials", proxy.randomize_credentials)); networks.push_back(obj); @@ -558,8 +558,9 @@ obj.push_back(Pair("timeoffset", GetTimeOffset())); if (g_connman) { obj.push_back(Pair("networkactive", g_connman->GetNetworkActive())); - obj.push_back(Pair("connections", (int)g_connman->GetNodeCount( - CConnman::CONNECTIONS_ALL))); + obj.push_back( + Pair("connections", + (int)g_connman->GetNodeCount(CConnman::CONNECTIONS_ALL))); } obj.push_back(Pair("networks", GetNetworksInfo())); obj.push_back( diff --git a/src/rpc/rawtransaction.cpp b/src/rpc/rawtransaction.cpp --- a/src/rpc/rawtransaction.cpp +++ b/src/rpc/rawtransaction.cpp @@ -113,8 +113,9 @@ if (mi != mapBlockIndex.end() && (*mi).second) { CBlockIndex *pindex = (*mi).second; if (chainActive.Contains(pindex)) { - entry.push_back(Pair("confirmations", 1 + chainActive.Height() - - pindex->nHeight)); + entry.push_back( + Pair("confirmations", + 1 + chainActive.Height() - pindex->nHeight)); entry.push_back(Pair("time", pindex->GetBlockTime())); entry.push_back(Pair("blocktime", pindex->GetBlockTime())); } else { @@ -955,12 +956,13 @@ // signed: if (fGivenKeys && scriptPubKey.IsPayToScriptHash()) { RPCTypeCheckObj( - prevOut, { - {"txid", UniValueType(UniValue::VSTR)}, - {"vout", UniValueType(UniValue::VNUM)}, - {"scriptPubKey", UniValueType(UniValue::VSTR)}, - {"redeemScript", UniValueType(UniValue::VSTR)}, - }); + prevOut, + { + {"txid", UniValueType(UniValue::VSTR)}, + {"vout", UniValueType(UniValue::VNUM)}, + {"scriptPubKey", UniValueType(UniValue::VSTR)}, + {"redeemScript", UniValueType(UniValue::VSTR)}, + }); UniValue v = find_value(prevOut, "redeemScript"); if (!v.isNull()) { std::vector rsData(ParseHexV(v, "redeemScript")); diff --git a/src/rpc/server.h b/src/rpc/server.h --- a/src/rpc/server.h +++ b/src/rpc/server.h @@ -166,8 +166,8 @@ const_rpcfn_type _actor, bool _okSafeMode, std::vector _argNames) : category{std::move(_category)}, name{std::move(_name)}, - actor{reinterpret_cast(_actor)}, okSafeMode{_okSafeMode}, - argNames{std::move(_argNames)} {} + actor{reinterpret_cast(_actor)}, + okSafeMode{_okSafeMode}, argNames{std::move(_argNames)} {} }; /** diff --git a/src/scheduler.cpp b/src/scheduler.cpp --- a/src/scheduler.cpp +++ b/src/scheduler.cpp @@ -112,8 +112,9 @@ } void CScheduler::scheduleFromNow(CScheduler::Function f, int64_t deltaSeconds) { - schedule(f, boost::chrono::system_clock::now() + - boost::chrono::seconds(deltaSeconds)); + schedule(f, + boost::chrono::system_clock::now() + + boost::chrono::seconds(deltaSeconds)); } static void Repeat(CScheduler *s, CScheduler::Function f, diff --git a/src/script/bitcoinconsensus.cpp b/src/script/bitcoinconsensus.cpp --- a/src/script/bitcoinconsensus.cpp +++ b/src/script/bitcoinconsensus.cpp @@ -64,7 +64,7 @@ }; ECCryptoClosure instance_of_eccryptoclosure; -} +} // namespace /** Check that all specified flags are part of the libconsensus interface. */ static bool verify_flags(unsigned int flags) { diff --git a/src/script/script.cpp b/src/script/script.cpp --- a/src/script/script.cpp +++ b/src/script/script.cpp @@ -253,9 +253,9 @@ // Note: // The template matching params OP_SMALLINTEGER/etc are defined in - // opcodetype enum as kind of implementation hack, they are *NOT* real - // opcodes. If found in real Script, just let the default: case deal - // with them. + // opcodetype enum as kind of implementation hack, they are *NOT* + // real opcodes. If found in real Script, just let the default: + // case deal with them. default: return "OP_UNKNOWN"; diff --git a/src/script/sigcache.cpp b/src/script/sigcache.cpp --- a/src/script/sigcache.cpp +++ b/src/script/sigcache.cpp @@ -63,7 +63,7 @@ * signatureCache could be made local to VerifySignature. */ static CSignatureCache signatureCache; -} +} // namespace // To be called once in AppInit2/TestingSetup to initialize the signatureCache void InitSignatureCache() { diff --git a/src/script/standard.cpp b/src/script/standard.cpp --- a/src/script/standard.cpp +++ b/src/script/standard.cpp @@ -51,14 +51,16 @@ // Bitcoin address tx, sender provides hash of pubkey, receiver provides // signature and pubkey - mTemplates.insert(std::make_pair( - TX_PUBKEYHASH, CScript() << OP_DUP << OP_HASH160 << OP_PUBKEYHASH + mTemplates.insert( + std::make_pair(TX_PUBKEYHASH, + CScript() << OP_DUP << OP_HASH160 << OP_PUBKEYHASH << OP_EQUALVERIFY << OP_CHECKSIG)); // Sender provides N pubkeys, receivers provides M signatures - mTemplates.insert(std::make_pair( - TX_MULTISIG, CScript() << OP_SMALLINTEGER << OP_PUBKEYS - << OP_SMALLINTEGER << OP_CHECKMULTISIG)); + mTemplates.insert( + std::make_pair(TX_MULTISIG, + CScript() << OP_SMALLINTEGER << OP_PUBKEYS + << OP_SMALLINTEGER << OP_CHECKMULTISIG)); } vSolutionsRet.clear(); @@ -232,7 +234,7 @@ return true; } }; -} +} // namespace CScript GetScriptForDestination(const CTxDestination &dest) { CScript script; diff --git a/src/seeder/bitcoin.cpp b/src/seeder/bitcoin.cpp --- a/src/seeder/bitcoin.cpp +++ b/src/seeder/bitcoin.cpp @@ -263,9 +263,9 @@ bool res = true; int64_t now; - while (now = time(nullptr), ban == 0 && - (doneAfter == 0 || doneAfter > now) && - sock != INVALID_SOCKET) { + while (now = time(nullptr), + ban == 0 && (doneAfter == 0 || doneAfter > now) && + sock != INVALID_SOCKET) { char pchBuf[0x10000]; fd_set set; FD_ZERO(&set); diff --git a/src/seeder/main.cpp b/src/seeder/main.cpp --- a/src/seeder/main.cpp +++ b/src/seeder/main.cpp @@ -79,8 +79,9 @@ {"help", no_argument, 0, 'h'}, {0, 0, 0, 0}}; int option_index = 0; - int c = getopt_long(argc, argv, "h:n:m:t:p:d:o:i:k:w:", - long_options, &option_index); + int c = + getopt_long(argc, argv, "h:n:m:t:p:d:o:i:k:w:", long_options, + &option_index); if (c == -1) break; switch (c) { case 'h': { diff --git a/src/test/cashaddrenc_tests.cpp b/src/test/cashaddrenc_tests.cpp --- a/src/test/cashaddrenc_tests.cpp +++ b/src/test/cashaddrenc_tests.cpp @@ -66,7 +66,7 @@ const std::array, 8> valid_sizes = { {{0, 20}, {1, 24}, {2, 28}, {3, 32}, {4, 40}, {5, 48}, {6, 56}, {7, 64}}}; -} // anon ns +} // namespace BOOST_FIXTURE_TEST_SUITE(cashaddrenc_tests, BasicTestingSetup) diff --git a/src/test/config_tests.cpp b/src/test/config_tests.cpp --- a/src/test/config_tests.cpp +++ b/src/test/config_tests.cpp @@ -2,8 +2,8 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#include "config.h" #include "chainparams.h" +#include "config.h" #include "consensus/consensus.h" #include "test/test_bitcoin.h" diff --git a/src/test/crypto_tests.cpp b/src/test/crypto_tests.cpp --- a/src/test/crypto_tests.cpp +++ b/src/test/crypto_tests.cpp @@ -159,9 +159,9 @@ _size = dec.Decrypt(&subout[0], subout.size(), &subdecrypted[0]); subdecrypted.resize(_size); BOOST_CHECK(decrypted.size() == in.size()); - BOOST_CHECK_MESSAGE(subdecrypted == sub, HexStr(subdecrypted) + - std::string(" != ") + - HexStr(sub)); + BOOST_CHECK_MESSAGE(subdecrypted == sub, + HexStr(subdecrypted) + std::string(" != ") + + HexStr(sub)); } } } @@ -204,9 +204,9 @@ _size = dec.Decrypt(&subout[0], subout.size(), &subdecrypted[0]); subdecrypted.resize(_size); BOOST_CHECK(decrypted.size() == in.size()); - BOOST_CHECK_MESSAGE(subdecrypted == sub, HexStr(subdecrypted) + - std::string(" != ") + - HexStr(sub)); + BOOST_CHECK_MESSAGE(subdecrypted == sub, + HexStr(subdecrypted) + std::string(" != ") + + HexStr(sub)); } } } diff --git a/src/test/dstencode_tests.cpp b/src/test/dstencode_tests.cpp --- a/src/test/dstencode_tests.cpp +++ b/src/test/dstencode_tests.cpp @@ -21,7 +21,7 @@ bool useCashAddr; }; -} // anon ns +} // namespace BOOST_FIXTURE_TEST_SUITE(dstencode_tests, BasicTestingSetup) diff --git a/src/test/hash_tests.cpp b/src/test/hash_tests.cpp --- a/src/test/hash_tests.cpp +++ b/src/test/hash_tests.cpp @@ -177,7 +177,7 @@ ::Unserialize(s, VARINT(value)); } }; -} +} // namespace BOOST_AUTO_TEST_CASE(hashverifier_tests) { std::vector data = ParseHex("4223"); diff --git a/src/test/mempool_tests.cpp b/src/test/mempool_tests.cpp --- a/src/test/mempool_tests.cpp +++ b/src/test/mempool_tests.cpp @@ -535,8 +535,8 @@ BOOST_CHECK(!pool.exists(tx2.GetId())); BOOST_CHECK(!pool.exists(tx3.GetId())); - CFeeRate maxFeeRateRemoved(Amount(25000), GetTransactionSize(tx3) + - GetTransactionSize(tx2)); + CFeeRate maxFeeRateRemoved( + Amount(25000), GetTransactionSize(tx3) + GetTransactionSize(tx2)); BOOST_CHECK_EQUAL(pool.GetMinFee(1).GetFeePerK(), maxFeeRateRemoved.GetFeePerK() + Amount(1000)); diff --git a/src/test/miner_tests.cpp b/src/test/miner_tests.cpp --- a/src/test/miner_tests.cpp +++ b/src/test/miner_tests.cpp @@ -101,29 +101,32 @@ // This tx has a low fee: 1000 satoshis. // Save this txid for later use. uint256 hashParentTx = tx.GetId(); - mempool.addUnchecked(hashParentTx, entry.Fee(Amount(1000)) - .Time(GetTime()) - .SpendsCoinbase(true) - .FromTx(tx)); + mempool.addUnchecked(hashParentTx, + entry.Fee(Amount(1000)) + .Time(GetTime()) + .SpendsCoinbase(true) + .FromTx(tx)); // This tx has a medium fee: 10000 satoshis. tx.vin[0].prevout.hash = txFirst[1]->GetId(); tx.vout[0].nValue = Amount(5000000000LL - 10000); uint256 hashMediumFeeTx = tx.GetId(); - mempool.addUnchecked(hashMediumFeeTx, entry.Fee(Amount(10000)) - .Time(GetTime()) - .SpendsCoinbase(true) - .FromTx(tx)); + mempool.addUnchecked(hashMediumFeeTx, + entry.Fee(Amount(10000)) + .Time(GetTime()) + .SpendsCoinbase(true) + .FromTx(tx)); // This tx has a high fee, but depends on the first transaction. tx.vin[0].prevout.hash = hashParentTx; // 50k satoshi fee. tx.vout[0].nValue = Amount(5000000000LL - 1000 - 50000); uint256 hashHighFeeTx = tx.GetId(); - mempool.addUnchecked(hashHighFeeTx, entry.Fee(Amount(50000)) - .Time(GetTime()) - .SpendsCoinbase(false) - .FromTx(tx)); + mempool.addUnchecked(hashHighFeeTx, + entry.Fee(Amount(50000)) + .Time(GetTime()) + .SpendsCoinbase(false) + .FromTx(tx)); std::unique_ptr pblocktemplate = BlockAssembler(config, chainparams).CreateNewBlock(scriptPubKey); @@ -328,10 +331,11 @@ bool spendsCoinbase = (i == 0) ? true : false; // If we don't set the # of sig ops in the CTxMemPoolEntry, template // creation fails. - mempool.addUnchecked(hash, entry.Fee(LOWFEE) - .Time(GetTime()) - .SpendsCoinbase(spendsCoinbase) - .FromTx(tx)); + mempool.addUnchecked(hash, + entry.Fee(LOWFEE) + .Time(GetTime()) + .SpendsCoinbase(spendsCoinbase) + .FromTx(tx)); tx.vin[0].prevout.hash = hash; } BOOST_CHECK_THROW( @@ -348,11 +352,12 @@ bool spendsCoinbase = (i == 0) ? true : false; // If we do set the # of sig ops in the CTxMemPoolEntry, template // creation passes. - mempool.addUnchecked(hash, entry.Fee(LOWFEE) - .Time(GetTime()) - .SpendsCoinbase(spendsCoinbase) - .SigOpsCost(80) - .FromTx(tx)); + mempool.addUnchecked(hash, + entry.Fee(LOWFEE) + .Time(GetTime()) + .SpendsCoinbase(spendsCoinbase) + .SigOpsCost(80) + .FromTx(tx)); tx.vin[0].prevout.hash = hash; } BOOST_CHECK( @@ -374,10 +379,11 @@ hash = tx.GetId(); // Only first tx spends coinbase. bool spendsCoinbase = (i == 0) ? true : false; - mempool.addUnchecked(hash, entry.Fee(LOWFEE) - .Time(GetTime()) - .SpendsCoinbase(spendsCoinbase) - .FromTx(tx)); + mempool.addUnchecked(hash, + entry.Fee(LOWFEE) + .Time(GetTime()) + .SpendsCoinbase(spendsCoinbase) + .FromTx(tx)); tx.vin[0].prevout.hash = hash; } BOOST_CHECK( diff --git a/src/test/net_tests.cpp b/src/test/net_tests.cpp --- a/src/test/net_tests.cpp +++ b/src/test/net_tests.cpp @@ -1,11 +1,11 @@ // Copyright (c) 2012-2016 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#include "net.h" #include "addrman.h" #include "chainparams.h" #include "config.h" #include "hash.h" +#include "net.h" #include "netbase.h" #include "serialize.h" #include "streams.h" diff --git a/src/test/policyestimator_tests.cpp b/src/test/policyestimator_tests.cpp --- a/src/test/policyestimator_tests.cpp +++ b/src/test/policyestimator_tests.cpp @@ -2,8 +2,8 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#include "policy/policy.h" #include "policy/fees.h" +#include "policy/policy.h" #include "txmempool.h" #include "uint256.h" #include "util.h" @@ -57,11 +57,12 @@ // make transaction unique tx.vin[0].prevout.n = 10000 * blocknum + 100 * j + k; uint256 hash = tx.GetId(); - mpool.addUnchecked(hash, entry.Fee(feeV[j]) - .Time(GetTime()) - .Priority(0) - .Height(blocknum) - .FromTx(tx, &mpool)); + mpool.addUnchecked(hash, + entry.Fee(feeV[j]) + .Time(GetTime()) + .Priority(0) + .Height(blocknum) + .FromTx(tx, &mpool)); txHashes[j].push_back(hash); } } @@ -153,11 +154,12 @@ for (int k = 0; k < 4; k++) { tx.vin[0].prevout.n = 10000 * blocknum + 100 * j + k; uint256 txid = tx.GetId(); - mpool.addUnchecked(txid, entry.Fee(feeV[j]) - .Time(GetTime()) - .Priority(0) - .Height(blocknum) - .FromTx(tx, &mpool)); + mpool.addUnchecked(txid, + entry.Fee(feeV[j]) + .Time(GetTime()) + .Priority(0) + .Height(blocknum) + .FromTx(tx, &mpool)); txHashes[j].push_back(txid); } } @@ -200,11 +202,12 @@ for (int k = 0; k < 4; k++) { tx.vin[0].prevout.n = 10000 * blocknum + 100 * j + k; uint256 txid = tx.GetId(); - mpool.addUnchecked(txid, entry.Fee(feeV[j]) - .Time(GetTime()) - .Priority(0) - .Height(blocknum) - .FromTx(tx, &mpool)); + mpool.addUnchecked(txid, + entry.Fee(feeV[j]) + .Time(GetTime()) + .Priority(0) + .Height(blocknum) + .FromTx(tx, &mpool)); CTransactionRef ptx = mpool.get(txid); if (ptx) block.push_back(ptx); } diff --git a/src/test/pow_tests.cpp b/src/test/pow_tests.cpp --- a/src/test/pow_tests.cpp +++ b/src/test/pow_tests.cpp @@ -2,10 +2,10 @@ // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#include "pow.h" #include "chain.h" #include "chainparams.h" #include "config.h" +#include "pow.h" #include "random.h" #include "test/test_bitcoin.h" #include "util.h" diff --git a/src/test/scheduler_tests.cpp b/src/test/scheduler_tests.cpp --- a/src/test/scheduler_tests.cpp +++ b/src/test/scheduler_tests.cpp @@ -2,8 +2,8 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#include "scheduler.h" #include "random.h" +#include "scheduler.h" #include "test/test_bitcoin.h" diff --git a/src/test/script_P2SH_tests.cpp b/src/test/script_P2SH_tests.cpp --- a/src/test/script_P2SH_tests.cpp +++ b/src/test/script_P2SH_tests.cpp @@ -2,12 +2,12 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#include "script/script.h" #include "core_io.h" #include "key.h" #include "keystore.h" #include "policy/policy.h" #include "script/ismine.h" +#include "script/script.h" #include "script/script_error.h" #include "script/sign.h" #include "test/test_bitcoin.h" diff --git a/src/test/script_tests.cpp b/src/test/script_tests.cpp --- a/src/test/script_tests.cpp +++ b/src/test/script_tests.cpp @@ -272,9 +272,9 @@ CScript scriptPubKey = script; if (P2SH) { redeemscript = scriptPubKey; - scriptPubKey = CScript() << OP_HASH160 - << ToByteVector(CScriptID(redeemscript)) - << OP_EQUAL; + scriptPubKey = CScript() + << OP_HASH160 + << ToByteVector(CScriptID(redeemscript)) << OP_EQUAL; } creditTx = MakeTransactionRef(BuildCreditingTransaction(scriptPubKey, nValue)); @@ -581,8 +581,8 @@ .DamagePush(10) .ScriptError(SCRIPT_ERR_SIG_DER)); tests.push_back( - TestBuilder(CScript() << ToByteVector(keys.pubkey2C) << OP_CHECKSIG - << OP_NOT, + TestBuilder(CScript() + << ToByteVector(keys.pubkey2C) << OP_CHECKSIG << OP_NOT, "P2PK NOT with too much R padding but no DERSIG", 0) .PushSig(keys.key2, SIGHASH_ALL, 31, 32) .EditPush(1, "43021F", "44022000") @@ -813,8 +813,8 @@ .PushSig(keys.key0, SIGHASH_ALL) .ScriptError(SCRIPT_ERR_PUBKEYTYPE)); tests.push_back( - TestBuilder(CScript() << ToByteVector(keys.pubkey0H) << OP_CHECKSIG - << OP_NOT, + TestBuilder(CScript() + << ToByteVector(keys.pubkey0H) << OP_CHECKSIG << OP_NOT, "P2PK NOT with invalid hybrid pubkey but no STRICTENC", 0) .PushSig(keys.key0, SIGHASH_ALL) .DamagePush(10)); @@ -866,8 +866,8 @@ .PushSig(keys.key1, 5) .DamagePush(10)); tests.push_back( - TestBuilder(CScript() << ToByteVector(keys.pubkey1) << OP_CHECKSIG - << OP_NOT, + TestBuilder(CScript() + << ToByteVector(keys.pubkey1) << OP_CHECKSIG << OP_NOT, "P2PK NOT with invalid sig and undefined hashtype", SCRIPT_VERIFY_STRICTENC) .PushSig(keys.key1, 5) @@ -1056,8 +1056,8 @@ std::string str = JSONPrettyPrint(test.GetJSON()); #ifndef UPDATE_JSON_TESTS if (tests_set.count(str) == 0) { - BOOST_CHECK_MESSAGE(false, "Missing auto script_valid test: " + - test.GetComment()); + BOOST_CHECK_MESSAGE( + false, "Missing auto script_valid test: " + test.GetComment()); } #endif strGen += str + ",\n"; diff --git a/src/test/serialize_tests.cpp b/src/test/serialize_tests.cpp --- a/src/test/serialize_tests.cpp +++ b/src/test/serialize_tests.cpp @@ -2,8 +2,8 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#include "serialize.h" #include "hash.h" +#include "serialize.h" #include "streams.h" #include "test/test_bitcoin.h" diff --git a/src/test/sigopcount_tests.cpp b/src/test/sigopcount_tests.cpp --- a/src/test/sigopcount_tests.cpp +++ b/src/test/sigopcount_tests.cpp @@ -155,8 +155,8 @@ << ToByteVector(pubkey) << 2 << OP_CHECKMULTISIGVERIFY; CScript scriptPubKey = GetScriptForDestination(CScriptID(redeemScript)); - CScript scriptSig = CScript() << OP_0 << OP_0 - << ToByteVector(redeemScript); + CScript scriptSig = CScript() + << OP_0 << OP_0 << ToByteVector(redeemScript); BuildTxs(spendingTx, coins, creationTx, scriptPubKey, scriptSig); assert(GetTransactionSigOpCount(CTransaction(spendingTx), coins, diff --git a/src/test/timedata_tests.cpp b/src/test/timedata_tests.cpp --- a/src/test/timedata_tests.cpp +++ b/src/test/timedata_tests.cpp @@ -2,8 +2,8 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. // -#include "timedata.h" #include "test/test_bitcoin.h" +#include "timedata.h" #include diff --git a/src/test/transaction_tests.cpp b/src/test/transaction_tests.cpp --- a/src/test/transaction_tests.cpp +++ b/src/test/transaction_tests.cpp @@ -587,8 +587,8 @@ // Data payload can be encoded in any way... t.vout[0].scriptPubKey = CScript() << OP_RETURN << ParseHex(""); BOOST_CHECK(IsStandardTx(t, reason)); - t.vout[0].scriptPubKey = CScript() << OP_RETURN << ParseHex("00") - << ParseHex("01"); + t.vout[0].scriptPubKey = CScript() + << OP_RETURN << ParseHex("00") << ParseHex("01"); BOOST_CHECK(IsStandardTx(t, reason)); // OP_RESERVED *is* considered to be a PUSHDATA type opcode by IsPushOnly()! t.vout[0].scriptPubKey = CScript() << OP_RETURN << OP_RESERVED << -1 << 0 diff --git a/src/test/uint256_tests.cpp b/src/test/uint256_tests.cpp --- a/src/test/uint256_tests.cpp +++ b/src/test/uint256_tests.cpp @@ -1,9 +1,9 @@ // Copyright (c) 2011-2016 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#include "uint256.h" #include "arith_uint256.h" #include "test/test_bitcoin.h" +#include "uint256.h" #include "version.h" #include diff --git a/src/test/undo_tests.cpp b/src/test/undo_tests.cpp --- a/src/test/undo_tests.cpp +++ b/src/test/undo_tests.cpp @@ -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 "undo.h" #include "chainparams.h" #include "consensus/validation.h" +#include "undo.h" #include "validation.h" #include "test/test_bitcoin.h" diff --git a/src/test/validation_tests.cpp b/src/test/validation_tests.cpp --- a/src/test/validation_tests.cpp +++ b/src/test/validation_tests.cpp @@ -3,13 +3,13 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#include "validation.h" #include "chainparams.h" #include "config.h" #include "consensus/consensus.h" #include "primitives/transaction.h" #include "test/test_bitcoin.h" #include "util.h" +#include "validation.h" #include #include diff --git a/src/tinyformat.h b/src/tinyformat.h --- a/src/tinyformat.h +++ b/src/tinyformat.h @@ -906,8 +906,8 @@ #ifdef TINYFORMAT_USE_VARIADIC_TEMPLATES template FormatListN(const Args &... args) - : FormatList(&m_formatterStore[0], N), - m_formatterStore{FormatArg(args)...} { + : FormatList(&m_formatterStore[0], N), m_formatterStore{ + FormatArg(args)...} { static_assert(sizeof...(args) == N, "Number of args must be N"); } #else // C++98 version diff --git a/src/txdb.cpp b/src/txdb.cpp --- a/src/txdb.cpp +++ b/src/txdb.cpp @@ -46,7 +46,7 @@ s >> VARINT(outpoint->n); } }; -} +} // namespace CCoinsViewDB::CCoinsViewDB(size_t nCacheSize, bool fMemory, bool fWipe) : db(GetDataDir() / "chainstate", nCacheSize, fMemory, fWipe, true) {} @@ -320,7 +320,7 @@ ::Unserialize(s, VARINT(nHeight)); } }; -} +} // namespace /** * Upgrade the database from older formats. diff --git a/src/txmempool.h b/src/txmempool.h --- a/src/txmempool.h +++ b/src/txmempool.h @@ -781,8 +781,9 @@ * transaction that is removed, so we can't remove intermediate transactions * in a chain before we've updated all the state for the removal. */ - void removeUnchecked(txiter entry, MemPoolRemovalReason reason = - MemPoolRemovalReason::UNKNOWN); + void removeUnchecked( + txiter entry, + MemPoolRemovalReason reason = MemPoolRemovalReason::UNKNOWN); }; /** diff --git a/src/validation.cpp b/src/validation.cpp --- a/src/validation.cpp +++ b/src/validation.cpp @@ -2326,8 +2326,8 @@ nLastSetChain = nNow; } } catch (const std::runtime_error &e) { - return AbortNode(state, std::string("System error while flushing: ") + - e.what()); + return AbortNode( + state, std::string("System error while flushing: ") + e.what()); } return true; } @@ -4269,10 +4269,11 @@ boost::this_thread::interruption_point(); uiInterface.ShowProgress( _("Verifying blocks..."), - std::max( - 1, std::min(99, 100 - (int)(((double)(chainActive.Height() - - pindex->nHeight)) / - (double)nCheckDepth * 50)))); + std::max(1, + std::min(99, + 100 - (int)(((double)(chainActive.Height() - + pindex->nHeight)) / + (double)nCheckDepth * 50)))); pindex = chainActive.Next(pindex); CBlock block; if (!ReadBlockFromDisk(block, pindex, config)) { diff --git a/src/versionbits.cpp b/src/versionbits.cpp --- a/src/versionbits.cpp +++ b/src/versionbits.cpp @@ -182,7 +182,7 @@ return ((uint32_t)1) << params.vDeployments[id].bit; } }; -} +} // namespace ThresholdState VersionBitsState(const CBlockIndex *pindexPrev, const Consensus::Params ¶ms, diff --git a/src/wallet/rpcdump.cpp b/src/wallet/rpcdump.cpp --- a/src/wallet/rpcdump.cpp +++ b/src/wallet/rpcdump.cpp @@ -582,8 +582,9 @@ } CKey vchSecret; if (!pwalletMain->GetKey(*keyID, vchSecret)) { - throw JSONRPCError(RPC_WALLET_ERROR, "Private key for address " + - strAddress + " is not known"); + throw JSONRPCError(RPC_WALLET_ERROR, + "Private key for address " + strAddress + + " is not known"); } return CBitcoinSecret(vchSecret).ToString(); } diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -2729,10 +2729,11 @@ } const UniValue &o = output.get_obj(); - RPCTypeCheckObj(o, { - {"txid", UniValueType(UniValue::VSTR)}, - {"vout", UniValueType(UniValue::VNUM)}, - }); + RPCTypeCheckObj(o, + { + {"txid", UniValueType(UniValue::VSTR)}, + {"vout", UniValueType(UniValue::VNUM)}, + }); std::string txid = find_value(o, "txid").get_str(); if (!IsHex(txid)) { diff --git a/src/wallet/test/crypto_tests.cpp b/src/wallet/test/crypto_tests.cpp --- a/src/wallet/test/crypto_tests.cpp +++ b/src/wallet/test/crypto_tests.cpp @@ -178,8 +178,8 @@ BOOST_CHECK_MESSAGE( vchDecrypted1 == vchDecrypted2, - HexStr(vchDecrypted1.begin(), vchDecrypted1.end()) + " != " + - HexStr(vchDecrypted2.begin(), vchDecrypted2.end())); + HexStr(vchDecrypted1.begin(), vchDecrypted1.end()) + + " != " + HexStr(vchDecrypted2.begin(), vchDecrypted2.end())); if (vchPlaintext.size()) BOOST_CHECK(CKeyingMaterial(vchPlaintext.begin(), diff --git a/src/wallet/test/walletdb_tests.cpp b/src/wallet/test/walletdb_tests.cpp --- a/src/wallet/test/walletdb_tests.cpp +++ b/src/wallet/test/walletdb_tests.cpp @@ -38,7 +38,7 @@ BOOST_CHECK(res == DB_LOAD_OK); return wallet; } -} +} // namespace BOOST_FIXTURE_TEST_SUITE(walletdb_tests, WalletDBTestingSetup); diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -164,8 +164,8 @@ // childIndex | BIP32_HARDENED_KEY_LIMIT = derive childIndex in hardened // child-index-range // example: 1 | BIP32_HARDENED_KEY_LIMIT == 0x80000001 == 2147483649 - externalChainChildKey.Derive(childKey, hdChain.nExternalChainCounter | - BIP32_HARDENED_KEY_LIMIT); + externalChainChildKey.Derive( + childKey, hdChain.nExternalChainCounter | BIP32_HARDENED_KEY_LIMIT); metadata.hdKeypath = "m/0'/0'/" + std::to_string(hdChain.nExternalChainCounter) + "'"; metadata.hdMasterKeyID = hdChain.masterKeyID;