![]() |
Anoncoin
0.9.4
P2P Digital Currency
|
#include "bignum.h"
#include "clientversion.h"
#include "chainparams.h"
#include "coins.h"
#include "core.h"
#include "net.h"
#include "script.h"
#include "sync.h"
#include "txmempool.h"
#include "uint256.h"
#include <algorithm>
#include <exception>
#include <map>
#include <set>
#include <stdint.h>
#include <string>
#include <utility>
#include <vector>
Go to the source code of this file.
Classes | |
struct | CNodeStateStats |
struct | CDiskBlockPos |
struct | CDiskTxPos |
class | CBlockUndo |
Undo information for a CBlock. More... | |
class | CScriptCheck |
Closure representing one script verification Note that this stores references to the spending transaction. More... | |
class | CMerkleTx |
A transaction with a merkle branch linking it to the block chain. More... | |
class | CPartialMerkleTree |
Data structure that represents a partial merkle tree. More... | |
class | CBlockFileInfo |
class | CBlockIndex |
The block chain is a tree shaped structure starting with the genesis block at the root, with each block potentially having multiple candidates to be the next block. More... | |
class | CDiskBlockIndex |
Used to marshal pointers into hashes for db storage. More... | |
class | CValidationState |
Capture information about block/transaction validation. More... | |
class | CChain |
An in-memory indexed chain of blocks. More... | |
struct | CBlockTemplate |
class | CMerkleBlock |
Used to relay blocks as header + vector<merkle branch> to filtered nodes. More... | |
class | CWalletInterface |
Enumerations | |
enum | GetMinFee_mode { GMF_RELAY, GMF_SEND } |
enum | BlockStatus { BLOCK_VALID_UNKNOWN = 0, BLOCK_VALID_HEADER = 1, BLOCK_VALID_TREE = 2, BLOCK_VALID_TRANSACTIONS = 3, BLOCK_VALID_CHAIN = 4, BLOCK_VALID_SCRIPTS = 5, BLOCK_VALID_MASK = 7, BLOCK_HAVE_DATA = 8, BLOCK_HAVE_UNDO = 16, BLOCK_HAVE_MASK = 24, BLOCK_FAILED_VALID = 32, BLOCK_FAILED_CHILD = 64, BLOCK_FAILED_MASK = 96 } |
Functions | |
void | RegisterWallet (CWalletInterface *pwalletIn) |
Register a wallet to receive updates from core. More... | |
void | UnregisterWallet (CWalletInterface *pwalletIn) |
Unregister a wallet from core. More... | |
void | UnregisterAllWallets () |
Unregister all wallets from core. More... | |
void | SyncWithWallets (const uint256 &hash, const CTransaction &tx, const CBlock *pblock=NULL) |
Push an updated transaction to all registered wallets. More... | |
void | RegisterNodeSignals (CNodeSignals &nodeSignals) |
Register with a network node to receive its signals. More... | |
void | UnregisterNodeSignals (CNodeSignals &nodeSignals) |
Unregister a network node. More... | |
void | PushGetBlocks (CNode *pnode, CBlockIndex *pindexBegin, uint256 hashEnd) |
bool | ProcessBlock (CValidationState &state, CNode *pfrom, CBlock *pblock, CDiskBlockPos *dbp=NULL) |
Process an incoming block. More... | |
bool | CheckDiskSpace (uint64_t nAdditionalBytes=0) |
Check whether enough disk space is available for an incoming block. More... | |
FILE * | OpenBlockFile (const CDiskBlockPos &pos, bool fReadOnly=false) |
Open a block file (blk?????.dat) More... | |
FILE * | OpenUndoFile (const CDiskBlockPos &pos, bool fReadOnly=false) |
Open an undo file (rev?????.dat) More... | |
bool | LoadExternalBlockFile (FILE *fileIn, CDiskBlockPos *dbp=NULL) |
Import blocks from an external file. More... | |
bool | InitBlockIndex () |
Initialize a new block tree database + block data on disk. More... | |
bool | LoadBlockIndex () |
Load the block tree and coins database from disk. More... | |
void | UnloadBlockIndex () |
Unload database information. More... | |
bool | VerifyDB (int nCheckLevel, int nCheckDepth) |
Verify consistency of the block and coin databases. More... | |
void | PrintBlockTree () |
Print the loaded block tree. More... | |
bool | ProcessMessages (CNode *pfrom) |
Process protocol messages received from a given node. More... | |
bool | SendMessages (CNode *pto, bool fSendTrickle) |
Send queued protocol messages to be sent to a give node. More... | |
void | ThreadScriptCheck () |
Run an instance of the script checking thread. More... | |
bool | CheckProofOfWork (uint256 hash, unsigned int nBits) |
Check whether a block hash satisfies the proof-of-work requirement specified by nBits. More... | |
unsigned int | ComputeMinWork (unsigned int nBase, int64_t nTime) |
Calculate the minimum amount of work a received block needs, without knowing its direct parent. More... | |
bool | IsInitialBlockDownload () |
Check whether we are doing an initial block download (synchronizing from disk or network) More... | |
std::string | GetWarnings (std::string strFor) |
Format a string that describes several potential problems detected by the core. More... | |
bool | GetTransaction (const uint256 &hash, CTransaction &tx, uint256 &hashBlock, bool fAllowSlow=false) |
Retrieve a transaction (from memory pool, or from disk, if possible) More... | |
bool | ActivateBestChain (CValidationState &state) |
Find the best known block, and make it the tip of the block chain. More... | |
int64_t | GetBlockValue (int nHeight, int64_t nFees) |
unsigned int | GetNextWorkRequired (const CBlockIndex *pindexLast, const CBlockHeader *pblock) |
void | UpdateTime (CBlockHeader &block, const CBlockIndex *pindexPrev) |
CBlockIndex * | InsertBlockIndex (uint256 hash) |
Create a new block index entry for a given block hash. More... | |
bool | VerifySignature (const CCoins &txFrom, const CTransaction &txTo, unsigned int nIn, unsigned int flags, int nHashType) |
Verify a signature. More... | |
bool | AbortNode (const std::string &msg) |
Abort with a message. More... | |
bool | GetNodeStateStats (NodeId nodeid, CNodeStateStats &stats) |
Get statistics from node state. More... | |
void | Misbehaving (NodeId nodeid, int howmuch) |
Increase a node's misbehavior score. More... | |
bool | AcceptToMemoryPool (CTxMemPool &pool, CValidationState &state, const CTransaction &tx, bool fLimitFree, bool *pfMissingInputs, bool fRejectInsaneFee=false) |
(try to) add transaction to memory pool More... | |
int64_t | GetMinFee (const CTransaction &tx, unsigned int nBytes, bool fAllowFree, enum GetMinFee_mode mode) |
bool | AreInputsStandard (const CTransaction &tx, CCoinsViewCache &mapInputs) |
Check for standard transaction types. More... | |
unsigned int | GetLegacySigOpCount (const CTransaction &tx) |
Count ECDSA signature operations the old-fashioned (pre-0.6) way. More... | |
unsigned int | GetP2SHSigOpCount (const CTransaction &tx, CCoinsViewCache &mapInputs) |
Count ECDSA signature operations in pay-to-script-hash inputs. More... | |
bool | AllowFree (double dPriority) |
bool | CheckInputs (const CTransaction &tx, CValidationState &state, CCoinsViewCache &view, bool fScriptChecks=true, unsigned int flags=SCRIPT_VERIFY_P2SH|SCRIPT_VERIFY_STRICTENC, std::vector< CScriptCheck > *pvChecks=NULL) |
void | UpdateCoins (const CTransaction &tx, CValidationState &state, CCoinsViewCache &inputs, CTxUndo &txundo, int nHeight, const uint256 &txhash) |
bool | CheckTransaction (const CTransaction &tx, CValidationState &state) |
bool | IsStandardTx (const CTransaction &tx, std::string &reason) |
Check for standard transaction types. More... | |
bool | IsFinalTx (const CTransaction &tx, int nBlockHeight=0, int64_t nBlockTime=0) |
bool | WriteBlockToDisk (CBlock &block, CDiskBlockPos &pos) |
Functions for disk access for blocks. More... | |
bool | ReadBlockFromDisk (CBlock &block, const CDiskBlockPos &pos) |
bool | ReadBlockFromDisk (CBlock &block, const CBlockIndex *pindex) |
bool | DisconnectBlock (CBlock &block, CValidationState &state, CBlockIndex *pindex, CCoinsViewCache &coins, bool *pfClean=NULL) |
Functions for validating blocks and updating the block tree. More... | |
bool | ConnectBlock (CBlock &block, CValidationState &state, CBlockIndex *pindex, CCoinsViewCache &coins, bool fJustCheck=false) |
bool | AddToBlockIndex (CBlock &block, CValidationState &state, const CDiskBlockPos &pos) |
bool | CheckBlock (const CBlock &block, CValidationState &state, bool fCheckPOW=true, bool fCheckMerkleRoot=true) |
bool | AcceptBlock (CBlock &block, CValidationState &state, CDiskBlockPos *dbp=NULL) |
Variables | |
CScript | COINBASE_FLAGS |
CCriticalSection | cs_main |
CTxMemPool | mempool |
std::map< uint256, CBlockIndex * > | mapBlockIndex |
uint64_t | nLastBlockTx |
uint64_t | nLastBlockSize |
const std::string | strMessageMagic |
int64_t | nTimeBestReceived |
bool | fImporting |
bool | fReindex |
bool | fBenchmark |
int | nScriptCheckThreads |
bool | fTxIndex |
unsigned int | nCoinCacheSize |
CChain | chainActive |
The currently-connected chain of blocks. More... | |
CChain | chainMostWork |
The currently best known chain of headers (some of which may be invalid). More... | |
CCoinsViewCache * | pcoinsTip |
Global variable that points to the active CCoinsView (protected by cs_main) More... | |
CBlockTreeDB * | pblocktree |
Global variable that points to the active block tree (protected by cs_main) More... | |
enum BlockStatus |
enum GetMinFee_mode |
bool AbortNode | ( | const std::string & | msg | ) |
bool AcceptBlock | ( | CBlock & | block, |
CValidationState & | state, | ||
CDiskBlockPos * | dbp = NULL |
||
) |
bool AcceptToMemoryPool | ( | CTxMemPool & | pool, |
CValidationState & | state, | ||
const CTransaction & | tx, | ||
bool | fLimitFree, | ||
bool * | pfMissingInputs, | ||
bool | fRejectInsaneFee = false |
||
) |
bool ActivateBestChain | ( | CValidationState & | state | ) |
bool AddToBlockIndex | ( | CBlock & | block, |
CValidationState & | state, | ||
const CDiskBlockPos & | pos | ||
) |
|
inline |
bool AreInputsStandard | ( | const CTransaction & | tx, |
CCoinsViewCache & | mapInputs | ||
) |
Check for standard transaction types.
[in] | mapInputs | Map of previous transactions that have outputs we're spending |
Definition at line 646 of file main.cpp.
bool CheckBlock | ( | const CBlock & | block, |
CValidationState & | state, | ||
bool | fCheckPOW = true , |
||
bool | fCheckMerkleRoot = true |
||
) |
bool CheckDiskSpace | ( | uint64_t | nAdditionalBytes = 0 | ) |
bool CheckInputs | ( | const CTransaction & | tx, |
CValidationState & | state, | ||
CCoinsViewCache & | view, | ||
bool | fScriptChecks = true , |
||
unsigned int | flags = SCRIPT_VERIFY_P2SH|SCRIPT_VERIFY_STRICTENC , |
||
std::vector< CScriptCheck > * | pvChecks = NULL |
||
) |
bool CheckProofOfWork | ( | uint256 | hash, |
unsigned int | nBits | ||
) |
bool CheckTransaction | ( | const CTransaction & | tx, |
CValidationState & | state | ||
) |
unsigned int ComputeMinWork | ( | unsigned int | nBase, |
int64_t | nTime | ||
) |
bool ConnectBlock | ( | CBlock & | block, |
CValidationState & | state, | ||
CBlockIndex * | pindex, | ||
CCoinsViewCache & | coins, | ||
bool | fJustCheck = false |
||
) |
bool DisconnectBlock | ( | CBlock & | block, |
CValidationState & | state, | ||
CBlockIndex * | pindex, | ||
CCoinsViewCache & | coins, | ||
bool * | pfClean = NULL |
||
) |
Functions for validating blocks and updating the block tree.
Undo the effects of this block (with given index) on the UTXO set represented by coins. In case pfClean is provided, operation will try to be tolerant about errors, and *pfClean will be true if no problems were found. Otherwise, the return value will be false in case of problems. Note that in any case, coins may be modified.
Definition at line 1543 of file main.cpp.
int64_t GetBlockValue | ( | int | nHeight, |
int64_t | nFees | ||
) |
unsigned int GetLegacySigOpCount | ( | const CTransaction & | tx | ) |
Count ECDSA signature operations the old-fashioned (pre-0.6) way.
Definition at line 700 of file main.cpp.
int64_t GetMinFee | ( | const CTransaction & | tx, |
unsigned int | nBytes, | ||
bool | fAllowFree, | ||
enum GetMinFee_mode | mode | ||
) |
unsigned int GetNextWorkRequired | ( | const CBlockIndex * | pindexLast, |
const CBlockHeader * | pblock | ||
) |
bool GetNodeStateStats | ( | NodeId | nodeid, |
CNodeStateStats & | stats | ||
) |
unsigned int GetP2SHSigOpCount | ( | const CTransaction & | tx, |
CCoinsViewCache & | mapInputs | ||
) |
Count ECDSA signature operations in pay-to-script-hash inputs.
[in] | mapInputs | Map of previous transactions that have outputs we're spending |
Definition at line 714 of file main.cpp.
bool GetTransaction | ( | const uint256 & | hash, |
CTransaction & | tx, | ||
uint256 & | hashBlock, | ||
bool | fAllowSlow = false |
||
) |
std::string GetWarnings | ( | std::string | strFor | ) |
Format a string that describes several potential problems detected by the core.
bool InitBlockIndex | ( | ) |
CBlockIndex* InsertBlockIndex | ( | uint256 | hash | ) |
bool IsFinalTx | ( | const CTransaction & | tx, |
int | nBlockHeight = 0 , |
||
int64_t | nBlockTime = 0 |
||
) |
bool IsInitialBlockDownload | ( | ) |
bool IsStandardTx | ( | const CTransaction & | tx, |
std::string & | reason | ||
) |
Check for standard transaction types.
bool LoadBlockIndex | ( | ) |
bool LoadExternalBlockFile | ( | FILE * | fileIn, |
CDiskBlockPos * | dbp = NULL |
||
) |
void Misbehaving | ( | NodeId | nodeid, |
int | howmuch | ||
) |
FILE* OpenBlockFile | ( | const CDiskBlockPos & | pos, |
bool | fReadOnly = false |
||
) |
FILE* OpenUndoFile | ( | const CDiskBlockPos & | pos, |
bool | fReadOnly = false |
||
) |
void PrintBlockTree | ( | ) |
bool ProcessBlock | ( | CValidationState & | state, |
CNode * | pfrom, | ||
CBlock * | pblock, | ||
CDiskBlockPos * | dbp = NULL |
||
) |
bool ProcessMessages | ( | CNode * | pfrom | ) |
void PushGetBlocks | ( | CNode * | pnode, |
CBlockIndex * | pindexBegin, | ||
uint256 | hashEnd | ||
) |
bool ReadBlockFromDisk | ( | CBlock & | block, |
const CDiskBlockPos & | pos | ||
) |
bool ReadBlockFromDisk | ( | CBlock & | block, |
const CBlockIndex * | pindex | ||
) |
void RegisterNodeSignals | ( | CNodeSignals & | nodeSignals | ) |
void RegisterWallet | ( | CWalletInterface * | pwalletIn | ) |
bool SendMessages | ( | CNode * | pto, |
bool | fSendTrickle | ||
) |
void SyncWithWallets | ( | const uint256 & | hash, |
const CTransaction & | tx, | ||
const CBlock * | pblock = NULL |
||
) |
void ThreadScriptCheck | ( | ) |
void UnloadBlockIndex | ( | ) |
void UnregisterAllWallets | ( | ) |
void UnregisterNodeSignals | ( | CNodeSignals & | nodeSignals | ) |
void UnregisterWallet | ( | CWalletInterface * | pwalletIn | ) |
void UpdateCoins | ( | const CTransaction & | tx, |
CValidationState & | state, | ||
CCoinsViewCache & | inputs, | ||
CTxUndo & | txundo, | ||
int | nHeight, | ||
const uint256 & | txhash | ||
) |
void UpdateTime | ( | CBlockHeader & | block, |
const CBlockIndex * | pindexPrev | ||
) |
bool VerifyDB | ( | int | nCheckLevel, |
int | nCheckDepth | ||
) |
bool VerifySignature | ( | const CCoins & | txFrom, |
const CTransaction & | txTo, | ||
unsigned int | nIn, | ||
unsigned int | flags, | ||
int | nHashType | ||
) |
bool WriteBlockToDisk | ( | CBlock & | block, |
CDiskBlockPos & | pos | ||
) |
CChain chainMostWork |
CCriticalSection cs_main |
std::map<uint256, CBlockIndex*> mapBlockIndex |
CTxMemPool mempool |
CBlockTreeDB* pblocktree |
CCoinsViewCache* pcoinsTip |
Global variable that points to the active CCoinsView (protected by cs_main)