aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xshare/seeds/generate-seeds.py13
-rw-r--r--src/chain.cpp5
-rw-r--r--src/chain.h75
-rw-r--r--src/chainparams.cpp91
-rw-r--r--src/chainparams.h40
-rw-r--r--src/chainparamsbase.cpp27
-rw-r--r--src/chainparamsbase.h2
-rw-r--r--src/chainparamsseeds.h11
-rw-r--r--src/key.cpp8
-rw-r--r--src/key.h139
-rw-r--r--src/keystore.cpp4
-rw-r--r--src/keystore.h12
-rw-r--r--src/qt/bitcoingui.cpp24
-rw-r--r--src/qt/bitcoingui.h6
14 files changed, 246 insertions, 211 deletions
diff --git a/share/seeds/generate-seeds.py b/share/seeds/generate-seeds.py
index 6c1b4ed860..5f06740560 100755
--- a/share/seeds/generate-seeds.py
+++ b/share/seeds/generate-seeds.py
@@ -1,6 +1,6 @@
#!/usr/bin/python
# Copyright (c) 2014 Wladmir J. van der Laan
-# 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.
'''
Script to generate list of seed nodes for chainparams.cpp.
@@ -116,10 +116,13 @@ def main():
indir = sys.argv[1]
g.write('#ifndef H_CHAINPARAMSSEEDS\n')
g.write('#define H_CHAINPARAMSSEEDS\n')
- g.write('// List of fixed seed nodes for the bitcoin network\n')
- g.write('// AUTOGENERATED by contrib/devtools/generate-seeds.py\n\n')
- g.write('// Each line contains a 16-byte IPv6 address and a port.\n')
- g.write('// IPv4 as well as onion addresses are wrapped inside a IPv6 address accordingly.\n')
+ g.write('/**\n')
+ g.write(' * List of fixed seed nodes for the bitcoin network\n')
+ g.write(' * AUTOGENERATED by share/seeds/generate-seeds.py\n')
+ g.write(' *\n')
+ g.write(' * Each line contains a 16-byte IPv6 address and a port.\n')
+ g.write(' * IPv4 as well as onion addresses are wrapped inside a IPv6 address accordingly.\n')
+ g.write(' */\n')
with open(os.path.join(indir,'nodes_main.txt'),'r') as f:
process_nodes(g, f, 'pnSeed6_main', 8333)
g.write('\n')
diff --git a/src/chain.cpp b/src/chain.cpp
index 56ed22ce71..e13c047861 100644
--- a/src/chain.cpp
+++ b/src/chain.cpp
@@ -7,8 +7,9 @@
using namespace std;
-// CChain implementation
-
+/**
+ * CChain implementation
+ */
void CChain::SetTip(CBlockIndex *pindex) {
if (pindex == NULL) {
vChain.clear();
diff --git a/src/chain.h b/src/chain.h
index 2a55771622..7c5603dafc 100644
--- a/src/chain.h
+++ b/src/chain.h
@@ -50,38 +50,40 @@ struct CDiskBlockPos
};
enum BlockStatus {
- // Unused.
+ //! Unused.
BLOCK_VALID_UNKNOWN = 0,
- // Parsed, version ok, hash satisfies claimed PoW, 1 <= vtx count <= max, timestamp not in future
+ //! Parsed, version ok, hash satisfies claimed PoW, 1 <= vtx count <= max, timestamp not in future
BLOCK_VALID_HEADER = 1,
- // All parent headers found, difficulty matches, timestamp >= median previous, checkpoint. Implies all parents
- // are also at least TREE.
+ //! All parent headers found, difficulty matches, timestamp >= median previous, checkpoint. Implies all parents
+ //! are also at least TREE.
BLOCK_VALID_TREE = 2,
- // Only first tx is coinbase, 2 <= coinbase input script length <= 100, transactions valid, no duplicate txids,
- // sigops, size, merkle root. Implies all parents are at least TREE but not necessarily TRANSACTIONS. When all
- // parent blocks also have TRANSACTIONS, CBlockIndex::nChainTx will be set.
+ /**
+ * Only first tx is coinbase, 2 <= coinbase input script length <= 100, transactions valid, no duplicate txids,
+ * sigops, size, merkle root. Implies all parents are at least TREE but not necessarily TRANSACTIONS. When all
+ * parent blocks also have TRANSACTIONS, CBlockIndex::nChainTx will be set.
+ */
BLOCK_VALID_TRANSACTIONS = 3,
- // Outputs do not overspend inputs, no double spends, coinbase output ok, immature coinbase spends, BIP30.
- // Implies all parents are also at least CHAIN.
+ //! Outputs do not overspend inputs, no double spends, coinbase output ok, immature coinbase spends, BIP30.
+ //! Implies all parents are also at least CHAIN.
BLOCK_VALID_CHAIN = 4,
- // Scripts & signatures ok. Implies all parents are also at least SCRIPTS.
+ //! Scripts & signatures ok. Implies all parents are also at least SCRIPTS.
BLOCK_VALID_SCRIPTS = 5,
- // All validity bits.
+ //! All validity bits.
BLOCK_VALID_MASK = BLOCK_VALID_HEADER | BLOCK_VALID_TREE | BLOCK_VALID_TRANSACTIONS |
BLOCK_VALID_CHAIN | BLOCK_VALID_SCRIPTS,
- BLOCK_HAVE_DATA = 8, // full block available in blk*.dat
- BLOCK_HAVE_UNDO = 16, // undo data available in rev*.dat
+ BLOCK_HAVE_DATA = 8, //! full block available in blk*.dat
+ BLOCK_HAVE_UNDO = 16, //! undo data available in rev*.dat
BLOCK_HAVE_MASK = BLOCK_HAVE_DATA | BLOCK_HAVE_UNDO,
- BLOCK_FAILED_VALID = 32, // stage after last reached validness failed
- BLOCK_FAILED_CHILD = 64, // descends from failed block
+ BLOCK_FAILED_VALID = 32, //! stage after last reached validness failed
+ BLOCK_FAILED_CHILD = 64, //! descends from failed block
BLOCK_FAILED_MASK = BLOCK_FAILED_VALID | BLOCK_FAILED_CHILD,
};
@@ -93,49 +95,50 @@ enum BlockStatus {
class CBlockIndex
{
public:
- // pointer to the hash of the block, if any. memory is owned by this CBlockIndex
+ //! pointer to the hash of the block, if any. memory is owned by this CBlockIndex
const uint256* phashBlock;
- // pointer to the index of the predecessor of this block
+ //! pointer to the index of the predecessor of this block
CBlockIndex* pprev;
- // pointer to the index of some further predecessor of this block
+ //! pointer to the index of some further predecessor of this block
CBlockIndex* pskip;
- // height of the entry in the chain. The genesis block has height 0
+ //! height of the entry in the chain. The genesis block has height 0
int nHeight;
- // Which # file this block is stored in (blk?????.dat)
+ //! Which # file this block is stored in (blk?????.dat)
int nFile;
- // Byte offset within blk?????.dat where this block's data is stored
+ //! Byte offset within blk?????.dat where this block's data is stored
unsigned int nDataPos;
- // Byte offset within rev?????.dat where this block's undo data is stored
+ //! Byte offset within rev?????.dat where this block's undo data is stored
unsigned int nUndoPos;
- // (memory only) Total amount of work (expected number of hashes) in the chain up to and including this block
+ //! (memory only) Total amount of work (expected number of hashes) in the chain up to and including this block
uint256 nChainWork;
- // Number of transactions in this block.
- // Note: in a potential headers-first mode, this number cannot be relied upon
+ //! Number of transactions in this block.
+ //! Note: in a potential headers-first mode, this number cannot be relied upon
unsigned int nTx;
- // (memory only) Number of transactions in the chain up to and including this block.
- // This value will be non-zero only if and only if transactions for this block and all its parents are available.
- unsigned int nChainTx; // change to 64-bit type when necessary; won't happen before 2030
+ //! (memory only) Number of transactions in the chain up to and including this block.
+ //! This value will be non-zero only if and only if transactions for this block and all its parents are available.
+ //! Change to 64-bit type when necessary; won't happen before 2030
+ unsigned int nChainTx;
- // Verification status of this block. See enum BlockStatus
+ //! Verification status of this block. See enum BlockStatus
unsigned int nStatus;
- // block header
+ //! block header
int nVersion;
uint256 hashMerkleRoot;
unsigned int nTime;
unsigned int nBits;
unsigned int nNonce;
- // (memory only) Sequencial id assigned to distinguish order in which blocks are received.
+ //! (memory only) Sequential id assigned to distinguish order in which blocks are received.
uint32_t nSequenceId;
void SetNull()
@@ -254,7 +257,7 @@ public:
GetBlockHash().ToString());
}
- // Check whether this block index entry is valid up to the passed validity level.
+ //! Check whether this block index entry is valid up to the passed validity level.
bool IsValid(enum BlockStatus nUpTo = BLOCK_VALID_TRANSACTIONS) const
{
assert(!(nUpTo & ~BLOCK_VALID_MASK)); // Only validity flags allowed.
@@ -263,8 +266,8 @@ public:
return ((nStatus & BLOCK_VALID_MASK) >= nUpTo);
}
- // Raise the validity level of this block index entry.
- // Returns true if the validity was changed.
+ //! Raise the validity level of this block index entry.
+ //! Returns true if the validity was changed.
bool RaiseValidity(enum BlockStatus nUpTo)
{
assert(!(nUpTo & ~BLOCK_VALID_MASK)); // Only validity flags allowed.
@@ -277,10 +280,10 @@ public:
return false;
}
- // Build the skiplist pointer for this entry.
+ //! Build the skiplist pointer for this entry.
void BuildSkip();
- // Efficiently find an ancestor of this block.
+ //! Efficiently find an ancestor of this block.
CBlockIndex* GetAncestor(int height);
const CBlockIndex* GetAncestor(int height) const;
};
diff --git a/src/chainparams.cpp b/src/chainparams.cpp
index 1ab292517a..9ffc369b40 100644
--- a/src/chainparams.cpp
+++ b/src/chainparams.cpp
@@ -1,6 +1,6 @@
// Copyright (c) 2010 Satoshi Nakamoto
// 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.
#include "chainparams.h"
@@ -23,11 +23,11 @@ struct SeedSpec6 {
#include "chainparamsseeds.h"
-//
-// Main network
-//
+/**
+ * Main network
+ */
-// Convert the pnSeeds6 array into usable address objects.
+//! Convert the pnSeeds6 array into usable address objects.
static void convertSeed6(std::vector<CAddress> &vSeedsOut, const SeedSpec6 *data, unsigned int count)
{
// It'll only connect to one or two seed nodes because once it connects,
@@ -45,11 +45,13 @@ static void convertSeed6(std::vector<CAddress> &vSeedsOut, const SeedSpec6 *data
}
}
- // What makes a good checkpoint block?
- // + Is surrounded by blocks with reasonable timestamps
- // (no blocks before with a timestamp after, none after with
- // timestamp before)
- // + Contains no strange transactions
+/**
+ * What makes a good checkpoint block?
+ * + Is surrounded by blocks with reasonable timestamps
+ * (no blocks before with a timestamp after, none after with
+ * timestamp before)
+ * + Contains no strange transactions
+ */
static Checkpoints::MapCheckpoints mapCheckpoints =
boost::assign::map_list_of
( 11111, uint256("0x0000000069e244f73d78e8fd29ba2fd2ed618bd6fa2ee92559f542fdb26e7c1d"))
@@ -101,9 +103,11 @@ public:
CMainParams() {
networkID = CBaseChainParams::MAIN;
strNetworkID = "main";
- // The message start string is designed to be unlikely to occur in normal data.
- // The characters are rarely used upper ASCII, not valid as UTF-8, and produce
- // a large 4-byte int at any alignment.
+ /**
+ * The message start string is designed to be unlikely to occur in normal data.
+ * The characters are rarely used upper ASCII, not valid as UTF-8, and produce
+ * a large 4-byte int at any alignment.
+ */
pchMessageStart[0] = 0xf9;
pchMessageStart[1] = 0xbe;
pchMessageStart[2] = 0xb4;
@@ -119,14 +123,16 @@ public:
nTargetTimespan = 14 * 24 * 60 * 60; // two weeks
nTargetSpacing = 10 * 60;
- // Build the genesis block. Note that the output of the genesis coinbase cannot
- // be spent as it did not originally exist in the database.
- //
- // CBlock(hash=000000000019d6, ver=1, hashPrevBlock=00000000000000, hashMerkleRoot=4a5e1e, nTime=1231006505, nBits=1d00ffff, nNonce=2083236893, vtx=1)
- // CTransaction(hash=4a5e1e, ver=1, vin.size=1, vout.size=1, nLockTime=0)
- // CTxIn(COutPoint(000000, -1), coinbase 04ffff001d0104455468652054696d65732030332f4a616e2f32303039204368616e63656c6c6f72206f6e206272696e6b206f66207365636f6e64206261696c6f757420666f722062616e6b73)
- // CTxOut(nValue=50.00000000, scriptPubKey=0x5F1DF16B2B704C8A578D0B)
- // vMerkleTree: 4a5e1e
+ /**
+ * Build the genesis block. Note that the output of the genesis coinbase cannot
+ * be spent as it did not originally exist in the database.
+ *
+ * CBlock(hash=000000000019d6, ver=1, hashPrevBlock=00000000000000, hashMerkleRoot=4a5e1e, nTime=1231006505, nBits=1d00ffff, nNonce=2083236893, vtx=1)
+ * CTransaction(hash=4a5e1e, ver=1, vin.size=1, vout.size=1, nLockTime=0)
+ * CTxIn(COutPoint(000000, -1), coinbase 04ffff001d0104455468652054696d65732030332f4a616e2f32303039204368616e63656c6c6f72206f6e206272696e6b206f66207365636f6e64206261696c6f757420666f722062616e6b73)
+ * CTxOut(nValue=50.00000000, scriptPubKey=0x5F1DF16B2B704C8A578D0B)
+ * vMerkleTree: 4a5e1e
+ */
const char* pszTimestamp = "The Times 03/Jan/2009 Chancellor on brink of second bailout for banks";
CMutableTransaction txNew;
txNew.vin.resize(1);
@@ -178,18 +184,19 @@ public:
};
static CMainParams mainParams;
-//
-// Testnet (v3)
-//
-
+/**
+ * Testnet (v3)
+ */
class CTestNetParams : public CMainParams {
public:
CTestNetParams() {
networkID = CBaseChainParams::TESTNET;
strNetworkID = "test";
- // The message start string is designed to be unlikely to occur in normal data.
- // The characters are rarely used upper ASCII, not valid as UTF-8, and produce
- // a large 4-byte int at any alignment.
+ /**
+ * The message start string is designed to be unlikely to occur in normal data.
+ * The characters are rarely used upper ASCII, not valid as UTF-8, and produce
+ * a large 4-byte int at any alignment.
+ */
pchMessageStart[0] = 0x0b;
pchMessageStart[1] = 0x11;
pchMessageStart[2] = 0x09;
@@ -200,10 +207,10 @@ public:
nRejectBlockOutdatedMajority = 75;
nToCheckBlockUpgradeMajority = 100;
nMinerThreads = 0;
- nTargetTimespan = 14 * 24 * 60 * 60; // two weeks
+ nTargetTimespan = 14 * 24 * 60 * 60; //! two weeks
nTargetSpacing = 10 * 60;
- // Modify the testnet genesis block so the timestamp is valid for a later start.
+ //! Modify the testnet genesis block so the timestamp is valid for a later start.
genesis.nTime = 1296688602;
genesis.nNonce = 414098458;
hashGenesisBlock = genesis.GetHash();
@@ -239,9 +246,9 @@ public:
};
static CTestNetParams testNetParams;
-//
-// Regression test
-//
+/**
+ * Regression test
+ */
class CRegTestParams : public CTestNetParams {
public:
CRegTestParams() {
@@ -256,7 +263,7 @@ public:
nRejectBlockOutdatedMajority = 950;
nToCheckBlockUpgradeMajority = 1000;
nMinerThreads = 1;
- nTargetTimespan = 14 * 24 * 60 * 60; // two weeks
+ nTargetTimespan = 14 * 24 * 60 * 60; //! two weeks
nTargetSpacing = 10 * 60;
bnProofOfWorkLimit = ~uint256(0) >> 1;
genesis.nTime = 1296688602;
@@ -266,8 +273,8 @@ public:
nDefaultPort = 18444;
assert(hashGenesisBlock == uint256("0x0f9188f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e2206"));
- vFixedSeeds.clear(); // Regtest mode doesn't have any fixed seeds.
- vSeeds.clear(); // Regtest mode doesn't have any DNS seeds.
+ vFixedSeeds.clear(); //! Regtest mode doesn't have any fixed seeds.
+ vSeeds.clear(); //! Regtest mode doesn't have any DNS seeds.
fRequireRPCPassword = false;
fMiningRequiresPeers = false;
@@ -284,17 +291,17 @@ public:
};
static CRegTestParams regTestParams;
-//
-// Unit test
-//
+/**
+ * Unit test
+ */
class CUnitTestParams : public CMainParams, public CModifiableParams {
public:
CUnitTestParams() {
networkID = CBaseChainParams::UNITTEST;
strNetworkID = "unittest";
nDefaultPort = 18445;
- vFixedSeeds.clear();
- vSeeds.clear(); // Regtest mode doesn't have any DNS seeds.
+ vFixedSeeds.clear(); //! Unit test mode doesn't have any fixed seeds.
+ vSeeds.clear(); //! Unit test mode doesn't have any DNS seeds.
fRequireRPCPassword = false;
fMiningRequiresPeers = false;
@@ -309,7 +316,7 @@ public:
return data;
}
- // Published setters to allow changing values in unit test cases
+ //! Published setters to allow changing values in unit test cases
virtual void setSubsidyHalvingInterval(int anSubsidyHalvingInterval) { nSubsidyHalvingInterval=anSubsidyHalvingInterval; }
virtual void setEnforceBlockUpgradeMajority(int anEnforceBlockUpgradeMajority) { nEnforceBlockUpgradeMajority=anEnforceBlockUpgradeMajority; }
virtual void setRejectBlockOutdatedMajority(int anRejectBlockOutdatedMajority) { nRejectBlockOutdatedMajority=anRejectBlockOutdatedMajority; }
diff --git a/src/chainparams.h b/src/chainparams.h
index e27728dbd5..9279edd6c0 100644
--- a/src/chainparams.h
+++ b/src/chainparams.h
@@ -1,6 +1,6 @@
// Copyright (c) 2009-2010 Satoshi Nakamoto
-// Copyright (c) 2009-2013 The Bitcoin developers
-// Distributed under the MIT/X11 software license, see the accompanying
+// Copyright (c) 2009-2014 The Bitcoin developers
+// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#ifndef BITCOIN_CHAIN_PARAMS_H
@@ -47,34 +47,33 @@ public:
int GetDefaultPort() const { return nDefaultPort; }
const uint256& ProofOfWorkLimit() const { return bnProofOfWorkLimit; }
int SubsidyHalvingInterval() const { return nSubsidyHalvingInterval; }
- /* Used to check majorities for block version upgrade */
+ /** Used to check majorities for block version upgrade */
int EnforceBlockUpgradeMajority() const { return nEnforceBlockUpgradeMajority; }
int RejectBlockOutdatedMajority() const { return nRejectBlockOutdatedMajority; }
int ToCheckBlockUpgradeMajority() const { return nToCheckBlockUpgradeMajority; }
- /* Used if GenerateBitcoins is called with a negative number of threads */
+ /** Used if GenerateBitcoins is called with a negative number of threads */
int DefaultMinerThreads() const { return nMinerThreads; }
const CBlock& GenesisBlock() const { return genesis; }
bool RequireRPCPassword() const { return fRequireRPCPassword; }
- /* Make miner wait to have peers to avoid wasting work */
+ /** Make miner wait to have peers to avoid wasting work */
bool MiningRequiresPeers() const { return fMiningRequiresPeers; }
- /* Default value for -checkmempool argument */
+ /** Default value for -checkmempool argument */
bool DefaultCheckMemPool() const { return fDefaultCheckMemPool; }
- /* Allow mining of a min-difficulty block */
+ /** Allow mining of a min-difficulty block */
bool AllowMinDifficultyBlocks() const { return fAllowMinDifficultyBlocks; }
- /* Skip proof-of-work check: allow mining of any difficulty block */
+ /** Skip proof-of-work check: allow mining of any difficulty block */
bool SkipProofOfWorkCheck() const { return fSkipProofOfWorkCheck; }
- /* Make standard checks */
+ /** Make standard checks */
bool RequireStandard() const { return fRequireStandard; }
int64_t TargetTimespan() const { return nTargetTimespan; }
int64_t TargetSpacing() const { return nTargetSpacing; }
int64_t Interval() const { return nTargetTimespan / nTargetSpacing; }
- /* Make miner stop after a block is found. In RPC, don't return
- * until nGenProcLimit blocks are generated */
+ /** Make miner stop after a block is found. In RPC, don't return until nGenProcLimit blocks are generated */
bool MineBlocksOnDemand() const { return fMineBlocksOnDemand; }
- /* In the future use NetworkIDString() for RPC fields */
+ /** In the future use NetworkIDString() for RPC fields */
bool TestnetToBeDeprecatedFieldRPC() const { return fTestnetToBeDeprecatedFieldRPC; }
- /* Return the BIP70 network string (main, test or regtest) */
+ /** Return the BIP70 network string (main, test or regtest) */
std::string NetworkIDString() const { return strNetworkID; }
const std::vector<CDNSSeedData>& DNSSeeds() const { return vSeeds; }
const std::vector<unsigned char>& Base58Prefix(Base58Type type) const { return base58Prefixes[type]; }
@@ -85,7 +84,7 @@ protected:
uint256 hashGenesisBlock;
MessageStartChars pchMessageStart;
- // Raw pub key bytes for the broadcast alert signing key.
+ //! Raw pub key bytes for the broadcast alert signing key.
std::vector<unsigned char> vAlertPubKey;
int nDefaultPort;
uint256 bnProofOfWorkLimit;
@@ -112,14 +111,15 @@ protected:
bool fTestnetToBeDeprecatedFieldRPC;
};
-/** Modifiable parameters interface is used by test cases to adapt the parameters in order
-*** to test specific features more easily. Test cases should always restore the previous
-*** values after finalization.
-**/
+/**
+ * Modifiable parameters interface is used by test cases to adapt the parameters in order
+ * to test specific features more easily. Test cases should always restore the previous
+ * values after finalization.
+ */
class CModifiableParams {
public:
- // Published setters to allow changing values in unit test cases
+ //! Published setters to allow changing values in unit test cases
virtual void setSubsidyHalvingInterval(int anSubsidyHalvingInterval) =0;
virtual void setEnforceBlockUpgradeMajority(int anEnforceBlockUpgradeMajority)=0;
virtual void setRejectBlockOutdatedMajority(int anRejectBlockOutdatedMajority)=0;
@@ -139,7 +139,7 @@ const CChainParams &Params();
/** Return parameters for the given network. */
CChainParams &Params(CBaseChainParams::Network network);
-/** Get modifyable network parameters (UNITTEST only) */
+/** Get modifiable network parameters (UNITTEST only) */
CModifiableParams *ModifiableParams();
/** Sets the params returned by Params() to those for the given network. */
diff --git a/src/chainparamsbase.cpp b/src/chainparamsbase.cpp
index 5d9ec7927b..8646a31603 100644
--- a/src/chainparamsbase.cpp
+++ b/src/chainparamsbase.cpp
@@ -1,6 +1,6 @@
// Copyright (c) 2010 Satoshi Nakamoto
// 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.
#include "chainparamsbase.h"
@@ -13,10 +13,9 @@
using namespace boost::assign;
-//
-// Main network
-//
-
+/**
+ * Main network
+ */
class CBaseMainParams : public CBaseChainParams
{
public:
@@ -28,9 +27,9 @@ public:
};
static CBaseMainParams mainParams;
-//
-// Testnet (v3)
-//
+/**
+ * Testnet (v3)
+ */
class CBaseTestNetParams : public CBaseMainParams
{
public:
@@ -43,9 +42,9 @@ public:
};
static CBaseTestNetParams testNetParams;
-//
-// Regression test
-//
+/*
+ * Regression test
+ */
class CBaseRegTestParams : public CBaseTestNetParams
{
public:
@@ -57,9 +56,9 @@ public:
};
static CBaseRegTestParams regTestParams;
-//
-// Unit test
-//
+/*
+ * Unit test
+ */
class CBaseUnitTestParams : public CBaseMainParams
{
public:
diff --git a/src/chainparamsbase.h b/src/chainparamsbase.h
index 911d1181ac..4042b8c879 100644
--- a/src/chainparamsbase.h
+++ b/src/chainparamsbase.h
@@ -1,5 +1,5 @@
// 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.
#ifndef BITCOIN_CHAIN_PARAMS_BASE_H
diff --git a/src/chainparamsseeds.h b/src/chainparamsseeds.h
index 3f3278361e..c3323c48bd 100644
--- a/src/chainparamsseeds.h
+++ b/src/chainparamsseeds.h
@@ -1,10 +1,13 @@
#ifndef H_CHAINPARAMSSEEDS
#define H_CHAINPARAMSSEEDS
-// List of fixed seed nodes for the bitcoin network
-// AUTOGENERATED by contrib/devtools/generate-seeds.py
-// Each line contains a 16-byte IPv6 address and a port.
-// IPv4 as well as onion addresses are wrapped inside a IPv6 address accordingly.
+/**
+ * List of fixed seed nodes for the bitcoin network
+ * AUTOGENERATED by contrib/devtools/generate-seeds.py
+ *
+ * Each line contains a 16-byte IPv6 address and a port.
+ * IPv4 as well as onion addresses are wrapped inside a IPv6 address accordingly.
+ */
static SeedSpec6 pnSeed6_main[] = {
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x2e,0x69,0x6a,0x7e}, 8333},
{{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xa2,0xd1,0x04,0x7d}, 8333},
diff --git a/src/key.cpp b/src/key.cpp
index 0f4bc6652c..c466e84f26 100644
--- a/src/key.cpp
+++ b/src/key.cpp
@@ -1,5 +1,5 @@
// 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.
#include "key.h"
@@ -13,7 +13,7 @@
#include "ecwrapper.h"
#endif
-// anonymous namespace
+//! anonymous namespace
namespace {
#ifdef USE_SECP256K1
@@ -56,7 +56,7 @@ int CompareBigEndian(const unsigned char *c1, size_t c1len, const unsigned char
return 0;
}
-// Order of secp256k1's generator minus 1.
+/** Order of secp256k1's generator minus 1. */
const unsigned char vchMaxModOrder[32] = {
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFE,
@@ -64,7 +64,7 @@ const unsigned char vchMaxModOrder[32] = {
0xBF,0xD2,0x5E,0x8C,0xD0,0x36,0x41,0x40
};
-// Half of the order of secp256k1's generator minus 1.
+/** Half of the order of secp256k1's generator minus 1. */
const unsigned char vchMaxModHalfOrder[32] = {
0x7F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
diff --git a/src/key.h b/src/key.h
index 48b1652536..b4cb647681 100644
--- a/src/key.h
+++ b/src/key.h
@@ -1,6 +1,6 @@
// Copyright (c) 2009-2010 Satoshi Nakamoto
-// Copyright (c) 2009-2013 The Bitcoin developers
-// Distributed under the MIT/X11 software license, see the accompanying
+// Copyright (c) 2009-2014 The Bitcoin developers
+// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#ifndef BITCOIN_KEY_H
@@ -14,13 +14,15 @@
#include <stdexcept>
#include <vector>
-// secp256k1:
-// const unsigned int PRIVATE_KEY_SIZE = 279;
-// const unsigned int PUBLIC_KEY_SIZE = 65;
-// const unsigned int SIGNATURE_SIZE = 72;
-//
-// see www.keylength.com
-// script supports up to 75 for single byte push
+/**
+ * secp256k1:
+ * const unsigned int PRIVATE_KEY_SIZE = 279;
+ * const unsigned int PUBLIC_KEY_SIZE = 65;
+ * const unsigned int SIGNATURE_SIZE = 72;
+ *
+ * see www.keylength.com
+ * script supports up to 75 for single byte push
+ */
/** A reference to a CKey: the Hash160 of its serialized public key */
class CKeyID : public uint160
@@ -34,11 +36,14 @@ public:
class CPubKey
{
private:
- // Just store the serialized data.
- // Its length can very cheaply be computed from the first byte.
+
+ /**
+ * Just store the serialized data.
+ * Its length can very cheaply be computed from the first byte.
+ */
unsigned char vch[65];
- // Compute the length of a pubkey with a given first byte.
+ //! Compute the length of a pubkey with a given first byte.
unsigned int static GetLen(unsigned char chHeader)
{
if (chHeader == 2 || chHeader == 3)
@@ -48,20 +53,20 @@ private:
return 0;
}
- // Set this key data to be invalid
+ //! Set this key data to be invalid
void Invalidate()
{
vch[0] = 0xFF;
}
public:
- // Construct an invalid public key.
+ //! Construct an invalid public key.
CPubKey()
{
Invalidate();
}
- // Initialize a public key using begin/end iterators to byte data.
+ //! Initialize a public key using begin/end iterators to byte data.
template <typename T>
void Set(const T pbegin, const T pend)
{
@@ -72,26 +77,26 @@ public:
Invalidate();
}
- // Construct a public key using begin/end iterators to byte data.
+ //! Construct a public key using begin/end iterators to byte data.
template <typename T>
CPubKey(const T pbegin, const T pend)
{
Set(pbegin, pend);
}
- // Construct a public key from a byte vector.
+ //! Construct a public key from a byte vector.
CPubKey(const std::vector<unsigned char>& vch)
{
Set(vch.begin(), vch.end());
}
- // Simple read-only vector-like interface to the pubkey data.
+ //! Simple read-only vector-like interface to the pubkey data.
unsigned int size() const { return GetLen(vch[0]); }
const unsigned char* begin() const { return vch; }
const unsigned char* end() const { return vch + size(); }
const unsigned char& operator[](unsigned int pos) const { return vch[pos]; }
- // Comparator implementation.
+ //! Comparator implementation.
friend bool operator==(const CPubKey& a, const CPubKey& b)
{
return a.vch[0] == b.vch[0] &&
@@ -107,7 +112,7 @@ public:
(a.vch[0] == b.vch[0] && memcmp(a.vch, b.vch, a.size()) < 0);
}
- // Implement serialization, as if this was a byte vector.
+ //! Implement serialization, as if this was a byte vector.
unsigned int GetSerializeSize(int nType, int nVersion) const
{
return size() + 1;
@@ -134,86 +139,92 @@ public:
}
}
- // Get the KeyID of this public key (hash of its serialization)
+ //! Get the KeyID of this public key (hash of its serialization)
CKeyID GetID() const
{
return CKeyID(Hash160(vch, vch + size()));
}
- // Get the 256-bit hash of this public key.
+ //! Get the 256-bit hash of this public key.
uint256 GetHash() const
{
return Hash(vch, vch + size());
}
- // Check syntactic correctness.
- //
- // Note that this is consensus critical as CheckSig() calls it!
+ /*
+ * Check syntactic correctness.
+ *
+ * Note that this is consensus critical as CheckSig() calls it!
+ */
bool IsValid() const
{
return size() > 0;
}
- // fully validate whether this is a valid public key (more expensive than IsValid())
+ //! fully validate whether this is a valid public key (more expensive than IsValid())
bool IsFullyValid() const;
- // Check whether this is a compressed public key.
+ //! Check whether this is a compressed public key.
bool IsCompressed() const
{
return size() == 33;
}
- // Verify a DER signature (~72 bytes).
- // If this public key is not fully valid, the return value will be false.
+ /**
+ * Verify a DER signature (~72 bytes).
+ * If this public key is not fully valid, the return value will be false.
+ */
bool Verify(const uint256& hash, const std::vector<unsigned char>& vchSig) const;
- // Recover a public key from a compact signature.
+ //! Recover a public key from a compact signature.
bool RecoverCompact(const uint256& hash, const std::vector<unsigned char>& vchSig);
- // Turn this public key into an uncompressed public key.
+ //! Turn this public key into an uncompressed public key.
bool Decompress();
- // Derive BIP32 child pubkey.
+ //! Derive BIP32 child pubkey.
bool Derive(CPubKey& pubkeyChild, unsigned char ccChild[32], unsigned int nChild, const unsigned char cc[32]) const;
};
-// secure_allocator is defined in allocators.h
-// CPrivKey is a serialized private key, with all parameters included (279 bytes)
+/**
+ * secure_allocator is defined in allocators.h
+ * CPrivKey is a serialized private key, with all parameters included (279 bytes)
+ */
typedef std::vector<unsigned char, secure_allocator<unsigned char> > CPrivKey;
/** An encapsulated private key. */
class CKey
{
private:
- // Whether this private key is valid. We check for correctness when modifying the key
- // data, so fValid should always correspond to the actual state.
+ //! Whether this private key is valid. We check for correctness when modifying the key
+ //! data, so fValid should always correspond to the actual state.
bool fValid;
- // Whether the public key corresponding to this private key is (to be) compressed.
+ //! Whether the public key corresponding to this private key is (to be) compressed.
bool fCompressed;
- // The actual byte data
+ //! The actual byte data
unsigned char vch[32];
- // Check whether the 32-byte array pointed to be vch is valid keydata.
+ //! Check whether the 32-byte array pointed to be vch is valid keydata.
bool static Check(const unsigned char* vch);
public:
- // Construct an invalid private key.
+ //! Construct an invalid private key.
CKey() : fValid(false), fCompressed(false)
{
LockObject(vch);
}
- // Copy constructor. This is necessary because of memlocking.
+ //! Copy constructor. This is necessary because of memlocking.
CKey(const CKey& secret) : fValid(secret.fValid), fCompressed(secret.fCompressed)
{
LockObject(vch);
memcpy(vch, secret.vch, sizeof(vch));
}
- // Destructor (again necessary because of memlocking).
+ //! Destructor (again necessary because of memlocking).
~CKey()
{
UnlockObject(vch);
@@ -225,7 +236,7 @@ public:
memcmp(&a.vch[0], &b.vch[0], a.size()) == 0;
}
- // Initialize using begin and end iterators to byte data.
+ //! Initialize using begin and end iterators to byte data.
template <typename T>
void Set(const T pbegin, const T pend, bool fCompressedIn)
{
@@ -242,48 +253,54 @@ public:
}
}
- // Simple read-only vector-like interface.
+ //! Simple read-only vector-like interface.
unsigned int size() const { return (fValid ? 32 : 0); }
const unsigned char* begin() const { return vch; }
const unsigned char* end() const { return vch + size(); }
- // Check whether this private key is valid.
+ //! Check whether this private key is valid.
bool IsValid() const { return fValid; }
- // Check whether the public key corresponding to this private key is (to be) compressed.
+ //! Check whether the public key corresponding to this private key is (to be) compressed.
bool IsCompressed() const { return fCompressed; }
- // Initialize from a CPrivKey (serialized OpenSSL private key data).
+ //! Initialize from a CPrivKey (serialized OpenSSL private key data).
bool SetPrivKey(const CPrivKey& vchPrivKey, bool fCompressed);
- // Generate a new private key using a cryptographic PRNG.
+ //! Generate a new private key using a cryptographic PRNG.
void MakeNewKey(bool fCompressed);
- // Convert the private key to a CPrivKey (serialized OpenSSL private key data).
- // This is expensive.
+ /**
+ * Convert the private key to a CPrivKey (serialized OpenSSL private key data).
+ * This is expensive.
+ */
CPrivKey GetPrivKey() const;
- // Compute the public key from a private key.
- // This is expensive.
+ /**
+ * Compute the public key from a private key.
+ * This is expensive.
+ */
CPubKey GetPubKey() const;
- // Create a DER-serialized signature.
+ //! Create a DER-serialized signature.
bool Sign(const uint256& hash, std::vector<unsigned char>& vchSig, bool lowS = true) const;
- // Create a compact signature (65 bytes), which allows reconstructing the used public key.
- // The format is one header byte, followed by two times 32 bytes for the serialized r and s values.
- // The header byte: 0x1B = first key with even y, 0x1C = first key with odd y,
- // 0x1D = second key with even y, 0x1E = second key with odd y,
- // add 0x04 for compressed keys.
+ /**
+ * Create a compact signature (65 bytes), which allows reconstructing the used public key.
+ * The format is one header byte, followed by two times 32 bytes for the serialized r and s values.
+ * The header byte: 0x1B = first key with even y, 0x1C = first key with odd y,
+ * 0x1D = second key with even y, 0x1E = second key with odd y,
+ * add 0x04 for compressed keys.
+ */
bool SignCompact(const uint256& hash, std::vector<unsigned char>& vchSig) const;
- // Derive BIP32 child key.
+ //! Derive BIP32 child key.
bool Derive(CKey& keyChild, unsigned char ccChild[32], unsigned int nChild, const unsigned char cc[32]) const;
- // Load private key and check that public key matches.
+ //! Load private key and check that public key matches.
bool Load(CPrivKey& privkey, CPubKey& vchPubKey, bool fSkipCheck);
- // Check whether an element of a signature (r or s) is valid.
+ //! Check whether an element of a signature (r or s) is valid.
static bool CheckSignatureElement(const unsigned char* vch, int len, bool half);
};
diff --git a/src/keystore.cpp b/src/keystore.cpp
index 039c690625..879f099720 100644
--- a/src/keystore.cpp
+++ b/src/keystore.cpp
@@ -1,6 +1,6 @@
// Copyright (c) 2009-2010 Satoshi Nakamoto
-// Copyright (c) 2009-2013 The Bitcoin developers
-// Distributed under the MIT/X11 software license, see the accompanying
+// Copyright (c) 2009-2014 The Bitcoin developers
+// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include "keystore.h"
diff --git a/src/keystore.h b/src/keystore.h
index 4f8189c8f5..66f8771d4a 100644
--- a/src/keystore.h
+++ b/src/keystore.h
@@ -1,6 +1,6 @@
// Copyright (c) 2009-2010 Satoshi Nakamoto
-// Copyright (c) 2009-2013 The Bitcoin developers
-// Distributed under the MIT/X11 software license, see the accompanying
+// Copyright (c) 2009-2014 The Bitcoin developers
+// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#ifndef BITCOIN_KEYSTORE_H
@@ -24,22 +24,22 @@ protected:
public:
virtual ~CKeyStore() {}
- // Add a key to the store.
+ //! Add a key to the store.
virtual bool AddKeyPubKey(const CKey &key, const CPubKey &pubkey) =0;
virtual bool AddKey(const CKey &key);
- // Check whether a key corresponding to a given address is present in the store.
+ //! Check whether a key corresponding to a given address is present in the store.
virtual bool HaveKey(const CKeyID &address) const =0;
virtual bool GetKey(const CKeyID &address, CKey& keyOut) const =0;
virtual void GetKeys(std::set<CKeyID> &setAddress) const =0;
virtual bool GetPubKey(const CKeyID &address, CPubKey& vchPubKeyOut) const;
- // Support for BIP 0013 : see https://github.com/bitcoin/bips/blob/master/bip-0013.mediawiki
+ //! Support for BIP 0013 : see https://github.com/bitcoin/bips/blob/master/bip-0013.mediawiki
virtual bool AddCScript(const CScript& redeemScript) =0;
virtual bool HaveCScript(const CScriptID &hash) const =0;
virtual bool GetCScript(const CScriptID &hash, CScript& redeemScriptOut) const =0;
- // Support for Watch-only addresses
+ //! Support for Watch-only addresses
virtual bool AddWatchOnly(const CScript &dest) =0;
virtual bool RemoveWatchOnly(const CScript &dest) =0;
virtual bool HaveWatchOnly(const CScript &dest) const =0;
diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp
index f0471c32f9..77cfdceef0 100644
--- a/src/qt/bitcoingui.cpp
+++ b/src/qt/bitcoingui.cpp
@@ -19,7 +19,7 @@
#ifdef ENABLE_WALLET
#include "walletframe.h"
#include "walletmodel.h"
-#endif
+#endif // ENABLE_WALLET
#ifdef Q_OS_MAC
#include "macdockiconhandler.h"
@@ -106,7 +106,7 @@ BitcoinGUI::BitcoinGUI(const NetworkStyle *networkStyle, QWidget *parent) :
bool enableWallet = !GetBoolArg("-disablewallet", false);
#else
bool enableWallet = false;
-#endif
+#endif // ENABLE_WALLET
if(enableWallet)
{
windowTitle += tr("Wallet");
@@ -136,7 +136,7 @@ BitcoinGUI::BitcoinGUI(const NetworkStyle *networkStyle, QWidget *parent) :
walletFrame = new WalletFrame(this);
setCentralWidget(walletFrame);
} else
-#endif
+#endif // ENABLE_WALLET
{
/* When compiled without wallet or -disablewallet is provided,
* the central widget is the rpc console.
@@ -268,6 +268,7 @@ void BitcoinGUI::createActions(const NetworkStyle *networkStyle)
historyAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_4));
tabGroup->addAction(historyAction);
+#ifdef ENABLE_WALLET
// These showNormalIfMinimized are needed because Send Coins and Receive Coins
// can be triggered from the tray menu, and need to show the GUI to be useful.
connect(overviewAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized()));
@@ -278,6 +279,7 @@ void BitcoinGUI::createActions(const NetworkStyle *networkStyle)
connect(receiveCoinsAction, SIGNAL(triggered()), this, SLOT(gotoReceiveCoinsPage()));
connect(historyAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized()));
connect(historyAction, SIGNAL(triggered()), this, SLOT(gotoHistoryPage()));
+#endif // ENABLE_WALLET
quitAction = new QAction(QIcon(":/icons/quit"), tr("E&xit"), this);
quitAction->setStatusTip(tr("Quit application"));
@@ -343,7 +345,7 @@ void BitcoinGUI::createActions(const NetworkStyle *networkStyle)
connect(usedReceivingAddressesAction, SIGNAL(triggered()), walletFrame, SLOT(usedReceivingAddresses()));
connect(openAction, SIGNAL(triggered()), this, SLOT(openClicked()));
}
-#endif
+#endif // ENABLE_WALLET
}
void BitcoinGUI::createMenuBar()
@@ -433,7 +435,7 @@ void BitcoinGUI::setClientModel(ClientModel *clientModel)
{
walletFrame->setClientModel(clientModel);
}
-#endif
+#endif // ENABLE_WALLET
unitDisplayControl->setOptionsModel(clientModel->getOptionsModel());
} else {
// Disable possibility to show main window via action
@@ -469,7 +471,7 @@ void BitcoinGUI::removeAllWallets()
setWalletActionsEnabled(false);
walletFrame->removeAllWallets();
}
-#endif
+#endif // ENABLE_WALLET
void BitcoinGUI::setWalletActionsEnabled(bool enabled)
{
@@ -616,7 +618,7 @@ void BitcoinGUI::gotoVerifyMessageTab(QString addr)
{
if (walletFrame) walletFrame->gotoVerifyMessageTab(addr);
}
-#endif
+#endif // ENABLE_WALLET
void BitcoinGUI::setNumConnections(int count)
{
@@ -676,7 +678,7 @@ void BitcoinGUI::setNumBlocks(int count)
#ifdef ENABLE_WALLET
if(walletFrame)
walletFrame->showOutOfSyncWarning(false);
-#endif
+#endif // ENABLE_WALLET
progressBarLabel->setVisible(false);
progressBar->setVisible(false);
@@ -727,7 +729,7 @@ void BitcoinGUI::setNumBlocks(int count)
#ifdef ENABLE_WALLET
if(walletFrame)
walletFrame->showOutOfSyncWarning(true);
-#endif
+#endif // ENABLE_WALLET
tooltip += QString("<br>");
tooltip += tr("Last received block was generated %1 ago.").arg(timeBehindText);
@@ -850,7 +852,7 @@ void BitcoinGUI::incomingTransaction(const QString& date, int unit, const CAmoun
.arg(type)
.arg(address), CClientUIInterface::MSG_INFORMATION);
}
-#endif
+#endif // ENABLE_WALLET
void BitcoinGUI::dragEnterEvent(QDragEnterEvent *event)
{
@@ -924,7 +926,7 @@ void BitcoinGUI::setEncryptionStatus(int status)
break;
}
}
-#endif
+#endif // ENABLE_WALLET
void BitcoinGUI::showNormalIfMinimized(bool fToggleHidden)
{
diff --git a/src/qt/bitcoingui.h b/src/qt/bitcoingui.h
index f65f0e9137..0ef4101127 100644
--- a/src/qt/bitcoingui.h
+++ b/src/qt/bitcoingui.h
@@ -63,7 +63,7 @@ public:
bool addWallet(const QString& name, WalletModel *walletModel);
bool setCurrentWallet(const QString& name);
void removeAllWallets();
-#endif
+#endif // ENABLE_WALLET
protected:
void changeEvent(QEvent *e);
@@ -163,7 +163,7 @@ public slots:
/** Show incoming transaction notification for new transactions. */
void incomingTransaction(const QString& date, int unit, const CAmount& amount, const QString& type, const QString& address);
-#endif
+#endif // ENABLE_WALLET
private slots:
#ifdef ENABLE_WALLET
@@ -183,7 +183,7 @@ private slots:
/** Show open dialog */
void openClicked();
-#endif
+#endif // ENABLE_WALLET
/** Show configuration dialog */
void optionsClicked();
/** Show about dialog */