![]() |
Anoncoin
0.9.4
P2P Digital Currency
|
#include "main.h"
#include "addrman.h"
#include "alert.h"
#include "chainparams.h"
#include "checkpoints.h"
#include "checkqueue.h"
#include "init.h"
#include "net.h"
#include "txdb.h"
#include "txmempool.h"
#include "ui_interface.h"
#include "util.h"
#include <sstream>
#include <boost/algorithm/string/replace.hpp>
#include <boost/filesystem.hpp>
#include <boost/filesystem/fstream.hpp>
#include "main2.cpp"
Go to the source code of this file.
Classes | |
struct | COrphanBlock |
struct | COrphanTx |
class | CMainCleanup |
Functions | |
void | EraseOrphansFor (NodeId peer) |
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) |
Push an updated transaction to all registered wallets. More... | |
bool | GetNodeStateStats (NodeId nodeid, CNodeStateStats &stats) |
Get statistics from node state. More... | |
void | RegisterNodeSignals (CNodeSignals &nodeSignals) |
Register with a network node to receive its signals. More... | |
void | UnregisterNodeSignals (CNodeSignals &nodeSignals) |
Unregister a network node. More... | |
bool | AddOrphanTx (const CTransaction &tx, NodeId peer) |
unsigned int | LimitOrphanTxSize (unsigned int nMaxOrphans) |
bool | IsStandardTx (const CTransaction &tx, string &reason) |
bool | IsFinalTx (const CTransaction &tx, int nBlockHeight, int64_t nBlockTime) |
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 &inputs) |
Count ECDSA signature operations in pay-to-script-hash inputs. More... | |
bool | CheckTransaction (const CTransaction &tx, CValidationState &state) |
int64_t | GetMinFee (const CTransaction &tx, unsigned int nBytes, bool fAllowFree, enum GetMinFee_mode mode) |
bool | AcceptToMemoryPool (CTxMemPool &pool, CValidationState &state, const CTransaction &tx, bool fLimitFree, bool *pfMissingInputs, bool fRejectInsaneFee) |
(try to) add transaction to memory pool More... | |
bool | GetTransaction (const uint256 &hash, CTransaction &txOut, uint256 &hashBlock, bool fAllowSlow) |
Retrieve a transaction (from memory pool, or from disk, if possible) More... | |
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 | IsInitialBlockDownload () |
Check whether we are doing an initial block download (synchronizing from disk or network) More... | |
void | CheckForkWarningConditions () |
void | CheckForkWarningConditionsOnNewFork (CBlockIndex *pindexNewForkTip) |
void | Misbehaving (NodeId pnode, int howmuch) |
Increase a node's misbehavior score. More... | |
void | UpdateTime (CBlockHeader &block, const CBlockIndex *pindexPrev) |
void | UpdateCoins (const CTransaction &tx, CValidationState &state, CCoinsViewCache &inputs, CTxUndo &txundo, int nHeight, const uint256 &txhash) |
bool | VerifySignature (const CCoins &txFrom, const CTransaction &txTo, unsigned int nIn, unsigned int flags, int nHashType) |
Verify a signature. More... | |
bool | CheckInputs (const CTransaction &tx, CValidationState &state, CCoinsViewCache &inputs, bool fScriptChecks, unsigned int flags, std::vector< CScriptCheck > *pvChecks) |
bool | DisconnectBlock (CBlock &block, CValidationState &state, CBlockIndex *pindex, CCoinsViewCache &view, bool *pfClean) |
Functions for validating blocks and updating the block tree. More... | |
bool | FindUndoPos (CValidationState &state, int nFile, CDiskBlockPos &pos, unsigned int nAddSize) |
void | ThreadScriptCheck () |
Run an instance of the script checking thread. More... | |
bool | ConnectBlock (CBlock &block, CValidationState &state, CBlockIndex *pindex, CCoinsViewCache &view, bool fJustCheck) |
bool | ActivateBestChain (CValidationState &state) |
Find the best known block, and make it the tip of the block chain. More... | |
bool | AddToBlockIndex (CBlock &block, CValidationState &state, const CDiskBlockPos &pos) |
bool | FindBlockPos (CValidationState &state, CDiskBlockPos &pos, unsigned int nAddSize, unsigned int nHeight, uint64_t nTime, bool fKnown=false) |
bool | CheckBlock (const CBlock &block, CValidationState &state, bool fCheckPOW, bool fCheckMerkleRoot) |
bool | AcceptBlock (CBlock &block, CValidationState &state, CDiskBlockPos *dbp) |
void | PushGetBlocks (CNode *pnode, CBlockIndex *pindexBegin, uint256 hashEnd) |
bool | ProcessBlock (CValidationState &state, CNode *pfrom, CBlock *pblock, CDiskBlockPos *dbp) |
Process an incoming block. More... | |
bool | AbortNode (const std::string &strMessage) |
Abort with a message. More... | |
bool | CheckDiskSpace (uint64_t nAdditionalBytes) |
Check whether enough disk space is available for an incoming block. More... | |
FILE * | OpenDiskFile (const CDiskBlockPos &pos, const char *prefix, bool fReadOnly) |
FILE * | OpenBlockFile (const CDiskBlockPos &pos, bool fReadOnly) |
Open a block file (blk?????.dat) More... | |
FILE * | OpenUndoFile (const CDiskBlockPos &pos, bool fReadOnly) |
Open an undo file (rev?????.dat) More... | |
CBlockIndex * | InsertBlockIndex (uint256 hash) |
Create a new block index entry for a given block hash. More... | |
bool | VerifyDB (int nCheckLevel, int nCheckDepth) |
Verify consistency of the block and coin databases. More... | |
void | UnloadBlockIndex () |
Unload database information. More... | |
bool | LoadBlockIndex () |
Load the block tree and coins database from disk. More... | |
bool | InitBlockIndex () |
Initialize a new block tree database + block data on disk. More... | |
void | PrintBlockTree () |
Print the loaded block tree. More... | |
bool | LoadExternalBlockFile (FILE *fileIn, CDiskBlockPos *dbp) |
Import blocks from an external file. More... | |
string | GetWarnings (string strFor) |
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... | |
bool AbortNode | ( | const std::string & | strMessage | ) |
bool AcceptBlock | ( | CBlock & | block, |
CValidationState & | state, | ||
CDiskBlockPos * | dbp | ||
) |
bool AcceptToMemoryPool | ( | CTxMemPool & | pool, |
CValidationState & | state, | ||
const CTransaction & | tx, | ||
bool | fLimitFree, | ||
bool * | pfMissingInputs, | ||
bool | fRejectInsaneFee | ||
) |
bool ActivateBestChain | ( | CValidationState & | state | ) |
bool AddOrphanTx | ( | const CTransaction & | tx, |
NodeId | peer | ||
) |
bool AddToBlockIndex | ( | CBlock & | block, |
CValidationState & | state, | ||
const CDiskBlockPos & | pos | ||
) |
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, | ||
bool | fCheckMerkleRoot | ||
) |
bool CheckDiskSpace | ( | uint64_t | nAdditionalBytes | ) |
void CheckForkWarningConditions | ( | ) |
void CheckForkWarningConditionsOnNewFork | ( | CBlockIndex * | pindexNewForkTip | ) |
bool CheckInputs | ( | const CTransaction & | tx, |
CValidationState & | state, | ||
CCoinsViewCache & | inputs, | ||
bool | fScriptChecks, | ||
unsigned int | flags, | ||
std::vector< CScriptCheck > * | pvChecks | ||
) |
bool CheckTransaction | ( | const CTransaction & | tx, |
CValidationState & | state | ||
) |
bool ConnectBlock | ( | CBlock & | block, |
CValidationState & | state, | ||
CBlockIndex * | pindex, | ||
CCoinsViewCache & | view, | ||
bool | fJustCheck | ||
) |
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.
bool FindBlockPos | ( | CValidationState & | state, |
CDiskBlockPos & | pos, | ||
unsigned int | nAddSize, | ||
unsigned int | nHeight, | ||
uint64_t | nTime, | ||
bool | fKnown = false |
||
) |
bool FindUndoPos | ( | CValidationState & | state, |
int | nFile, | ||
CDiskBlockPos & | pos, | ||
unsigned int | nAddSize | ||
) |
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 | ||
) |
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 & | txOut, | ||
uint256 & | hashBlock, | ||
bool | fAllowSlow | ||
) |
string GetWarnings | ( | string | strFor | ) |
bool InitBlockIndex | ( | ) |
CBlockIndex* InsertBlockIndex | ( | uint256 | hash | ) |
bool IsFinalTx | ( | const CTransaction & | tx, |
int | nBlockHeight, | ||
int64_t | nBlockTime | ||
) |
bool IsInitialBlockDownload | ( | ) |
bool IsStandardTx | ( | const CTransaction & | tx, |
string & | reason | ||
) |
unsigned int LimitOrphanTxSize | ( | unsigned int | nMaxOrphans | ) |
bool LoadBlockIndex | ( | ) |
bool LoadExternalBlockFile | ( | FILE * | fileIn, |
CDiskBlockPos * | dbp | ||
) |
void Misbehaving | ( | NodeId | nodeid, |
int | howmuch | ||
) |
FILE* OpenBlockFile | ( | const CDiskBlockPos & | pos, |
bool | fReadOnly | ||
) |
FILE* OpenDiskFile | ( | const CDiskBlockPos & | pos, |
const char * | prefix, | ||
bool | fReadOnly | ||
) |
FILE* OpenUndoFile | ( | const CDiskBlockPos & | pos, |
bool | fReadOnly | ||
) |
void PrintBlockTree | ( | ) |
bool ProcessBlock | ( | CValidationState & | state, |
CNode * | pfrom, | ||
CBlock * | pblock, | ||
CDiskBlockPos * | dbp | ||
) |
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 | ||
) |
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 |
class CMainCleanup instance_of_cmaincleanup |
map<uint256, CBlockIndex*> mapBlockIndex |
map<uint256, COrphanBlock*> mapOrphanBlocks |
multimap<uint256, COrphanBlock*> mapOrphanBlocksByPrev |
CTxMemPool mempool |
CBlockTreeDB* pblocktree = NULL |
CCoinsViewCache* pcoinsTip = NULL |
Global variable that points to the active CCoinsView (protected by cs_main)
CBlockIndex * pindexBestForkBase = NULL |
CBlockIndex* pindexBestForkTip = NULL |