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
This commit is contained in:
Michael Ford 2014-10-31 08:43:19 +08:00 committed by Wladimir J. van der Laan
parent f2ada138c2
commit fa94b9d562
No known key found for this signature in database
GPG Key ID: 74810B012346C9A6
19 changed files with 269 additions and 225 deletions

View File

@ -1,5 +1,5 @@
// Copyright (c) 2014 The Bitcoin developers // Copyright (c) 2014 The Bitcoin developers
// Distributed under the MIT/X11 software license, see the accompanying // Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php. // file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include "base58.h" #include "base58.h"
@ -15,7 +15,7 @@
#include <boost/variant/apply_visitor.hpp> #include <boost/variant/apply_visitor.hpp>
#include <boost/variant/static_visitor.hpp> #include <boost/variant/static_visitor.hpp>
/* All alphanumeric characters except for "0", "I", "O", and "l" */ /** All alphanumeric characters except for "0", "I", "O", and "l" */
static const char* pszBase58 = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"; static const char* pszBase58 = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
bool DecodeBase58(const char* psz, std::vector<unsigned char>& vch) bool DecodeBase58(const char* psz, std::vector<unsigned char>& vch)

View File

@ -1,16 +1,16 @@
// Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2009-2010 Satoshi Nakamoto
// Copyright (c) 2009-2013 The Bitcoin developers // Copyright (c) 2009-2014 The Bitcoin developers
// Distributed under the MIT/X11 software license, see the accompanying // Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php. // file COPYING or http://www.opensource.org/licenses/mit-license.php.
// /**
// Why base-58 instead of standard base-64 encoding? * Why base-58 instead of standard base-64 encoding?
// - Don't want 0OIl characters that look the same in some fonts and * - Don't want 0OIl characters that look the same in some fonts and
// could be used to create visually identical looking account numbers. * could be used to create visually identical looking account numbers.
// - A string with non-alphanumeric characters is not as easily accepted as an account number. * - A string with non-alphanumeric characters is not as easily accepted as an account number.
// - E-mail usually won't line-break if there's no punctuation to break at. * - E-mail usually won't line-break if there's no punctuation to break at.
// - Double-clicking selects the whole number as one word if it's all alphanumeric. * - Double-clicking selects the whole number as one word if it's all alphanumeric.
// */
#ifndef BITCOIN_BASE58_H #ifndef BITCOIN_BASE58_H
#define BITCOIN_BASE58_H #define BITCOIN_BASE58_H
@ -70,10 +70,10 @@ inline bool DecodeBase58Check(const std::string& str, std::vector<unsigned char>
class CBase58Data class CBase58Data
{ {
protected: protected:
// the version byte(s) //! the version byte(s)
std::vector<unsigned char> vchVersion; std::vector<unsigned char> vchVersion;
// the actually encoded data //! the actually encoded data
typedef std::vector<unsigned char, zero_after_free_allocator<unsigned char> > vector_uchar; typedef std::vector<unsigned char, zero_after_free_allocator<unsigned char> > vector_uchar;
vector_uchar vchData; vector_uchar vchData;

View File

@ -1,5 +1,5 @@
// Copyright (c) 2012 The Bitcoin developers // Copyright (c) 2012-2014 The Bitcoin developers
// Distributed under the MIT/X11 software license, see the accompanying // Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php. // file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include "bloom.h" #include "bloom.h"
@ -21,13 +21,17 @@
using namespace std; using namespace std;
CBloomFilter::CBloomFilter(unsigned int nElements, double nFPRate, unsigned int nTweakIn, unsigned char nFlagsIn) : CBloomFilter::CBloomFilter(unsigned int nElements, double nFPRate, unsigned int nTweakIn, unsigned char nFlagsIn) :
// The ideal size for a bloom filter with a given number of elements and false positive rate is: /**
// - nElements * log(fp rate) / ln(2)^2 * The ideal size for a bloom filter with a given number of elements and false positive rate is:
// We ignore filter parameters which will create a bloom filter larger than the protocol limits * - nElements * log(fp rate) / ln(2)^2
* We ignore filter parameters which will create a bloom filter larger than the protocol limits
*/
vData(min((unsigned int)(-1 / LN2SQUARED * nElements * log(nFPRate)), MAX_BLOOM_FILTER_SIZE * 8) / 8), vData(min((unsigned int)(-1 / LN2SQUARED * nElements * log(nFPRate)), MAX_BLOOM_FILTER_SIZE * 8) / 8),
// The ideal number of hash functions is filter size * ln(2) / number of elements /**
// Again, we ignore filter parameters which will create a bloom filter with more hash functions than the protocol limits * The ideal number of hash functions is filter size * ln(2) / number of elements
// See http://en.wikipedia.org/wiki/Bloom_filter for an explanation of these formulas * Again, we ignore filter parameters which will create a bloom filter with more hash functions than the protocol limits
* See https://en.wikipedia.org/wiki/Bloom_filter for an explanation of these formulas
*/
isFull(false), isFull(false),
isEmpty(false), isEmpty(false),
nHashFuncs(min((unsigned int)(vData.size() * 8 / nElements * LN2), MAX_HASH_FUNCS)), nHashFuncs(min((unsigned int)(vData.size() * 8 / nElements * LN2), MAX_HASH_FUNCS)),

View File

@ -1,5 +1,5 @@
// Copyright (c) 2012 The Bitcoin developers // Copyright (c) 2012-2014 The Bitcoin developers
// Distributed under the MIT/X11 software license, see the accompanying // Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php. // file COPYING or http://www.opensource.org/licenses/mit-license.php.
#ifndef BITCOIN_BLOOM_H #ifndef BITCOIN_BLOOM_H
@ -13,12 +13,14 @@ class COutPoint;
class CTransaction; class CTransaction;
class uint256; class uint256;
// 20,000 items with fp rate < 0.1% or 10,000 items and <0.0001% //! 20,000 items with fp rate < 0.1% or 10,000 items and <0.0001%
static const unsigned int MAX_BLOOM_FILTER_SIZE = 36000; // bytes static const unsigned int MAX_BLOOM_FILTER_SIZE = 36000; // bytes
static const unsigned int MAX_HASH_FUNCS = 50; static const unsigned int MAX_HASH_FUNCS = 50;
// First two bits of nFlags control how much IsRelevantAndUpdate actually updates /**
// The remaining bits are reserved * First two bits of nFlags control how much IsRelevantAndUpdate actually updates
* The remaining bits are reserved
*/
enum bloomflags enum bloomflags
{ {
BLOOM_UPDATE_NONE = 0, BLOOM_UPDATE_NONE = 0,
@ -52,13 +54,15 @@ private:
unsigned int Hash(unsigned int nHashNum, const std::vector<unsigned char>& vDataToHash) const; unsigned int Hash(unsigned int nHashNum, const std::vector<unsigned char>& vDataToHash) const;
public: public:
// Creates a new bloom filter which will provide the given fp rate when filled with the given number of elements /**
// Note that if the given parameters will result in a filter outside the bounds of the protocol limits, * Creates a new bloom filter which will provide the given fp rate when filled with the given number of elements
// the filter created will be as close to the given parameters as possible within the protocol limits. * Note that if the given parameters will result in a filter outside the bounds of the protocol limits,
// This will apply if nFPRate is very low or nElements is unreasonably high. * the filter created will be as close to the given parameters as possible within the protocol limits.
// nTweak is a constant which is added to the seed value passed to the hash function * This will apply if nFPRate is very low or nElements is unreasonably high.
// It should generally always be a random value (and is largely only exposed for unit testing) * nTweak is a constant which is added to the seed value passed to the hash function
// nFlags should be one of the BLOOM_UPDATE_* enums (not _MASK) * It should generally always be a random value (and is largely only exposed for unit testing)
* nFlags should be one of the BLOOM_UPDATE_* enums (not _MASK)
*/
CBloomFilter(unsigned int nElements, double nFPRate, unsigned int nTweak, unsigned char nFlagsIn); CBloomFilter(unsigned int nElements, double nFPRate, unsigned int nTweak, unsigned char nFlagsIn);
CBloomFilter() : isFull(true), isEmpty(false), nHashFuncs(0), nTweak(0), nFlags(0) {} CBloomFilter() : isFull(true), isEmpty(false), nHashFuncs(0), nTweak(0), nFlags(0) {}
@ -82,14 +86,14 @@ public:
void clear(); void clear();
// True if the size is <= MAX_BLOOM_FILTER_SIZE and the number of hash functions is <= MAX_HASH_FUNCS //! True if the size is <= MAX_BLOOM_FILTER_SIZE and the number of hash functions is <= MAX_HASH_FUNCS
// (catch a filter which was just deserialized which was too big) //! (catch a filter which was just deserialized which was too big)
bool IsWithinSizeConstraints() const; bool IsWithinSizeConstraints() const;
// Also adds any outputs which match the filter to the filter (to match their spending txes) //! Also adds any outputs which match the filter to the filter (to match their spending txes)
bool IsRelevantAndUpdate(const CTransaction& tx); bool IsRelevantAndUpdate(const CTransaction& tx);
// Checks for empty and full filters to avoid wasting cpu //! Checks for empty and full filters to avoid wasting cpu
void UpdateEmptyFull(); void UpdateEmptyFull();
}; };

View File

@ -1,5 +1,5 @@
// Copyright (c) 2009-2014 The Bitcoin developers // Copyright (c) 2009-2014 The Bitcoin developers
// Distributed under the MIT/X11 software license, see the accompanying // Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php. // file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include "checkpoints.h" #include "checkpoints.h"
@ -14,11 +14,13 @@
namespace Checkpoints { namespace Checkpoints {
// How many times we expect transactions after the last checkpoint to /**
// be slower. This number is a compromise, as it can't be accurate for * How many times we expect transactions after the last checkpoint to
// every system. When reindexing from a fast disk with a slow CPU, it * be slower. This number is a compromise, as it can't be accurate for
// can be up to 20, while when downloading from a slow network with a * every system. When reindexing from a fast disk with a slow CPU, it
// fast multicore CPU, it won't be much higher than 1. * can be up to 20, while when downloading from a slow network with a
* fast multicore CPU, it won't be much higher than 1.
*/
static const double SIGCHECK_VERIFICATION_FACTOR = 5.0; static const double SIGCHECK_VERIFICATION_FACTOR = 5.0;
bool fEnabled = true; bool fEnabled = true;
@ -35,7 +37,7 @@ namespace Checkpoints {
return hash == i->second; return hash == i->second;
} }
// Guess how far we are in the verification process at the given block index //! Guess how far we are in the verification process at the given block index
double GuessVerificationProgress(CBlockIndex *pindex, bool fSigchecks) { double GuessVerificationProgress(CBlockIndex *pindex, bool fSigchecks) {
if (pindex==NULL) if (pindex==NULL)
return 0.0; return 0.0;

View File

@ -1,5 +1,5 @@
// Copyright (c) 2009-2013 The Bitcoin developers // Copyright (c) 2009-2014 The Bitcoin developers
// Distributed under the MIT/X11 software license, see the accompanying // Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php. // file COPYING or http://www.opensource.org/licenses/mit-license.php.
#ifndef BITCOIN_CHECKPOINTS_H #ifndef BITCOIN_CHECKPOINTS_H
@ -11,7 +11,8 @@
class CBlockIndex; class CBlockIndex;
/** Block-chain checkpoints are compiled-in sanity checks. /**
* Block-chain checkpoints are compiled-in sanity checks.
* They are updated every release or three. * They are updated every release or three.
*/ */
namespace Checkpoints namespace Checkpoints
@ -25,13 +26,13 @@ struct CCheckpointData {
double fTransactionsPerDay; double fTransactionsPerDay;
}; };
// Returns true if block passes checkpoint checks //! Returns true if block passes checkpoint checks
bool CheckBlock(int nHeight, const uint256& hash); bool CheckBlock(int nHeight, const uint256& hash);
// Return conservative estimate of total number of blocks, 0 if unknown //! Return conservative estimate of total number of blocks, 0 if unknown
int GetTotalBlocksEstimate(); int GetTotalBlocksEstimate();
// Returns last CBlockIndex* in mapBlockIndex that is a checkpoint //! Returns last CBlockIndex* in mapBlockIndex that is a checkpoint
CBlockIndex* GetLastCheckpoint(); CBlockIndex* GetLastCheckpoint();
double GuessVerificationProgress(CBlockIndex* pindex, bool fSigchecks = true); double GuessVerificationProgress(CBlockIndex* pindex, bool fSigchecks = true);

View File

@ -1,5 +1,5 @@
// Copyright (c) 2012 The Bitcoin developers // Copyright (c) 2012-2014 The Bitcoin developers
// Distributed under the MIT/X11 software license, see the accompanying // Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php. // file COPYING or http://www.opensource.org/licenses/mit-license.php.
#ifndef BITCOIN_CHECKQUEUE_H #ifndef BITCOIN_CHECKQUEUE_H
@ -16,7 +16,8 @@
template <typename T> template <typename T>
class CCheckQueueControl; class CCheckQueueControl;
/** Queue for verifications that have to be performed. /**
* Queue for verifications that have to be performed.
* The verifications are represented by a type T, which must provide an * The verifications are represented by a type T, which must provide an
* operator(), returning a bool. * operator(), returning a bool.
* *
@ -29,40 +30,42 @@ template <typename T>
class CCheckQueue class CCheckQueue
{ {
private: private:
// Mutex to protect the inner state //! Mutex to protect the inner state
boost::mutex mutex; boost::mutex mutex;
// Worker threads block on this when out of work //! Worker threads block on this when out of work
boost::condition_variable condWorker; boost::condition_variable condWorker;
// Master thread blocks on this when out of work //! Master thread blocks on this when out of work
boost::condition_variable condMaster; boost::condition_variable condMaster;
// The queue of elements to be processed. //! The queue of elements to be processed.
// As the order of booleans doesn't matter, it is used as a LIFO (stack) //! As the order of booleans doesn't matter, it is used as a LIFO (stack)
std::vector<T> queue; std::vector<T> queue;
// The number of workers (including the master) that are idle. //! The number of workers (including the master) that are idle.
int nIdle; int nIdle;
// The total number of workers (including the master). //! The total number of workers (including the master).
int nTotal; int nTotal;
// The temporary evaluation result. //! The temporary evaluation result.
bool fAllOk; bool fAllOk;
// Number of verifications that haven't completed yet. /**
// This includes elements that are not anymore in queue, but still in * Number of verifications that haven't completed yet.
// worker's own batches. * This includes elements that are not anymore in queue, but still in
* worker's own batches.
*/
unsigned int nTodo; unsigned int nTodo;
// Whether we're shutting down. //! Whether we're shutting down.
bool fQuit; bool fQuit;
// The maximum number of elements to be processed in one batch //! The maximum number of elements to be processed in one batch
unsigned int nBatchSize; unsigned int nBatchSize;
// Internal function that does bulk of the verification work. /** Internal function that does bulk of the verification work. */
bool Loop(bool fMaster = false) bool Loop(bool fMaster = false)
{ {
boost::condition_variable& cond = fMaster ? condMaster : condWorker; boost::condition_variable& cond = fMaster ? condMaster : condWorker;
@ -124,22 +127,22 @@ private:
} }
public: public:
// Create a new check queue //! Create a new check queue
CCheckQueue(unsigned int nBatchSizeIn) : nIdle(0), nTotal(0), fAllOk(true), nTodo(0), fQuit(false), nBatchSize(nBatchSizeIn) {} CCheckQueue(unsigned int nBatchSizeIn) : nIdle(0), nTotal(0), fAllOk(true), nTodo(0), fQuit(false), nBatchSize(nBatchSizeIn) {}
// Worker thread //! Worker thread
void Thread() void Thread()
{ {
Loop(); Loop();
} }
// Wait until execution finishes, and return whether all evaluations where succesful. //! Wait until execution finishes, and return whether all evaluations where successful.
bool Wait() bool Wait()
{ {
return Loop(true); return Loop(true);
} }
// Add a batch of checks to the queue //! Add a batch of checks to the queue
void Add(std::vector<T>& vChecks) void Add(std::vector<T>& vChecks)
{ {
boost::unique_lock<boost::mutex> lock(mutex); boost::unique_lock<boost::mutex> lock(mutex);
@ -161,8 +164,9 @@ public:
friend class CCheckQueueControl<T>; friend class CCheckQueueControl<T>;
}; };
/** RAII-style controller object for a CCheckQueue that guarantees the passed /**
* queue is finished before continuing. * RAII-style controller object for a CCheckQueue that guarantees the passed
* queue is finished before continuing.
*/ */
template <typename T> template <typename T>
class CCheckQueueControl class CCheckQueueControl

View File

@ -1,5 +1,5 @@
// Copyright (c) 2012-2013 The Bitcoin developers // Copyright (c) 2012-2014 The Bitcoin developers
// Distributed under the MIT/X11 software license, see the accompanying // Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php. // file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include "coins.h" #include "coins.h"
@ -8,9 +8,11 @@
#include <assert.h> #include <assert.h>
// calculate number of bytes for the bitmask, and its number of non-zero bytes /**
// each bit in the bitmask represents the availability of one output, but the * calculate number of bytes for the bitmask, and its number of non-zero bytes
// availabilities of the first two outputs are encoded separately * each bit in the bitmask represents the availability of one output, but the
* availabilities of the first two outputs are encoded separately
*/
void CCoins::CalcMaskSize(unsigned int &nBytes, unsigned int &nNonzeroBytes) const { void CCoins::CalcMaskSize(unsigned int &nBytes, unsigned int &nNonzeroBytes) const {
unsigned int nLastUsedByte = 0; unsigned int nLastUsedByte = 0;
for (unsigned int b = 0; 2+b*8 < vout.size(); b++) { for (unsigned int b = 0; 2+b*8 < vout.size(); b++) {
@ -133,7 +135,7 @@ const CCoins* CCoinsViewCache::AccessCoins(const uint256 &txid) const {
bool CCoinsViewCache::HaveCoins(const uint256 &txid) const { bool CCoinsViewCache::HaveCoins(const uint256 &txid) const {
CCoinsMap::const_iterator it = FetchCoins(txid); CCoinsMap::const_iterator it = FetchCoins(txid);
// We're using vtx.empty() instead of IsPruned here for performance reasons, // We're using vtx.empty() instead of IsPruned here for performance reasons,
// as we only care about the case where an transaction was replaced entirely // as we only care about the case where a transaction was replaced entirely
// in a reorganization (which wipes vout entirely, as opposed to spending // in a reorganization (which wipes vout entirely, as opposed to spending
// which just cleans individual outputs). // which just cleans individual outputs).
return (it != cacheCoins.end() && !it->second.coins.vout.empty()); return (it != cacheCoins.end() && !it->second.coins.vout.empty());

View File

@ -1,6 +1,6 @@
// Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2009-2010 Satoshi Nakamoto
// Copyright (c) 2009-2013 The Bitcoin developers // Copyright (c) 2009-2014 The Bitcoin developers
// Distributed under the MIT/X11 software license, see the accompanying // Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php. // file COPYING or http://www.opensource.org/licenses/mit-license.php.
#ifndef BITCOIN_COINS_H #ifndef BITCOIN_COINS_H
@ -17,7 +17,8 @@
#include <boost/foreach.hpp> #include <boost/foreach.hpp>
#include <boost/unordered_map.hpp> #include <boost/unordered_map.hpp>
/** pruned version of CTransaction: only retains metadata and unspent transaction outputs /**
* Pruned version of CTransaction: only retains metadata and unspent transaction outputs
* *
* Serialized format: * Serialized format:
* - VARINT(nVersion) * - VARINT(nVersion)
@ -71,17 +72,17 @@
class CCoins class CCoins
{ {
public: public:
// whether transaction is a coinbase //! whether transaction is a coinbase
bool fCoinBase; bool fCoinBase;
// unspent transaction outputs; spent outputs are .IsNull(); spent outputs at the end of the array are dropped //! unspent transaction outputs; spent outputs are .IsNull(); spent outputs at the end of the array are dropped
std::vector<CTxOut> vout; std::vector<CTxOut> vout;
// at which height this transaction was included in the active block chain //! at which height this transaction was included in the active block chain
int nHeight; int nHeight;
// version of the CTransaction; accesses to this value should probably check for nHeight as well, //! version of the CTransaction; accesses to this value should probably check for nHeight as well,
// as new tx version will probably only be introduced at certain heights //! as new tx version will probably only be introduced at certain heights
int nVersion; int nVersion;
void FromTx(const CTransaction &tx, int nHeightIn) { void FromTx(const CTransaction &tx, int nHeightIn) {
@ -92,7 +93,7 @@ public:
ClearUnspendable(); ClearUnspendable();
} }
// construct a CCoins from a CTransaction, at a given height //! construct a CCoins from a CTransaction, at a given height
CCoins(const CTransaction &tx, int nHeightIn) { CCoins(const CTransaction &tx, int nHeightIn) {
FromTx(tx, nHeightIn); FromTx(tx, nHeightIn);
} }
@ -104,10 +105,10 @@ public:
nVersion = 0; nVersion = 0;
} }
// empty constructor //! empty constructor
CCoins() : fCoinBase(false), vout(0), nHeight(0), nVersion(0) { } CCoins() : fCoinBase(false), vout(0), nHeight(0), nVersion(0) { }
// remove spent outputs at the end of vout //!remove spent outputs at the end of vout
void Cleanup() { void Cleanup() {
while (vout.size() > 0 && vout.back().IsNull()) while (vout.size() > 0 && vout.back().IsNull())
vout.pop_back(); vout.pop_back();
@ -130,7 +131,7 @@ public:
std::swap(to.nVersion, nVersion); std::swap(to.nVersion, nVersion);
} }
// equality test //! equality test
friend bool operator==(const CCoins &a, const CCoins &b) { friend bool operator==(const CCoins &a, const CCoins &b) {
// Empty CCoins objects are always equal. // Empty CCoins objects are always equal.
if (a.IsPruned() && b.IsPruned()) if (a.IsPruned() && b.IsPruned())
@ -236,19 +237,19 @@ public:
Cleanup(); Cleanup();
} }
// mark an outpoint spent, and construct undo information //! mark an outpoint spent, and construct undo information
bool Spend(const COutPoint &out, CTxInUndo &undo); bool Spend(const COutPoint &out, CTxInUndo &undo);
// mark a vout spent //! mark a vout spent
bool Spend(int nPos); bool Spend(int nPos);
// check whether a particular output is still available //! check whether a particular output is still available
bool IsAvailable(unsigned int nPos) const { bool IsAvailable(unsigned int nPos) const {
return (nPos < vout.size() && !vout[nPos].IsNull()); return (nPos < vout.size() && !vout[nPos].IsNull());
} }
// check whether the entire CCoins is spent //! check whether the entire CCoins is spent
// note that only !IsPruned() CCoins can be serialized //! note that only !IsPruned() CCoins can be serialized
bool IsPruned() const { bool IsPruned() const {
BOOST_FOREACH(const CTxOut &out, vout) BOOST_FOREACH(const CTxOut &out, vout)
if (!out.IsNull()) if (!out.IsNull())
@ -264,9 +265,12 @@ private:
public: public:
CCoinsKeyHasher(); CCoinsKeyHasher();
// This *must* return size_t. With Boost 1.46 on 32-bit systems the
// unordered_map will behave unpredictably if the custom hasher returns a /**
// uint64_t, resulting in failures when syncing the chain (#4634). * This *must* return size_t. With Boost 1.46 on 32-bit systems the
* unordered_map will behave unpredictably if the custom hasher returns a
* uint64_t, resulting in failures when syncing the chain (#4634).
*/
size_t operator()(const uint256& key) const { size_t operator()(const uint256& key) const {
return key.GetHash(salt); return key.GetHash(salt);
} }
@ -305,24 +309,24 @@ struct CCoinsStats
class CCoinsView class CCoinsView
{ {
public: public:
// Retrieve the CCoins (unspent transaction outputs) for a given txid //! Retrieve the CCoins (unspent transaction outputs) for a given txid
virtual bool GetCoins(const uint256 &txid, CCoins &coins) const; virtual bool GetCoins(const uint256 &txid, CCoins &coins) const;
// Just check whether we have data for a given txid. //! Just check whether we have data for a given txid.
// This may (but cannot always) return true for fully spent transactions //! This may (but cannot always) return true for fully spent transactions
virtual bool HaveCoins(const uint256 &txid) const; virtual bool HaveCoins(const uint256 &txid) const;
// Retrieve the block hash whose state this CCoinsView currently represents //! Retrieve the block hash whose state this CCoinsView currently represents
virtual uint256 GetBestBlock() const; virtual uint256 GetBestBlock() const;
// Do a bulk modification (multiple CCoins changes + BestBlock change). //! Do a bulk modification (multiple CCoins changes + BestBlock change).
// The passed mapCoins can be modified. //! The passed mapCoins can be modified.
virtual bool BatchWrite(CCoinsMap &mapCoins, const uint256 &hashBlock); virtual bool BatchWrite(CCoinsMap &mapCoins, const uint256 &hashBlock);
// Calculate statistics about the unspent transaction output set //! Calculate statistics about the unspent transaction output set
virtual bool GetStats(CCoinsStats &stats) const; virtual bool GetStats(CCoinsStats &stats) const;
// As we use CCoinsViews polymorphically, have a virtual destructor //! As we use CCoinsViews polymorphically, have a virtual destructor
virtual ~CCoinsView() {} virtual ~CCoinsView() {}
}; };
@ -346,9 +350,11 @@ public:
class CCoinsViewCache; class CCoinsViewCache;
/** A reference to a mutable cache entry. Encapsulating it allows us to run /**
* A reference to a mutable cache entry. Encapsulating it allows us to run
* cleanup code after the modification is finished, and keeping track of * cleanup code after the modification is finished, and keeping track of
* concurrent modifications. */ * concurrent modifications.
*/
class CCoinsModifier class CCoinsModifier
{ {
private: private:
@ -370,8 +376,10 @@ protected:
/* Whether this cache has an active modifier. */ /* Whether this cache has an active modifier. */
bool hasModifier; bool hasModifier;
/* Make mutable so that we can "fill the cache" even from Get-methods /**
declared as "const". */ * Make mutable so that we can "fill the cache" even from Get-methods
* declared as "const".
*/
mutable uint256 hashBlock; mutable uint256 hashBlock;
mutable CCoinsMap cacheCoins; mutable CCoinsMap cacheCoins;
@ -386,37 +394,44 @@ public:
void SetBestBlock(const uint256 &hashBlock); void SetBestBlock(const uint256 &hashBlock);
bool BatchWrite(CCoinsMap &mapCoins, const uint256 &hashBlock); bool BatchWrite(CCoinsMap &mapCoins, const uint256 &hashBlock);
// Return a pointer to CCoins in the cache, or NULL if not found. This is /**
// more efficient than GetCoins. Modifications to other cache entries are * Return a pointer to CCoins in the cache, or NULL if not found. This is
// allowed while accessing the returned pointer. * more efficient than GetCoins. Modifications to other cache entries are
* allowed while accessing the returned pointer.
*/
const CCoins* AccessCoins(const uint256 &txid) const; const CCoins* AccessCoins(const uint256 &txid) const;
// Return a modifiable reference to a CCoins. If no entry with the given /**
// txid exists, a new one is created. Simultaneous modifications are not * Return a modifiable reference to a CCoins. If no entry with the given
// allowed. * txid exists, a new one is created. Simultaneous modifications are not
* allowed.
*/
CCoinsModifier ModifyCoins(const uint256 &txid); CCoinsModifier ModifyCoins(const uint256 &txid);
// Push the modifications applied to this cache to its base. /**
// Failure to call this method before destruction will cause the changes to be forgotten. * Push the modifications applied to this cache to its base.
// If false is returned, the state of this cache (and its backing view) will be undefined. * Failure to call this method before destruction will cause the changes to be forgotten.
* If false is returned, the state of this cache (and its backing view) will be undefined.
*/
bool Flush(); bool Flush();
// Calculate the size of the cache (in number of transactions) //! Calculate the size of the cache (in number of transactions)
unsigned int GetCacheSize() const; unsigned int GetCacheSize() const;
/** Amount of bitcoins coming in to a transaction /**
Note that lightweight clients may not know anything besides the hash of previous transactions, * Amount of bitcoins coming in to a transaction
so may not be able to calculate this. * Note that lightweight clients may not know anything besides the hash of previous transactions,
* so may not be able to calculate this.
@param[in] tx transaction for which we are checking input total *
@return Sum of value of all inputs (scriptSigs) * @param[in] tx transaction for which we are checking input total
* @return Sum of value of all inputs (scriptSigs)
*/ */
CAmount GetValueIn(const CTransaction& tx) const; CAmount GetValueIn(const CTransaction& tx) const;
// Check whether all prevouts of the transaction are present in the UTXO set represented by this view //! Check whether all prevouts of the transaction are present in the UTXO set represented by this view
bool HaveInputs(const CTransaction& tx) const; bool HaveInputs(const CTransaction& tx) const;
// Return priority of tx at height nHeight //! Return priority of tx at height nHeight
double GetPriority(const CTransaction &tx, int nHeight) const; double GetPriority(const CTransaction &tx, int nHeight) const;
const CTxOut &GetOutputFor(const CTxIn& input) const; const CTxOut &GetOutputFor(const CTxIn& input) const;

View File

@ -28,19 +28,23 @@ class CScriptID;
class CScriptCompressor class CScriptCompressor
{ {
private: private:
// make this static for now (there are only 6 special scripts defined) /**
// this can potentially be extended together with a new nVersion for * make this static for now (there are only 6 special scripts defined)
// transactions, in which case this value becomes dependent on nVersion * this can potentially be extended together with a new nVersion for
// and nHeight of the enclosing transaction. * transactions, in which case this value becomes dependent on nVersion
* and nHeight of the enclosing transaction.
*/
static const unsigned int nSpecialScripts = 6; static const unsigned int nSpecialScripts = 6;
CScript &script; CScript &script;
protected: protected:
// These check for scripts for which a special case with a shorter encoding is defined. /**
// They are implemented separately from the CScript test, as these test for exact byte * These check for scripts for which a special case with a shorter encoding is defined.
// sequence correspondences, and are more strict. For example, IsToPubKey also verifies * They are implemented separately from the CScript test, as these test for exact byte
// whether the public key is valid (as invalid ones cannot be represented in compressed * sequence correspondences, and are more strict. For example, IsToPubKey also verifies
// form). * whether the public key is valid (as invalid ones cannot be represented in compressed
* form).
*/
bool IsToKeyID(CKeyID &hash) const; bool IsToKeyID(CKeyID &hash) const;
bool IsToScriptID(CScriptID &hash) const; bool IsToScriptID(CScriptID &hash) const;
bool IsToPubKey(CPubKey &pubkey) const; bool IsToPubKey(CPubKey &pubkey) const;

View File

@ -1,4 +1,4 @@
// Copyright (c) 2009-2013 The Bitcoin developers // Copyright (c) 2009-2014 The Bitcoin developers
// Distributed under the MIT software license, see the accompanying // Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php. // file COPYING or http://www.opensource.org/licenses/mit-license.php.
@ -14,20 +14,20 @@ class uint256;
const unsigned int WALLET_CRYPTO_KEY_SIZE = 32; const unsigned int WALLET_CRYPTO_KEY_SIZE = 32;
const unsigned int WALLET_CRYPTO_SALT_SIZE = 8; const unsigned int WALLET_CRYPTO_SALT_SIZE = 8;
/* /**
Private key encryption is done based on a CMasterKey, * Private key encryption is done based on a CMasterKey,
which holds a salt and random encryption key. * which holds a salt and random encryption key.
*
CMasterKeys are encrypted using AES-256-CBC using a key * CMasterKeys are encrypted using AES-256-CBC using a key
derived using derivation method nDerivationMethod * derived using derivation method nDerivationMethod
(0 == EVP_sha512()) and derivation iterations nDeriveIterations. * (0 == EVP_sha512()) and derivation iterations nDeriveIterations.
vchOtherDerivationParameters is provided for alternative algorithms * vchOtherDerivationParameters is provided for alternative algorithms
which may require more parameters (such as scrypt). * which may require more parameters (such as scrypt).
*
Wallet Private Keys are then encrypted using AES-256-CBC * Wallet Private Keys are then encrypted using AES-256-CBC
with the double-sha256 of the public key as the IV, and the * with the double-sha256 of the public key as the IV, and the
master key's key as the encryption key (see keystore.[ch]). * master key's key as the encryption key (see keystore.[ch]).
*/ */
/** Master key for wallet encryption */ /** Master key for wallet encryption */
class CMasterKey class CMasterKey
@ -35,12 +35,12 @@ class CMasterKey
public: public:
std::vector<unsigned char> vchCryptedKey; std::vector<unsigned char> vchCryptedKey;
std::vector<unsigned char> vchSalt; std::vector<unsigned char> vchSalt;
// 0 = EVP_sha512() //! 0 = EVP_sha512()
// 1 = scrypt() //! 1 = scrypt()
unsigned int nDerivationMethod; unsigned int nDerivationMethod;
unsigned int nDeriveIterations; unsigned int nDeriveIterations;
// Use this for more parameters to key derivation, //! Use this for more parameters to key derivation,
// such as the various parameters to scrypt //! such as the various parameters to scrypt
std::vector<unsigned char> vchOtherDerivationParameters; std::vector<unsigned char> vchOtherDerivationParameters;
ADD_SERIALIZE_METHODS; ADD_SERIALIZE_METHODS;
@ -120,17 +120,17 @@ private:
CKeyingMaterial vMasterKey; CKeyingMaterial vMasterKey;
// if fUseCrypto is true, mapKeys must be empty //! if fUseCrypto is true, mapKeys must be empty
// if fUseCrypto is false, vMasterKey must be empty //! if fUseCrypto is false, vMasterKey must be empty
bool fUseCrypto; bool fUseCrypto;
// keeps track of whether Unlock has run a thourough check before //! keeps track of whether Unlock has run a thorough check before
bool fDecryptionThoroughlyChecked; bool fDecryptionThoroughlyChecked;
protected: protected:
bool SetCrypted(); bool SetCrypted();
// will encrypt previously unencrypted keys //! will encrypt previously unencrypted keys
bool EncryptKeys(CKeyingMaterial& vMasterKeyIn); bool EncryptKeys(CKeyingMaterial& vMasterKeyIn);
bool Unlock(const CKeyingMaterial& vMasterKeyIn); bool Unlock(const CKeyingMaterial& vMasterKeyIn);
@ -189,7 +189,8 @@ public:
} }
} }
/* Wallet status (encrypted, locked) changed. /**
* Wallet status (encrypted, locked) changed.
* Note: Called without locks held. * Note: Called without locks held.
*/ */
boost::signals2::signal<void (CCryptoKeyStore* wallet)> NotifyStatusChanged; boost::signals2::signal<void (CCryptoKeyStore* wallet)> NotifyStatusChanged;

View File

@ -1,6 +1,6 @@
// Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2009-2010 Satoshi Nakamoto
// Copyright (c) 2009-2013 The Bitcoin developers // Copyright (c) 2009-2014 The Bitcoin developers
// Distributed under the MIT/X11 software license, see the accompanying // Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php. // file COPYING or http://www.opensource.org/licenses/mit-license.php.
#ifndef BITCOIN_DB_H #ifndef BITCOIN_DB_H
@ -50,7 +50,7 @@ public:
void MakeMock(); void MakeMock();
bool IsMock() { return fMockDb; } bool IsMock() { return fMockDb; }
/* /**
* Verify that database file strFile is OK. If it is not, * Verify that database file strFile is OK. If it is not,
* call the callback to try to recover. * call the callback to try to recover.
* This must be called BEFORE strFile is opened. * This must be called BEFORE strFile is opened.
@ -60,7 +60,7 @@ public:
RECOVER_OK, RECOVER_OK,
RECOVER_FAIL }; RECOVER_FAIL };
VerifyResult Verify(std::string strFile, bool (*recoverFunc)(CDBEnv& dbenv, std::string strFile)); VerifyResult Verify(std::string strFile, bool (*recoverFunc)(CDBEnv& dbenv, std::string strFile));
/* /**
* Salvage data from a file that Verify says is bad. * Salvage data from a file that Verify says is bad.
* fAggressive sets the DB_AGGRESSIVE flag (see berkeley DB->verify() method documentation). * fAggressive sets the DB_AGGRESSIVE flag (see berkeley DB->verify() method documentation).
* Appends binary key/value pairs to vResult, returns true if successful. * Appends binary key/value pairs to vResult, returns true if successful.

View File

@ -13,9 +13,11 @@
namespace { namespace {
// Perform ECDSA key recovery (see SEC1 4.1.6) for curves over (mod p)-fields /**
// recid selects which key is recovered * Perform ECDSA key recovery (see SEC1 4.1.6) for curves over (mod p)-fields
// if check is non-zero, additional checks are performed * recid selects which key is recovered
* if check is non-zero, additional checks are performed
*/
int ECDSA_SIG_recover_key_GFp(EC_KEY *eckey, ECDSA_SIG *ecsig, const unsigned char *msg, int msglen, int recid, int check) int ECDSA_SIG_recover_key_GFp(EC_KEY *eckey, ECDSA_SIG *ecsig, const unsigned char *msg, int msglen, int recid, int check)
{ {
if (!eckey) return 0; if (!eckey) return 0;

View File

@ -12,7 +12,7 @@
class uint256; class uint256;
// RAII Wrapper around OpenSSL's EC_KEY /** RAII Wrapper around OpenSSL's EC_KEY */
class CECKey { class CECKey {
private: private:
EC_KEY *pkey; EC_KEY *pkey;
@ -25,10 +25,12 @@ public:
bool SetPubKey(const unsigned char* pubkey, size_t size); bool SetPubKey(const unsigned char* pubkey, size_t size);
bool Verify(const uint256 &hash, const std::vector<unsigned char>& vchSig); bool Verify(const uint256 &hash, const std::vector<unsigned char>& vchSig);
// reconstruct public key from a compact signature /**
// This is only slightly more CPU intensive than just verifying it. * reconstruct public key from a compact signature
// If this function succeeds, the recovered public key is guaranteed to be valid * This is only slightly more CPU intensive than just verifying it.
// (the signature is a valid signature of the given data for that key) * If this function succeeds, the recovered public key is guaranteed to be valid
* (the signature is a valid signature of the given data for that key)
*/
bool Recover(const uint256 &hash, const unsigned char *p64, int rec); bool Recover(const uint256 &hash, const unsigned char *p64, int rec);
bool TweakPublic(const unsigned char vchTweak[32]); bool TweakPublic(const unsigned char vchTweak[32]);

View File

@ -1,5 +1,5 @@
// Copyright (c) 2012-2013 The Bitcoin developers // Copyright (c) 2012-2014 The Bitcoin developers
// Distributed under the MIT/X11 software license, see the accompanying // Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php. // file COPYING or http://www.opensource.org/licenses/mit-license.php.
#ifndef BITCOIN_LEVELDBWRAPPER_H #ifndef BITCOIN_LEVELDBWRAPPER_H
@ -24,7 +24,7 @@ public:
void HandleError(const leveldb::Status& status) throw(leveldb_error); void HandleError(const leveldb::Status& status) throw(leveldb_error);
// Batch of changes queued to be written to a CLevelDBWrapper /** Batch of changes queued to be written to a CLevelDBWrapper */
class CLevelDBBatch class CLevelDBBatch
{ {
friend class CLevelDBWrapper; friend class CLevelDBWrapper;
@ -64,25 +64,25 @@ public:
class CLevelDBWrapper class CLevelDBWrapper
{ {
private: private:
// custom environment this database is using (may be NULL in case of default environment) //! custom environment this database is using (may be NULL in case of default environment)
leveldb::Env* penv; leveldb::Env* penv;
// database options used //! database options used
leveldb::Options options; leveldb::Options options;
// options used when reading from the database //! options used when reading from the database
leveldb::ReadOptions readoptions; leveldb::ReadOptions readoptions;
// options used when iterating over values of the database //! options used when iterating over values of the database
leveldb::ReadOptions iteroptions; leveldb::ReadOptions iteroptions;
// options used when writing to the database //! options used when writing to the database
leveldb::WriteOptions writeoptions; leveldb::WriteOptions writeoptions;
// options used when sync writing to the database //! options used when sync writing to the database
leveldb::WriteOptions syncoptions; leveldb::WriteOptions syncoptions;
// the database itself //! the database itself
leveldb::DB* pdb; leveldb::DB* pdb;
public: public:

View File

@ -1,5 +1,5 @@
// Copyright (c) 2014 The Bitcoin developers // Copyright (c) 2014 The Bitcoin developers
// Distributed under the MIT/X11 software license, see the accompanying // Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php. // file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include "timedata.h" #include "timedata.h"
@ -17,14 +17,13 @@ using namespace std;
static CCriticalSection cs_nTimeOffset; static CCriticalSection cs_nTimeOffset;
static int64_t nTimeOffset = 0; static int64_t nTimeOffset = 0;
// /**
// "Never go to sea with two chronometers; take one or three." * "Never go to sea with two chronometers; take one or three."
// Our three time sources are: * Our three time sources are:
// - System clock * - System clock
// - Median of other nodes clocks * - Median of other nodes clocks
// - The user (asking the user to fix the system clock if the first two disagree) * - The user (asking the user to fix the system clock if the first two disagree)
// */
//
int64_t GetTimeOffset() int64_t GetTimeOffset()
{ {
LOCK(cs_nTimeOffset); LOCK(cs_nTimeOffset);

View File

@ -1,5 +1,5 @@
// Copyright (c) 2014 The Bitcoin developers // Copyright (c) 2014 The Bitcoin developers
// Distributed under the MIT/X11 software license, see the accompanying // Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php. // file COPYING or http://www.opensource.org/licenses/mit-license.php.
#ifndef BITCOIN_TIMEDATA_H #ifndef BITCOIN_TIMEDATA_H
@ -12,7 +12,8 @@
class CNetAddr; class CNetAddr;
/** Median filter over a stream of values. /**
* Median filter over a stream of values.
* Returns the median of the last N numbers * Returns the median of the last N numbers
*/ */
template <typename T> template <typename T>
@ -67,7 +68,7 @@ public:
} }
}; };
/* Functions to keep track of adjusted P2P time */ /** Functions to keep track of adjusted P2P time */
int64_t GetTimeOffset(); int64_t GetTimeOffset();
int64_t GetAdjustedTime(); int64_t GetAdjustedTime();
void AddTimeData(const CNetAddr& ip, int64_t nTime); void AddTimeData(const CNetAddr& ip, int64_t nTime);

View File

@ -1,6 +1,6 @@
// Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2009-2010 Satoshi Nakamoto
// Copyright (c) 2009-2013 The Bitcoin developers // Copyright (c) 2009-2014 The Bitcoin developers
// Distributed under the MIT/X11 software license, see the accompanying // Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php. // file COPYING or http://www.opensource.org/licenses/mit-license.php.
#ifndef BITCOIN_TXDB_H #ifndef BITCOIN_TXDB_H
@ -17,11 +17,11 @@
class CCoins; class CCoins;
class uint256; class uint256;
// -dbcache default (MiB) //! -dbcache default (MiB)
static const int64_t nDefaultDbCache = 100; static const int64_t nDefaultDbCache = 100;
// max. -dbcache in (MiB) //! max. -dbcache in (MiB)
static const int64_t nMaxDbCache = sizeof(void*) > 4 ? 4096 : 1024; static const int64_t nMaxDbCache = sizeof(void*) > 4 ? 4096 : 1024;
// min. -dbcache in (MiB) //! min. -dbcache in (MiB)
static const int64_t nMinDbCache = 4; static const int64_t nMinDbCache = 4;
/** CCoinsView backed by the LevelDB coin database (chainstate/) */ /** CCoinsView backed by the LevelDB coin database (chainstate/) */

View File

@ -1,6 +1,6 @@
// Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2009-2010 Satoshi Nakamoto
// Copyright (c) 2009-2014 The Bitcoin developers // Copyright (c) 2009-2014 The Bitcoin developers
// Distributed under the MIT/X11 software license, see the accompanying // Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php. // file COPYING or http://www.opensource.org/licenses/mit-license.php.
#ifndef BITCOIN_UINT256_H #ifndef BITCOIN_UINT256_H
@ -255,8 +255,10 @@ public:
return sizeof(pn); return sizeof(pn);
} }
// Returns the position of the highest bit set plus one, or zero if the /**
// value is zero. * Returns the position of the highest bit set plus one, or zero if the
* value is zero.
*/
unsigned int bits() const; unsigned int bits() const;
uint64_t GetLow64() const uint64_t GetLow64() const
@ -301,26 +303,27 @@ public:
uint256(uint64_t b) : base_uint<256>(b) {} uint256(uint64_t b) : base_uint<256>(b) {}
explicit uint256(const std::string& str) : base_uint<256>(str) {} explicit uint256(const std::string& str) : base_uint<256>(str) {}
explicit uint256(const std::vector<unsigned char>& vch) : base_uint<256>(vch) {} explicit uint256(const std::vector<unsigned char>& vch) : base_uint<256>(vch) {}
// The "compact" format is a representation of a whole /**
// number N using an unsigned 32bit number similar to a * The "compact" format is a representation of a whole
// floating point format. * number N using an unsigned 32bit number similar to a
// The most significant 8 bits are the unsigned exponent of base 256. * floating point format.
// This exponent can be thought of as "number of bytes of N". * The most significant 8 bits are the unsigned exponent of base 256.
// The lower 23 bits are the mantissa. * This exponent can be thought of as "number of bytes of N".
// Bit number 24 (0x800000) represents the sign of N. * The lower 23 bits are the mantissa.
// N = (-1^sign) * mantissa * 256^(exponent-3) * Bit number 24 (0x800000) represents the sign of N.
// * N = (-1^sign) * mantissa * 256^(exponent-3)
// Satoshi's original implementation used BN_bn2mpi() and BN_mpi2bn(). *
// MPI uses the most significant bit of the first byte as sign. * Satoshi's original implementation used BN_bn2mpi() and BN_mpi2bn().
// Thus 0x1234560000 is compact (0x05123456) * MPI uses the most significant bit of the first byte as sign.
// and 0xc0de000000 is compact (0x0600c0de) * Thus 0x1234560000 is compact (0x05123456)
// (0x05c0de00) would be -0x40de000000 * and 0xc0de000000 is compact (0x0600c0de)
// *
// Bitcoin only uses this "compact" format for encoding difficulty * Bitcoin only uses this "compact" format for encoding difficulty
// targets, which are unsigned 256bit quantities. Thus, all the * targets, which are unsigned 256bit quantities. Thus, all the
// complexities of the sign bit and using base 256 are probably an * complexities of the sign bit and using base 256 are probably an
// implementation accident. * implementation accident.
*/
uint256& SetCompact(uint32_t nCompact, bool *pfNegative = NULL, bool *pfOverflow = NULL); uint256& SetCompact(uint32_t nCompact, bool *pfNegative = NULL, bool *pfOverflow = NULL);
uint32_t GetCompact(bool fNegative = false) const; uint32_t GetCompact(bool fNegative = false) const;