From ade5bb46e5d29a11c72cf2800da99bed62061e8a Mon Sep 17 00:00:00 2001 From: Michel van Kessel Date: Mon, 21 Dec 2020 00:01:41 +0100 Subject: [PATCH] update some main files --- src/addrdb.cpp | 18 +++++++-------- src/addrdb.h | 2 +- src/addrman.cpp | 12 +++++----- src/addrman.h | 12 +++++----- src/amount.cpp | 6 ++--- src/amount.h | 7 +++--- src/arith_uint256.cpp | 12 +++++----- src/arith_uint256.h | 25 ++++++++++---------- src/base58.cpp | 9 ++++---- src/base58.h | 13 ++++++----- src/dstencode.cpp | 12 +++++----- src/dstencode.h | 6 ++--- src/hash.cpp | 8 +++---- src/hash.h | 16 ++++++------- src/httprpc.cpp | 37 +++++++++++++++--------------- src/httpserver.cpp | 53 +++++++++++++++++++++++-------------------- src/httpserver.h | 3 +++ src/key.cpp | 32 +++++++++++++------------- src/key.h | 16 ++++++------- 19 files changed, 152 insertions(+), 147 deletions(-) diff --git a/src/addrdb.cpp b/src/addrdb.cpp index ddf41f92d..0b2319222 100644 --- a/src/addrdb.cpp +++ b/src/addrdb.cpp @@ -3,16 +3,16 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#include "addrdb.h" +#include -#include "addrman.h" -#include "chainparams.h" -#include "clientversion.h" -#include "hash.h" -#include "random.h" -#include "streams.h" -#include "tinyformat.h" -#include "util.h" +#include +#include +#include +#include +#include +#include +#include +#include #include diff --git a/src/addrdb.h b/src/addrdb.h index d8c66d872..dfd752be8 100644 --- a/src/addrdb.h +++ b/src/addrdb.h @@ -6,7 +6,7 @@ #ifndef BITCOIN_ADDRDB_H #define BITCOIN_ADDRDB_H -#include "serialize.h" +#include #include #include diff --git a/src/addrman.cpp b/src/addrman.cpp index cebb1c8e5..0d8911a00 100644 --- a/src/addrman.cpp +++ b/src/addrman.cpp @@ -3,11 +3,11 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#include "addrman.h" +#include -#include "hash.h" -#include "serialize.h" -#include "streams.h" +#include +#include +#include int CAddrInfo::GetTriedBucket(const uint256& nKey) const { @@ -76,13 +76,13 @@ CAddrInfo* CAddrMan::Find(const CNetAddr& addr, int* pnId) { std::map::iterator it = mapAddr.find(addr); if (it == mapAddr.end()) - return NULL; + return nullptr; if (pnId) *pnId = (*it).second; std::map::iterator it2 = mapInfo.find((*it).second); if (it2 != mapInfo.end()) return &(*it2).second; - return NULL; + return nullptr; } CAddrInfo* CAddrMan::Create(const CAddress& addr, const CNetAddr& addrSource, int* pnId) diff --git a/src/addrman.h b/src/addrman.h index 9bab39049..a42a372c6 100644 --- a/src/addrman.h +++ b/src/addrman.h @@ -6,12 +6,12 @@ #ifndef BITCOIN_ADDRMAN_H #define BITCOIN_ADDRMAN_H -#include "netaddress.h" -#include "protocol.h" -#include "random.h" -#include "sync.h" -#include "timedata.h" -#include "util.h" +#include +#include +#include +#include +#include +#include #include #include diff --git a/src/amount.cpp b/src/amount.cpp index 060d8bb01..60d3df54f 100644 --- a/src/amount.cpp +++ b/src/amount.cpp @@ -3,10 +3,10 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#include "amount.h" -#include "math.h" +#include +#include -#include "tinyformat.h" +#include const std::string CURRENCY_UNIT = "BLK"; diff --git a/src/amount.h b/src/amount.h index 5d3e7d38e..a7985bbf4 100644 --- a/src/amount.h +++ b/src/amount.h @@ -6,7 +6,7 @@ #ifndef BITCOIN_AMOUNT_H #define BITCOIN_AMOUNT_H -#include "serialize.h" +#include #include #include @@ -21,8 +21,7 @@ extern const std::string CURRENCY_UNIT; /** No amount larger than this (in satoshi) is valid. * - * Note that this constant is *not* the total money supply, which in Bitcoin - * currently happens to be less than 21,000,000 BTC for various reasons, but + * Note that this constant is *not* the total money supply, but * rather a sanity check. As this sanity check is used by consensus-critical * validation code, the exact value of the MAX_MONEY constant is consensus * critical; in unusual circumstances like a(nother) overflow bug that allowed @@ -52,7 +51,7 @@ public: /** * Return the fee in satoshis for a size of 1000 bytes */ - CAmount GetFeePerK() const { return GetFee(1000); } + CAmount GetFeePerK() const { return GetFee(10000); } friend bool operator<(const CFeeRate& a, const CFeeRate& b) { return a.nSatoshisPerK < b.nSatoshisPerK; } friend bool operator>(const CFeeRate& a, const CFeeRate& b) { return a.nSatoshisPerK > b.nSatoshisPerK; } friend bool operator==(const CFeeRate& a, const CFeeRate& b) { return a.nSatoshisPerK == b.nSatoshisPerK; } diff --git a/src/arith_uint256.cpp b/src/arith_uint256.cpp index 2e6136357..10d3ac3fa 100644 --- a/src/arith_uint256.cpp +++ b/src/arith_uint256.cpp @@ -3,11 +3,11 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#include "arith_uint256.h" +#include -#include "uint256.h" -#include "utilstrencodings.h" -#include "crypto/common.h" +#include +#include +#include #include #include @@ -216,8 +216,8 @@ arith_uint256& arith_uint256::SetCompact(uint32_t nCompact, bool* pfNegative, bo *pfNegative = nWord != 0 && (nCompact & 0x00800000) != 0; if (pfOverflow) *pfOverflow = nWord != 0 && ((nSize > 34) || - (nWord > 0xff && nSize > 33) || - (nWord > 0xffff && nSize > 32)); + (nWord > 0xff && nSize > 33) || + (nWord > 0xffff && nSize > 32)); return *this; } diff --git a/src/arith_uint256.h b/src/arith_uint256.h index ba3d62015..5666d83a9 100644 --- a/src/arith_uint256.h +++ b/src/arith_uint256.h @@ -15,20 +15,21 @@ class uint256; -class uint_error : public std::runtime_error { +class uint_error : public std::runtime_error +{ public: explicit uint_error(const std::string& str) : std::runtime_error(str) {} }; /** Template base class for unsigned big integers. */ -template +template class base_uint { protected: - enum { WIDTH=BITS/32 }; + enum { WIDTH = BITS / 32 }; uint32_t pn[WIDTH]; -public: +public: base_uint() { for (int i = 0; i < WIDTH; i++) @@ -135,8 +136,7 @@ public: base_uint& operator+=(const base_uint& b) { uint64_t carry = 0; - for (int i = 0; i < WIDTH; i++) - { + for (int i = 0; i < WIDTH; i++) { uint64_t n = carry + pn[i] + b.pn[i]; pn[i] = n & 0xffffffff; carry = n >> 32; @@ -174,7 +174,7 @@ public: { // prefix operator int i = 0; - while (++pn[i] == 0 && i < WIDTH-1) + while (++pn[i] == 0 && i < WIDTH - 1) i++; return *this; } @@ -191,7 +191,7 @@ public: { // prefix operator int i = 0; - while (--pn[i] == (uint32_t)-1 && i < WIDTH-1) + while (--pn[i] == (uint32_t)-1 && i < WIDTH - 1) i++; return *this; } @@ -250,7 +250,8 @@ public: }; /** 256-bit unsigned big integer. */ -class arith_uint256 : public base_uint<256> { +class arith_uint256 : public base_uint<256> +{ public: arith_uint256() {} arith_uint256(const base_uint<256>& b) : base_uint<256>(b) {} @@ -277,11 +278,11 @@ public: * complexities of the sign bit and using base 256 are probably an * implementation accident. */ - arith_uint256& SetCompact(uint32_t nCompact, bool *pfNegative = NULL, bool *pfOverflow = NULL); + arith_uint256& SetCompact(uint32_t nCompact, bool* pfNegative = NULL, bool* pfOverflow = NULL); uint32_t GetCompact(bool fNegative = false) const; - friend uint256 ArithToUint256(const arith_uint256 &); - friend arith_uint256 UintToArith256(const uint256 &); + friend uint256 ArithToUint256(const arith_uint256&); + friend arith_uint256 UintToArith256(const uint256&); }; uint256 ArithToUint256(const arith_uint256 &); diff --git a/src/base58.cpp b/src/base58.cpp index 4e6366f9a..acf57411b 100644 --- a/src/base58.cpp +++ b/src/base58.cpp @@ -2,11 +2,10 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#include "base58.h" +#include -#include "hash.h" -#include "script/script.h" -#include "uint256.h" +#include +#include #include #include @@ -36,7 +35,7 @@ bool DecodeBase58(const char* psz, std::vector& vch) while (*psz && !isspace(*psz)) { // Decode base58 character const char* ch = strchr(pszBase58, *psz); - if (ch == NULL) + if (ch == nullptr) return false; // Apply "b256 = b256 * 58 + ch". int carry = ch - pszBase58; diff --git a/src/base58.h b/src/base58.h index 29663fbf8..e8a773c7e 100644 --- a/src/base58.h +++ b/src/base58.h @@ -14,11 +14,12 @@ #ifndef BITCOIN_BASE58_H #define BITCOIN_BASE58_H -#include "chainparams.h" -#include "key.h" -#include "pubkey.h" -#include "script/standard.h" -#include "support/allocators/zeroafterfree.h" +#include +#include +#include +#include