Skip to content

Commit fa94b9d

Browse files
fanquakelaanwj
authored andcommitted
Convert remaining comments in /src to doxygen format
- Update comments in checkpoints to be doxygen compatible - Update comments in checkqueue to be doxygen compatible - Update coins to be doxygen compatible - Fix comment typo in crypter.h - Update licenses/copyright dates Closes #5325 #5184 #5183 #5182
1 parent f2ada13 commit fa94b9d

19 files changed

+269
-225
lines changed

src/base58.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Copyright (c) 2014 The Bitcoin developers
2-
// Distributed under the MIT/X11 software license, see the accompanying
2+
// Distributed under the MIT software license, see the accompanying
33
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
44

55
#include "base58.h"
@@ -15,7 +15,7 @@
1515
#include <boost/variant/apply_visitor.hpp>
1616
#include <boost/variant/static_visitor.hpp>
1717

18-
/* All alphanumeric characters except for "0", "I", "O", and "l" */
18+
/** All alphanumeric characters except for "0", "I", "O", and "l" */
1919
static const char* pszBase58 = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
2020

2121
bool DecodeBase58(const char* psz, std::vector<unsigned char>& vch)

src/base58.h

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
// Copyright (c) 2009-2010 Satoshi Nakamoto
2-
// Copyright (c) 2009-2013 The Bitcoin developers
3-
// Distributed under the MIT/X11 software license, see the accompanying
2+
// Copyright (c) 2009-2014 The Bitcoin developers
3+
// Distributed under the MIT software license, see the accompanying
44
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
55

6-
//
7-
// Why base-58 instead of standard base-64 encoding?
8-
// - Don't want 0OIl characters that look the same in some fonts and
9-
// could be used to create visually identical looking account numbers.
10-
// - A string with non-alphanumeric characters is not as easily accepted as an account number.
11-
// - E-mail usually won't line-break if there's no punctuation to break at.
12-
// - Double-clicking selects the whole number as one word if it's all alphanumeric.
13-
//
6+
/**
7+
* Why base-58 instead of standard base-64 encoding?
8+
* - Don't want 0OIl characters that look the same in some fonts and
9+
* could be used to create visually identical looking account numbers.
10+
* - A string with non-alphanumeric characters is not as easily accepted as an account number.
11+
* - E-mail usually won't line-break if there's no punctuation to break at.
12+
* - Double-clicking selects the whole number as one word if it's all alphanumeric.
13+
*/
1414
#ifndef BITCOIN_BASE58_H
1515
#define BITCOIN_BASE58_H
1616

@@ -70,10 +70,10 @@ inline bool DecodeBase58Check(const std::string& str, std::vector<unsigned char>
7070
class CBase58Data
7171
{
7272
protected:
73-
// the version byte(s)
73+
//! the version byte(s)
7474
std::vector<unsigned char> vchVersion;
7575

76-
// the actually encoded data
76+
//! the actually encoded data
7777
typedef std::vector<unsigned char, zero_after_free_allocator<unsigned char> > vector_uchar;
7878
vector_uchar vchData;
7979

src/bloom.cpp

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
// Copyright (c) 2012 The Bitcoin developers
2-
// Distributed under the MIT/X11 software license, see the accompanying
1+
// Copyright (c) 2012-2014 The Bitcoin developers
2+
// Distributed under the MIT software license, see the accompanying
33
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
44

55
#include "bloom.h"
@@ -21,13 +21,17 @@
2121
using namespace std;
2222

2323
CBloomFilter::CBloomFilter(unsigned int nElements, double nFPRate, unsigned int nTweakIn, unsigned char nFlagsIn) :
24-
// The ideal size for a bloom filter with a given number of elements and false positive rate is:
25-
// - nElements * log(fp rate) / ln(2)^2
26-
// We ignore filter parameters which will create a bloom filter larger than the protocol limits
24+
/**
25+
* The ideal size for a bloom filter with a given number of elements and false positive rate is:
26+
* - nElements * log(fp rate) / ln(2)^2
27+
* We ignore filter parameters which will create a bloom filter larger than the protocol limits
28+
*/
2729
vData(min((unsigned int)(-1 / LN2SQUARED * nElements * log(nFPRate)), MAX_BLOOM_FILTER_SIZE * 8) / 8),
28-
// The ideal number of hash functions is filter size * ln(2) / number of elements
29-
// Again, we ignore filter parameters which will create a bloom filter with more hash functions than the protocol limits
30-
// See http://en.wikipedia.org/wiki/Bloom_filter for an explanation of these formulas
30+
/**
31+
* The ideal number of hash functions is filter size * ln(2) / number of elements
32+
* Again, we ignore filter parameters which will create a bloom filter with more hash functions than the protocol limits
33+
* See https://en.wikipedia.org/wiki/Bloom_filter for an explanation of these formulas
34+
*/
3135
isFull(false),
3236
isEmpty(false),
3337
nHashFuncs(min((unsigned int)(vData.size() * 8 / nElements * LN2), MAX_HASH_FUNCS)),

src/bloom.h

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
// Copyright (c) 2012 The Bitcoin developers
2-
// Distributed under the MIT/X11 software license, see the accompanying
1+
// Copyright (c) 2012-2014 The Bitcoin developers
2+
// Distributed under the MIT software license, see the accompanying
33
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
44

55
#ifndef BITCOIN_BLOOM_H
@@ -13,12 +13,14 @@ class COutPoint;
1313
class CTransaction;
1414
class uint256;
1515

16-
// 20,000 items with fp rate < 0.1% or 10,000 items and <0.0001%
16+
//! 20,000 items with fp rate < 0.1% or 10,000 items and <0.0001%
1717
static const unsigned int MAX_BLOOM_FILTER_SIZE = 36000; // bytes
1818
static const unsigned int MAX_HASH_FUNCS = 50;
1919

20-
// First two bits of nFlags control how much IsRelevantAndUpdate actually updates
21-
// The remaining bits are reserved
20+
/**
21+
* First two bits of nFlags control how much IsRelevantAndUpdate actually updates
22+
* The remaining bits are reserved
23+
*/
2224
enum bloomflags
2325
{
2426
BLOOM_UPDATE_NONE = 0,
@@ -52,13 +54,15 @@ class CBloomFilter
5254
unsigned int Hash(unsigned int nHashNum, const std::vector<unsigned char>& vDataToHash) const;
5355

5456
public:
55-
// Creates a new bloom filter which will provide the given fp rate when filled with the given number of elements
56-
// Note that if the given parameters will result in a filter outside the bounds of the protocol limits,
57-
// the filter created will be as close to the given parameters as possible within the protocol limits.
58-
// This will apply if nFPRate is very low or nElements is unreasonably high.
59-
// nTweak is a constant which is added to the seed value passed to the hash function
60-
// It should generally always be a random value (and is largely only exposed for unit testing)
61-
// nFlags should be one of the BLOOM_UPDATE_* enums (not _MASK)
57+
/**
58+
* Creates a new bloom filter which will provide the given fp rate when filled with the given number of elements
59+
* Note that if the given parameters will result in a filter outside the bounds of the protocol limits,
60+
* the filter created will be as close to the given parameters as possible within the protocol limits.
61+
* This will apply if nFPRate is very low or nElements is unreasonably high.
62+
* nTweak is a constant which is added to the seed value passed to the hash function
63+
* It should generally always be a random value (and is largely only exposed for unit testing)
64+
* nFlags should be one of the BLOOM_UPDATE_* enums (not _MASK)
65+
*/
6266
CBloomFilter(unsigned int nElements, double nFPRate, unsigned int nTweak, unsigned char nFlagsIn);
6367
CBloomFilter() : isFull(true), isEmpty(false), nHashFuncs(0), nTweak(0), nFlags(0) {}
6468

@@ -82,14 +86,14 @@ class CBloomFilter
8286

8387
void clear();
8488

85-
// True if the size is <= MAX_BLOOM_FILTER_SIZE and the number of hash functions is <= MAX_HASH_FUNCS
86-
// (catch a filter which was just deserialized which was too big)
89+
//! True if the size is <= MAX_BLOOM_FILTER_SIZE and the number of hash functions is <= MAX_HASH_FUNCS
90+
//! (catch a filter which was just deserialized which was too big)
8791
bool IsWithinSizeConstraints() const;
8892

89-
// Also adds any outputs which match the filter to the filter (to match their spending txes)
93+
//! Also adds any outputs which match the filter to the filter (to match their spending txes)
9094
bool IsRelevantAndUpdate(const CTransaction& tx);
9195

92-
// Checks for empty and full filters to avoid wasting cpu
96+
//! Checks for empty and full filters to avoid wasting cpu
9397
void UpdateEmptyFull();
9498
};
9599

src/checkpoints.cpp

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Copyright (c) 2009-2014 The Bitcoin developers
2-
// Distributed under the MIT/X11 software license, see the accompanying
2+
// Distributed under the MIT software license, see the accompanying
33
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
44

55
#include "checkpoints.h"
@@ -14,11 +14,13 @@
1414

1515
namespace Checkpoints {
1616

17-
// How many times we expect transactions after the last checkpoint to
18-
// be slower. This number is a compromise, as it can't be accurate for
19-
// every system. When reindexing from a fast disk with a slow CPU, it
20-
// can be up to 20, while when downloading from a slow network with a
21-
// fast multicore CPU, it won't be much higher than 1.
17+
/**
18+
* How many times we expect transactions after the last checkpoint to
19+
* be slower. This number is a compromise, as it can't be accurate for
20+
* every system. When reindexing from a fast disk with a slow CPU, it
21+
* can be up to 20, while when downloading from a slow network with a
22+
* fast multicore CPU, it won't be much higher than 1.
23+
*/
2224
static const double SIGCHECK_VERIFICATION_FACTOR = 5.0;
2325

2426
bool fEnabled = true;
@@ -35,7 +37,7 @@ namespace Checkpoints {
3537
return hash == i->second;
3638
}
3739

38-
// Guess how far we are in the verification process at the given block index
40+
//! Guess how far we are in the verification process at the given block index
3941
double GuessVerificationProgress(CBlockIndex *pindex, bool fSigchecks) {
4042
if (pindex==NULL)
4143
return 0.0;

src/checkpoints.h

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
// Copyright (c) 2009-2013 The Bitcoin developers
2-
// Distributed under the MIT/X11 software license, see the accompanying
1+
// Copyright (c) 2009-2014 The Bitcoin developers
2+
// Distributed under the MIT software license, see the accompanying
33
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
44

55
#ifndef BITCOIN_CHECKPOINTS_H
@@ -11,7 +11,8 @@
1111

1212
class CBlockIndex;
1313

14-
/** Block-chain checkpoints are compiled-in sanity checks.
14+
/**
15+
* Block-chain checkpoints are compiled-in sanity checks.
1516
* They are updated every release or three.
1617
*/
1718
namespace Checkpoints
@@ -25,13 +26,13 @@ struct CCheckpointData {
2526
double fTransactionsPerDay;
2627
};
2728

28-
// Returns true if block passes checkpoint checks
29+
//! Returns true if block passes checkpoint checks
2930
bool CheckBlock(int nHeight, const uint256& hash);
3031

31-
// Return conservative estimate of total number of blocks, 0 if unknown
32+
//! Return conservative estimate of total number of blocks, 0 if unknown
3233
int GetTotalBlocksEstimate();
3334

34-
// Returns last CBlockIndex* in mapBlockIndex that is a checkpoint
35+
//! Returns last CBlockIndex* in mapBlockIndex that is a checkpoint
3536
CBlockIndex* GetLastCheckpoint();
3637

3738
double GuessVerificationProgress(CBlockIndex* pindex, bool fSigchecks = true);

src/checkqueue.h

Lines changed: 27 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
// Copyright (c) 2012 The Bitcoin developers
2-
// Distributed under the MIT/X11 software license, see the accompanying
1+
// Copyright (c) 2012-2014 The Bitcoin developers
2+
// Distributed under the MIT software license, see the accompanying
33
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
44

55
#ifndef BITCOIN_CHECKQUEUE_H
@@ -16,7 +16,8 @@
1616
template <typename T>
1717
class CCheckQueueControl;
1818

19-
/** Queue for verifications that have to be performed.
19+
/**
20+
* Queue for verifications that have to be performed.
2021
* The verifications are represented by a type T, which must provide an
2122
* operator(), returning a bool.
2223
*
@@ -29,40 +30,42 @@ template <typename T>
2930
class CCheckQueue
3031
{
3132
private:
32-
// Mutex to protect the inner state
33+
//! Mutex to protect the inner state
3334
boost::mutex mutex;
3435

35-
// Worker threads block on this when out of work
36+
//! Worker threads block on this when out of work
3637
boost::condition_variable condWorker;
3738

38-
// Master thread blocks on this when out of work
39+
//! Master thread blocks on this when out of work
3940
boost::condition_variable condMaster;
4041

41-
// The queue of elements to be processed.
42-
// As the order of booleans doesn't matter, it is used as a LIFO (stack)
42+
//! The queue of elements to be processed.
43+
//! As the order of booleans doesn't matter, it is used as a LIFO (stack)
4344
std::vector<T> queue;
4445

45-
// The number of workers (including the master) that are idle.
46+
//! The number of workers (including the master) that are idle.
4647
int nIdle;
4748

48-
// The total number of workers (including the master).
49+
//! The total number of workers (including the master).
4950
int nTotal;
5051

51-
// The temporary evaluation result.
52+
//! The temporary evaluation result.
5253
bool fAllOk;
5354

54-
// Number of verifications that haven't completed yet.
55-
// This includes elements that are not anymore in queue, but still in
56-
// worker's own batches.
55+
/**
56+
* Number of verifications that haven't completed yet.
57+
* This includes elements that are not anymore in queue, but still in
58+
* worker's own batches.
59+
*/
5760
unsigned int nTodo;
5861

59-
// Whether we're shutting down.
62+
//! Whether we're shutting down.
6063
bool fQuit;
6164

62-
// The maximum number of elements to be processed in one batch
65+
//! The maximum number of elements to be processed in one batch
6366
unsigned int nBatchSize;
6467

65-
// Internal function that does bulk of the verification work.
68+
/** Internal function that does bulk of the verification work. */
6669
bool Loop(bool fMaster = false)
6770
{
6871
boost::condition_variable& cond = fMaster ? condMaster : condWorker;
@@ -124,22 +127,22 @@ class CCheckQueue
124127
}
125128

126129
public:
127-
// Create a new check queue
130+
//! Create a new check queue
128131
CCheckQueue(unsigned int nBatchSizeIn) : nIdle(0), nTotal(0), fAllOk(true), nTodo(0), fQuit(false), nBatchSize(nBatchSizeIn) {}
129132

130-
// Worker thread
133+
//! Worker thread
131134
void Thread()
132135
{
133136
Loop();
134137
}
135138

136-
// Wait until execution finishes, and return whether all evaluations where succesful.
139+
//! Wait until execution finishes, and return whether all evaluations where successful.
137140
bool Wait()
138141
{
139142
return Loop(true);
140143
}
141144

142-
// Add a batch of checks to the queue
145+
//! Add a batch of checks to the queue
143146
void Add(std::vector<T>& vChecks)
144147
{
145148
boost::unique_lock<boost::mutex> lock(mutex);
@@ -161,8 +164,9 @@ class CCheckQueue
161164
friend class CCheckQueueControl<T>;
162165
};
163166

164-
/** RAII-style controller object for a CCheckQueue that guarantees the passed
165-
* queue is finished before continuing.
167+
/**
168+
* RAII-style controller object for a CCheckQueue that guarantees the passed
169+
* queue is finished before continuing.
166170
*/
167171
template <typename T>
168172
class CCheckQueueControl

src/coins.cpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
// Copyright (c) 2012-2013 The Bitcoin developers
2-
// Distributed under the MIT/X11 software license, see the accompanying
1+
// Copyright (c) 2012-2014 The Bitcoin developers
2+
// Distributed under the MIT software license, see the accompanying
33
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
44

55
#include "coins.h"
@@ -8,9 +8,11 @@
88

99
#include <assert.h>
1010

11-
// calculate number of bytes for the bitmask, and its number of non-zero bytes
12-
// each bit in the bitmask represents the availability of one output, but the
13-
// availabilities of the first two outputs are encoded separately
11+
/**
12+
* calculate number of bytes for the bitmask, and its number of non-zero bytes
13+
* each bit in the bitmask represents the availability of one output, but the
14+
* availabilities of the first two outputs are encoded separately
15+
*/
1416
void CCoins::CalcMaskSize(unsigned int &nBytes, unsigned int &nNonzeroBytes) const {
1517
unsigned int nLastUsedByte = 0;
1618
for (unsigned int b = 0; 2+b*8 < vout.size(); b++) {
@@ -133,7 +135,7 @@ const CCoins* CCoinsViewCache::AccessCoins(const uint256 &txid) const {
133135
bool CCoinsViewCache::HaveCoins(const uint256 &txid) const {
134136
CCoinsMap::const_iterator it = FetchCoins(txid);
135137
// We're using vtx.empty() instead of IsPruned here for performance reasons,
136-
// as we only care about the case where an transaction was replaced entirely
138+
// as we only care about the case where a transaction was replaced entirely
137139
// in a reorganization (which wipes vout entirely, as opposed to spending
138140
// which just cleans individual outputs).
139141
return (it != cacheCoins.end() && !it->second.coins.vout.empty());

0 commit comments

Comments
 (0)