![]() |
Master Core
v0.0.9 - 2abfd2849db8ba7a83957c64eb976b406713c123
|
#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>
Go to the source code of this file.
Classes | |
struct | COrphanBlock |
struct | COrphanTx |
class | CMainCleanup |
Functions | |
int | mastercore_handler_disc_begin (int nBlockNow, CBlockIndex const *pBlockIndex) |
int | mastercore_handler_disc_end (int nBlockNow, CBlockIndex const *pBlockIndex) |
int | mastercore_handler_block_begin (int nBlockNow, CBlockIndex const *pBlockIndex) |
int | mastercore_handler_block_end (int nBlockNow, CBlockIndex const *pBlockIndex, unsigned int) |
int | mastercore_handler_tx (const CTransaction &tx, int nBlock, unsigned int idx, CBlockIndex const *pBlockIndex) |
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) |
static void | EraseOrphanTx (uint256 hash) |
unsigned int | LimitOrphanTxSize (unsigned int nMaxOrphans) |
bool | IsStandardTx (const CTransaction &tx, string &reason) |
Check for standard transaction types. More... | |
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) |
static uint256 | GetOrphanRoot (const uint256 &hash) |
static void | PruneOrphanBlocks () |
int64_t | GetBlockValue (int nHeight, int64_t nFees) |
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... | |
unsigned int | GetNextWorkRequired (const CBlockIndex *pindexLast, const CBlockHeader *pblock) |
bool | CheckProofOfWork (uint256 hash, unsigned int nBits) |
Check whether a block hash satisfies the proof-of-work requirement specified by nBits. More... | |
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... | |
static void | InvalidChainFound (CBlockIndex *pindexNew) |
static void | InvalidBlockFound (CBlockIndex *pindex, const CValidationState &state) |
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... | |
static void | FlushBlockFile (bool fFinalize=false) |
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) |
static bool | WriteChainState (CValidationState &state) |
static void | UpdateTip (CBlockIndex *pindexNew) |
static bool | DisconnectTip (CValidationState &state) |
static bool | ConnectTip (CValidationState &state, CBlockIndex *pindexNew) |
static void | FindMostWorkChain () |
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... | |
static bool | LoadBlockIndexDB () |
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) |
Format a string that describes several potential problems detected by the core. More... | |
static bool | AlreadyHave (const CInv &inv) |
static void | ProcessGetData (CNode *pfrom) |
static bool | ProcessMessage (CNode *pfrom, string strCommand, CDataStream &vRecv) |
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 | ) |
Abort with a message.
Definition at line 2798 of file main.cpp.
References LogPrintf, CClientUIInterface::MSG_ERROR, StartShutdown(), strMiscWarning, CClientUIInterface::ThreadSafeMessageBox, and uiInterface.
Referenced by CValidationState::Abort(), CheckDiskSpace(), and LoadExternalBlockFile().
bool AcceptBlock | ( | CBlock & | block, |
CValidationState & | state, | ||
CDiskBlockPos * | dbp | ||
) |
Definition at line 2405 of file main.cpp.
References _(), CValidationState::Abort(), AddToBlockIndex(), AssertLockHeld, Checkpoints::CheckBlock(), CLIENT_VERSION, cs_vNodes, CValidationState::DoS(), error(), FindBlockPos(), CBlockIndex::GetBlockHash(), CBlockHeader::GetBlockTime(), CBlockHeader::GetHash(), Checkpoints::GetLastCheckpoint(), CBlockIndex::GetMedianTimePast(), GetNextWorkRequired(), GetSerializeSize(), Checkpoints::GetTotalBlocksEstimate(), CBlockHeader::hashPrevBlock, CChain::Height(), CValidationState::Invalid(), IsFinalTx(), CBlockIndex::IsSuperMajority(), LOCK, MSG_BLOCK, CBlockHeader::nBits, CBlockIndex::nHeight, CNode::nStartingHeight, CBlockHeader::nTime, CBlockHeader::nVersion, Params(), CNode::PushInventory(), REJECT_CHECKPOINT, REJECT_INVALID, REJECT_OBSOLETE, SER_DISK, TestNet(), CChain::Tip(), vNodes, CBlock::vtx, and WriteBlockToDisk().
Referenced by ProcessBlock().
bool AcceptToMemoryPool | ( | CTxMemPool & | pool, |
CValidationState & | state, | ||
const CTransaction & | tx, | ||
bool | fLimitFree, | ||
bool * | pfMissingInputs, | ||
bool | fRejectInsaneFee | ||
) |
(try to) add transaction to memory pool
Definition at line 852 of file main.cpp.
References CTxMemPool::addUnchecked(), AreInputsStandard(), AssertLockHeld, CheckInputs(), CheckTransaction(), CTxMemPool::cs, CValidationState::DoS(), error(), CTxMemPool::exists(), g_signals, GetArg(), CCoinsViewCache::GetBestBlock(), CTransaction::GetHash(), GetMinFee(), CCoinsViewCache::GetPriority(), GetTime(), CCoinsViewCache::GetValueIn(), CTransaction::GetValueOut(), GMF_RELAY, COutPoint::hash, CCoinsViewCache::HaveCoins(), CCoinsViewCache::HaveInputs(), CChain::Height(), CValidationState::Invalid(), CTransaction::IsCoinBase(), IsStandardTx(), LOCK, LogPrint(), CChainParams::MAIN, CTxMemPool::mapNextTx, CTransaction::nMinRelayTxFee, Params(), CTxIn::prevout, REJECT_DUPLICATE, REJECT_INSUFFICIENTFEE, REJECT_INVALID, REJECT_NONSTANDARD, SCRIPT_VERIFY_P2SH, SCRIPT_VERIFY_STRICTENC, CCoinsViewBacked::SetBackend(), base_uint< BITS >::ToString(), and CTransaction::vin.
Referenced by CMerkleTx::AcceptToMemoryPool(), DisconnectTip(), ProcessMessage(), and sendrawtransaction().
bool ActivateBestChain | ( | CValidationState & | state | ) |
Find the best known block, and make it the tip of the block chain.
Definition at line 2138 of file main.cpp.
References ConnectTip(), CChain::Contains(), CValidationState::CorruptionPossible(), DisconnectTip(), FindMostWorkChain(), GetArg(), CBlockIndex::GetBlockHash(), base_uint< BITS >::GetHex(), CChain::Height(), InvalidChainFound(), IsInitialBlockDownload(), CValidationState::IsInvalid(), LOCK, runCommand(), and CChain::Tip().
Referenced by AddToBlockIndex(), and AppInit2().
bool AddOrphanTx | ( | const CTransaction & | tx, |
NodeId | peer | ||
) |
Definition at line 421 of file main.cpp.
References CTransaction::CURRENT_VERSION, CTransaction::GetHash(), COutPoint::hash, LogPrint(), CTxIn::prevout, SER_NETWORK, base_uint< BITS >::ToString(), and CTransaction::vin.
Referenced by ProcessMessage().
bool AddToBlockIndex | ( | CBlock & | block, |
CValidationState & | state, | ||
const CDiskBlockPos & | pos | ||
) |
Definition at line 2186 of file main.cpp.
References _(), CValidationState::Abort(), ActivateBestChain(), BLOCK_HAVE_DATA, BLOCK_VALID_TRANSACTIONS, CheckForkWarningConditions(), CheckForkWarningConditionsOnNewFork(), error(), CLevelDBWrapper::Flush(), g_signals, CBlockIndex::GetBlockWork(), CBlockHeader::GetHash(), CBlock::GetTxHash(), CBigNum::getuint256(), CBlockHeader::hashPrevBlock, CValidationState::Invalid(), LOCK, CBlockIndex::nChainTx, CBlockIndex::nChainWork, CBlockIndex::nDataPos, CDiskBlockPos::nFile, CBlockIndex::nFile, CBlockIndex::nHeight, CClientUIInterface::NotifyBlocksChanged, CDiskBlockPos::nPos, CBlockIndex::nSequenceId, CBlockIndex::nStatus, CBlockIndex::nTx, CBlockIndex::nUndoPos, CBlockIndex::phashBlock, CBlockIndex::pprev, CChain::Tip(), base_uint< BITS >::ToString(), uiInterface, CBlock::vtx, and CBlockTreeDB::WriteBlockIndex().
Referenced by AcceptBlock(), and InitBlockIndex().
|
static |
Definition at line 3269 of file main.cpp.
References CTxMemPool::exists(), CInv::hash, CCoinsViewCache::HaveCoins(), MSG_BLOCK, MSG_TX, and CInv::type.
Referenced by ProcessMessage(), and SendMessages().
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 623 of file main.cpp.
References EvalScript(), CCoinsViewCache::GetOutputFor(), CTransaction::IsCoinBase(), CTxOut::scriptPubKey, ScriptSigArgsExpected(), Solver(), TX_SCRIPTHASH, and CTransaction::vin.
Referenced by AcceptToMemoryPool().
bool CheckBlock | ( | const CBlock & | block, |
CValidationState & | state, | ||
bool | fCheckPOW, | ||
bool | fCheckMerkleRoot | ||
) |
Definition at line 2339 of file main.cpp.
References CBlock::BuildMerkleTree(), CheckProofOfWork(), CheckTransaction(), CValidationState::DoS(), error(), GetAdjustedTime(), CBlockHeader::GetBlockTime(), CBlockHeader::GetHash(), GetLegacySigOpCount(), GetSerializeSize(), CBlock::GetTxHash(), CBlockHeader::hashMerkleRoot, CValidationState::Invalid(), MAX_BLOCK_SIGOPS, MAX_BLOCK_SIZE, CBlockHeader::nBits, PROTOCOL_VERSION, REJECT_INVALID, SER_NETWORK, CBlock::vMerkleTree, and CBlock::vtx.
Referenced by ConnectBlock(), ProcessBlock(), and VerifyDB().
bool CheckDiskSpace | ( | uint64_t | nAdditionalBytes | ) |
Check whether enough disk space is available for an incoming block.
Definition at line 2806 of file main.cpp.
References _(), AbortNode(), GetDataDir(), and nMinDiskSpace.
Referenced by AppInit2(), FindBlockPos(), FindUndoPos(), and WriteChainState().
void CheckForkWarningConditions | ( | ) |
Definition at line 1361 of file main.cpp.
References AssertLockHeld, GetArg(), CBlockIndex::GetBlockWork(), CChain::Height(), IsInitialBlockDownload(), LogPrintf, CBlockIndex::nChainWork, CBlockIndex::nHeight, CBlockIndex::phashBlock, runCommand(), CChain::Tip(), and base_uint< BITS >::ToString().
Referenced by AddToBlockIndex(), CheckForkWarningConditionsOnNewFork(), and InvalidChainFound().
void CheckForkWarningConditionsOnNewFork | ( | CBlockIndex * | pindexNewForkTip | ) |
Definition at line 1407 of file main.cpp.
References AssertLockHeld, CheckForkWarningConditions(), CBlockIndex::GetBlockWork(), CChain::Height(), CBlockIndex::nChainWork, CBlockIndex::nHeight, CBlockIndex::pprev, and CChain::Tip().
Referenced by AddToBlockIndex().
bool CheckInputs | ( | const CTransaction & | tx, |
CValidationState & | state, | ||
CCoinsViewCache & | inputs, | ||
bool | fScriptChecks, | ||
unsigned int | flags, | ||
std::vector< CScriptCheck > * | pvChecks | ||
) |
Definition at line 1549 of file main.cpp.
References COINBASE_MATURITY, CValidationState::DoS(), error(), CCoinsViewCache::GetBestBlock(), CCoinsViewCache::GetCoins(), CTransaction::GetHash(), CTransaction::GetValueOut(), COutPoint::hash, CCoinsViewCache::HaveInputs(), CValidationState::Invalid(), CCoins::IsCoinBase(), CTransaction::IsCoinBase(), MoneyRange(), COutPoint::n, CCoins::nHeight, CBlockIndex::nHeight, REJECT_INVALID, REJECT_NONSTANDARD, SCRIPT_VERIFY_STRICTENC, CScriptCheck::swap(), base_uint< BITS >::ToString(), CTransaction::vin, and CCoins::vout.
Referenced by AcceptToMemoryPool(), ConnectBlock(), and CreateNewBlock().
Check whether a block hash satisfies the proof-of-work requirement specified by nBits.
Definition at line 1325 of file main.cpp.
References error(), CBigNum::getuint256(), Params(), and CBigNum::SetCompact().
Referenced by CheckBlock(), CBlockIndex::CheckIndex(), and ReadBlockFromDisk().
bool CheckTransaction | ( | const CTransaction & | tx, |
CValidationState & | state | ||
) |
Definition at line 760 of file main.cpp.
References CValidationState::DoS(), error(), GetSerializeSize(), CTransaction::IsCoinBase(), COutPoint::IsNull(), MAX_BLOCK_SIZE, MAX_MONEY, MoneyRange(), CTxOut::nValue, CTxIn::prevout, PROTOCOL_VERSION, REJECT_INVALID, SER_NETWORK, CTransaction::vin, and CTransaction::vout.
Referenced by AcceptToMemoryPool(), CheckBlock(), and ReadKeyValue().
Calculate the minimum amount of work a received block needs, without knowing its direct parent.
Definition at line 1241 of file main.cpp.
References CBigNum::GetCompact(), Params(), CChainParams::ProofOfWorkLimit(), CBigNum::SetCompact(), and TestNet().
Referenced by ProcessBlock().
bool ConnectBlock | ( | CBlock & | block, |
CValidationState & | state, | ||
CBlockIndex * | pindex, | ||
CCoinsViewCache & | view, | ||
bool | fJustCheck | ||
) |
Definition at line 1758 of file main.cpp.
References _(), CValidationState::Abort(), CCheckQueueControl< T >::Add(), AssertLockHeld, BLOCK_HAVE_UNDO, BLOCK_VALID_MASK, BLOCK_VALID_SCRIPTS, CheckBlock(), CheckInputs(), CLIENT_VERSION, CValidationState::DoS(), error(), fBenchmark, FindUndoPos(), fTxIndex, g_signals, CCoinsViewCache::GetBestBlock(), CBlockIndex::GetBlockHash(), CBlockIndex::GetBlockPos(), GetBlockValue(), CCoinsViewCache::GetCoins(), CBlockHeader::GetHash(), GetLegacySigOpCount(), GetP2SHSigOpCount(), GetSerializeSize(), GetSizeOfCompactSize(), GetTimeMicros(), Checkpoints::GetTotalBlocksEstimate(), CBlock::GetTxHash(), CBlockIndex::GetUndoPos(), CCoinsViewCache::GetValueIn(), CTransaction::GetValueOut(), CChainParams::HashGenesisBlock(), CCoinsViewCache::HaveCoins(), CCoinsViewCache::HaveInputs(), CTransaction::IsCoinBase(), CDiskBlockPos::IsNull(), LogPrintf, MAX_BLOCK_SIGOPS, CBlockIndex::nFile, CBlockIndex::nHeight, CDiskBlockPos::nPos, CBlockIndex::nStatus, CBlockIndex::nTime, CDiskTxPos::nTxOffset, CBlockIndex::nUndoPos, Params(), CBlockIndex::phashBlock, CBlockIndex::pprev, REJECT_INVALID, SCRIPT_VERIFY_NOCACHE, SCRIPT_VERIFY_NONE, SCRIPT_VERIFY_P2SH, scriptcheckqueue, SER_DISK, CCoinsViewCache::SetBestBlock(), UpdateCoins(), CTransaction::vin, CBlock::vtx, CBlockUndo::vtxundo, CCheckQueueControl< T >::Wait(), CBlockTreeDB::WriteBlockIndex(), and CBlockTreeDB::WriteTxIndex().
Referenced by ConnectTip(), CreateNewBlock(), and VerifyDB().
|
static |
Definition at line 2027 of file main.cpp.
References _(), CValidationState::Abort(), CTxMemPool::check(), ConnectBlock(), error(), fBenchmark, CCoinsViewCache::Flush(), CBlockIndex::GetBlockHash(), CTransaction::GetHash(), mastercore::GetHeight(), GetTimeMicros(), InvalidBlockFound(), CValidationState::IsInvalid(), LogPrintf, mastercore_handler_block_begin(), mastercore_handler_block_end(), mastercore_handler_tx(), MSG_BLOCK, CBlockIndex::pprev, ReadBlockFromDisk(), CTxMemPool::remove(), CTxMemPool::removeConflicts(), SyncWithWallets(), CChain::Tip(), base_uint< BITS >::ToString(), UpdateTip(), CBlock::vtx, and WriteChainState().
Referenced by ActivateBestChain().
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 1638 of file main.cpp.
References CCoins::ClearUnspendable(), error(), CCoins::fCoinBase, CTxInUndo::fCoinBase, CCoinsViewCache::GetBestBlock(), CBlockIndex::GetBlockHash(), CCoinsViewCache::GetCoins(), CTransaction::GetHash(), CBlockIndex::GetUndoPos(), COutPoint::hash, CCoinsViewCache::HaveCoins(), CCoins::IsAvailable(), CDiskBlockPos::IsNull(), CCoins::IsPruned(), COutPoint::n, CCoins::nHeight, CTxInUndo::nHeight, CBlockIndex::nHeight, CCoins::nVersion, CTxInUndo::nVersion, CBlockIndex::pprev, CCoinsViewCache::SetBestBlock(), CCoinsViewCache::SetCoins(), CTxInUndo::txout, CTransaction::vin, CCoins::vout, CTxUndo::vprevout, CBlock::vtx, and CBlockUndo::vtxundo.
Referenced by DisconnectTip(), and VerifyDB().
|
static |
Definition at line 1977 of file main.cpp.
References _(), CValidationState::Abort(), AcceptToMemoryPool(), CTxMemPool::check(), DisconnectBlock(), error(), fBenchmark, CCoinsViewCache::Flush(), fReindex, CBlockIndex::GetBlockHash(), CTransaction::GetHash(), mastercore::GetHeight(), GetTimeMicros(), CTransaction::IsCoinBase(), LogPrintf, mastercore_handler_disc_begin(), mastercore_handler_disc_end(), CBlockIndex::pprev, ReadBlockFromDisk(), CTxMemPool::remove(), SyncWithWallets(), CChain::Tip(), base_uint< BITS >::ToString(), UpdateTip(), CBlock::vtx, and WriteChainState().
Referenced by ActivateBestChain().
void EraseOrphansFor | ( | NodeId | peer | ) |
Definition at line 468 of file main.cpp.
References EraseOrphanTx(), and LogPrint().
|
static |
Definition at line 451 of file main.cpp.
References COutPoint::hash, and CTxIn::prevout.
Referenced by EraseOrphansFor(), LimitOrphanTxSize(), and ProcessMessage().
bool FindBlockPos | ( | CValidationState & | state, |
CDiskBlockPos & | pos, | ||
unsigned int | nAddSize, | ||
unsigned int | nHeight, | ||
uint64_t | nTime, | ||
bool | fKnown = false |
||
) |
Definition at line 2244 of file main.cpp.
References _(), CValidationState::Abort(), AllocateFileRange(), BLOCKFILE_CHUNK_SIZE, CheckDiskSpace(), CValidationState::Error(), FlushBlockFile(), LOCK, LogPrintf, MAX_BLOCKFILE_SIZE, CDiskBlockPos::nFile, CDiskBlockPos::nPos, OpenBlockFile(), CBlockTreeDB::ReadBlockFileInfo(), CBlockTreeDB::WriteBlockFileInfo(), and CBlockTreeDB::WriteLastBlockFile().
Referenced by AcceptBlock(), and InitBlockIndex().
|
static |
Definition at line 2086 of file main.cpp.
References BLOCK_FAILED_CHILD, BLOCK_FAILED_MASK, CChain::Contains(), CBlockIndex::nChainWork, CBlockIndex::nStatus, CBlockIndex::pprev, CChain::SetTip(), and CChain::Tip().
Referenced by ActivateBestChain().
bool FindUndoPos | ( | CValidationState & | state, |
int | nFile, | ||
CDiskBlockPos & | pos, | ||
unsigned int | nAddSize | ||
) |
Definition at line 2298 of file main.cpp.
References _(), CValidationState::Abort(), AllocateFileRange(), CheckDiskSpace(), CValidationState::Error(), LOCK, LogPrintf, CDiskBlockPos::nFile, CDiskBlockPos::nPos, CBlockFileInfo::nUndoSize, OpenUndoFile(), CBlockTreeDB::ReadBlockFileInfo(), UNDOFILE_CHUNK_SIZE, and CBlockTreeDB::WriteBlockFileInfo().
Referenced by ConnectBlock().
|
static |
Definition at line 1726 of file main.cpp.
References FileCommit(), LOCK, OpenBlockFile(), OpenUndoFile(), and TruncateFile().
Referenced by FindBlockPos(), and WriteChainState().
int64_t GetBlockValue | ( | int | nHeight, |
int64_t | nFees | ||
) |
Definition at line 1218 of file main.cpp.
References COIN, Params(), and CChainParams::SubsidyHalvingInterval().
Referenced by ConnectBlock(), and CreateNewBlock().
unsigned int GetLegacySigOpCount | ( | const CTransaction & | tx | ) |
Count ECDSA signature operations the old-fashioned (pre-0.6) way.
Definition at line 677 of file main.cpp.
References CScript::GetSigOpCount(), CTxOut::scriptPubKey, CTxIn::scriptSig, CTransaction::vin, and CTransaction::vout.
Referenced by CheckBlock(), ConnectBlock(), and CreateNewBlock().
int64_t GetMinFee | ( | const CTransaction & | tx, |
unsigned int | nBytes, | ||
bool | fAllowFree, | ||
GetMinFee_mode | mode | ||
) |
Definition at line 817 of file main.cpp.
References CENT, DEFAULT_BLOCK_PRIORITY_SIZE, GMF_RELAY, GMF_SEND, MAX_MONEY, MoneyRange(), CTransaction::nMinRelayTxFee, CTransaction::nMinTxFee, CTxOut::nValue, and CTransaction::vout.
Referenced by AcceptToMemoryPool(), and CoinControlDialog::updateLabels().
unsigned int GetNextWorkRequired | ( | const CBlockIndex * | pindexLast, |
const CBlockHeader * | pblock | ||
) |
debug print
Definition at line 1263 of file main.cpp.
References CBlockIndex::GetBlockTime(), CBigNum::GetCompact(), CBigNum::getuint256(), LogPrintf, CBlockIndex::nBits, CBlockIndex::nHeight, nTargetTimespan, CBlockHeader::nTime, CBlockIndex::nTime, Params(), CBlockIndex::pprev, CChainParams::ProofOfWorkLimit(), CBigNum::SetCompact(), TestNet(), and base_uint< BITS >::ToString().
Referenced by AcceptBlock(), CreateNewBlock(), and UpdateTime().
bool GetNodeStateStats | ( | NodeId | nodeid, |
CNodeStateStats & | stats | ||
) |
Get statistics from node state.
Definition at line 327 of file main.cpp.
References LOCK, and CNodeStateStats::nMisbehavior.
Referenced by getpeerinfo().
Definition at line 1178 of file main.cpp.
Referenced by ProcessBlock(), and ProcessMessage().
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 691 of file main.cpp.
References CCoinsViewCache::GetOutputFor(), CScript::GetSigOpCount(), CTransaction::IsCoinBase(), CScript::IsPayToScriptHash(), CTxOut::scriptPubKey, and CTransaction::vin.
Referenced by ConnectBlock(), and CreateNewBlock().
bool GetTransaction | ( | const uint256 & | hash, |
CTransaction & | txOut, | ||
uint256 & | hashBlock, | ||
bool | fAllowSlow | ||
) |
Retrieve a transaction (from memory pool, or from disk, if possible)
Definition at line 1049 of file main.cpp.
References CLIENT_VERSION, error(), fTxIndex, CBlockIndex::GetBlockHash(), CCoinsViewCache::GetCoins(), CTransaction::GetHash(), CBlockHeader::GetHash(), LOCK, CTxMemPool::lookup(), CCoins::nHeight, CDiskTxPos::nTxOffset, OpenBlockFile(), pcoinsTip, ReadBlockFromDisk(), CBlockTreeDB::ReadTxIndex(), SER_DISK, and CBlock::vtx.
Referenced by getactivecrowdsales_MP(), getcrowdsale_MP(), getrawtransaction(), getsto_MP(), gettrade_MP(), parseTransaction(), populateRPCTransactionObject(), and CMPTxList::setLastAlert().
string GetWarnings | ( | string | strFor | ) |
Format a string that describes several potential problems detected by the core.
Definition at line 3204 of file main.cpp.
References _(), CAlert::AppliesToMe(), CLIENT_VERSION_IS_RELEASE, cs_mapAlerts, GetBoolArg(), LOCK, mapAlerts, CUnsignedAlert::nPriority, PAIRTYPE, strMiscWarning, and CUnsignedAlert::strStatusBar.
Referenced by CRPCTable::execute(), getinfo(), getmininginfo(), and ClientModel::getStatusBarWarnings().
bool InitBlockIndex | ( | ) |
Initialize a new block tree database + block data on disk.
Definition at line 3014 of file main.cpp.
References AddToBlockIndex(), CLIENT_VERSION, error(), FindBlockPos(), fReindex, fTxIndex, CChain::Genesis(), CChainParams::GenesisBlock(), GetBoolArg(), GetSerializeSize(), LOCK, LogPrintf, CBlockHeader::nTime, Params(), SER_DISK, WriteBlockToDisk(), and CBlockTreeDB::WriteFlag().
Referenced by AppInit2(), and ThreadImport().
CBlockIndex* InsertBlockIndex | ( | uint256 | hash | ) |
Create a new block index entry for a given block hash.
Definition at line 2848 of file main.cpp.
Referenced by CBlockTreeDB::LoadBlockIndexGuts().
|
static |
Definition at line 1480 of file main.cpp.
References BLOCK_FAILED_VALID, CValidationState::CorruptionPossible(), CBlockIndex::GetBlockHash(), CValidationState::GetRejectCode(), CValidationState::GetRejectReason(), InvalidChainFound(), CValidationState::IsInvalid(), Misbehaving(), CBlockIndex::nStatus, and CBlockTreeDB::WriteBlockIndex().
Referenced by ConnectTip().
|
static |
Definition at line 1459 of file main.cpp.
References CheckForkWarningConditions(), DateTimeStrFormat(), CBlockIndex::GetBlockHash(), CBlockIndex::GetBlockTime(), base_uint< BITS >::getdouble(), CChain::Height(), LogPrintf, CBlockIndex::nChainWork, CBlockIndex::nHeight, CClientUIInterface::NotifyBlocksChanged, CChain::Tip(), base_uint< BITS >::ToString(), uiInterface, and CBlockTreeDB::WriteBestInvalidWork().
Referenced by ActivateBestChain(), and InvalidBlockFound().
bool IsFinalTx | ( | const CTransaction & | tx, |
int | nBlockHeight, | ||
int64_t | nBlockTime | ||
) |
Definition at line 594 of file main.cpp.
References AssertLockHeld, GetAdjustedTime(), CChain::Height(), LOCKTIME_THRESHOLD, CTransaction::nLockTime, and CTransaction::vin.
Referenced by AcceptBlock(), CWallet::AvailableCoins(), CreateNewBlock(), TransactionDesc::FormatTxStatus(), GetAccountBalance(), CWallet::GetAddressBalances(), getreceivedbyaccount(), getreceivedbyaddress(), CWallet::GetUnconfirmedBalance(), IsStandardTx(), CWalletTx::IsTrusted(), ListReceived(), and TransactionRecord::updateStatus().
bool IsInitialBlockDownload | ( | ) |
Check whether we are doing an initial block download (synchronizing from disk or network)
Definition at line 1341 of file main.cpp.
References fImporting, fReindex, CBlockIndex::GetBlockTime(), GetTime(), Checkpoints::GetTotalBlocksEstimate(), CChain::Height(), LOCK, and CChain::Tip().
Referenced by ActivateBestChain(), CheckForkWarningConditions(), getblocktemplate(), ClientModel::inInitialBlockDownload(), ProcessMessage(), SendMessages(), UpdateTip(), WriteBlockToDisk(), and WriteChainState().
bool IsStandardTx | ( | const CTransaction & | tx, |
std::string & | reason | ||
) |
Check for standard transaction types.
Definition at line 507 of file main.cpp.
References AssertLockHeld, CTransaction::CURRENT_VERSION, CScript::HasCanonicalPushes(), CChain::Height(), CTxOut::IsDust(), IsFinalTx(), CScript::IsPushOnly(), IsStandard(), MAX_STANDARD_TX_SIZE, CTransaction::nMinRelayTxFee, CTransaction::nVersion, CTxOut::scriptPubKey, CTxIn::scriptSig, SER_NETWORK, TX_NULL_DATA, CTransaction::vin, and CTransaction::vout.
Referenced by AcceptToMemoryPool().
Definition at line 485 of file main.cpp.
References EraseOrphanTx(), and GetRandHash().
Referenced by ProcessMessage().
bool LoadBlockIndex | ( | ) |
Load the block tree and coins database from disk.
Definition at line 3005 of file main.cpp.
References fReindex, and LoadBlockIndexDB().
Referenced by AppInit2().
|
static |
Definition at line 2868 of file main.cpp.
References BLOCK_FAILED_MASK, BLOCK_VALID_MASK, BLOCK_VALID_TRANSACTIONS, DateTimeStrFormat(), fReindex, fTxIndex, CCoinsViewCache::GetBestBlock(), CBlockIndex::GetBlockHash(), CBlockIndex::GetBlockTime(), CBlockIndex::GetBlockWork(), CBigNum::getuint256(), Checkpoints::GuessVerificationProgress(), CChain::Height(), CBlockTreeDB::LoadBlockIndexGuts(), LogPrintf, CBlockIndex::nChainTx, CBlockIndex::nChainWork, CBlockIndex::nHeight, CBlockIndex::nStatus, CBlockIndex::nTx, PAIRTYPE, CBlockIndex::pprev, CBlockTreeDB::ReadBlockFileInfo(), CBlockTreeDB::ReadFlag(), CBlockTreeDB::ReadLastBlockFile(), CBlockTreeDB::ReadReindexing(), CChain::SetTip(), CChain::Tip(), and base_uint< BITS >::ToString().
Referenced by LoadBlockIndex().
bool LoadExternalBlockFile | ( | FILE * | fileIn, |
CDiskBlockPos * | dbp | ||
) |
Import blocks from an external file.
Definition at line 3118 of file main.cpp.
References _(), AbortNode(), CLIENT_VERSION, CBufferedFile::eof(), CBufferedFile::FindByte(), FLATDATA, CBufferedFile::GetPos(), GetTimeMillis(), CBufferedFile::good(), CValidationState::IsError(), LOCK, LogPrintf, MAX_BLOCK_SIZE, MESSAGE_START_SIZE, CDiskBlockPos::nFile, CDiskBlockPos::nPos, CBlockFileInfo::nSize, Params(), ProcessBlock(), CBlockTreeDB::ReadBlockFileInfo(), CBufferedFile::Seek(), SER_DISK, CBufferedFile::SetLimit(), and CBufferedFile::SetPos().
Referenced by ThreadImport().
int mastercore_handler_block_begin | ( | int | nBlockNow, |
CBlockIndex const * | pBlockIndex | ||
) |
Definition at line 3989 of file mastercore.cpp.
Referenced by ConnectTip().
int mastercore_handler_block_end | ( | int | nBlockNow, |
CBlockIndex const * | pBlockIndex, | ||
unsigned | int | ||
) |
Definition at line 4034 of file mastercore.cpp.
Referenced by ConnectTip().
int mastercore_handler_disc_begin | ( | int | nBlockNow, |
CBlockIndex const * | pBlockIndex | ||
) |
Definition at line 4074 of file mastercore.cpp.
Referenced by DisconnectTip().
int mastercore_handler_disc_end | ( | int | nBlockNow, |
CBlockIndex const * | pBlockIndex | ||
) |
Definition at line 4081 of file mastercore.cpp.
Referenced by DisconnectTip().
int mastercore_handler_tx | ( | const CTransaction & | tx, |
int | nBlock, | ||
unsigned int | idx, | ||
CBlockIndex const * | pBlockIndex | ||
) |
Definition at line 2567 of file mastercore.cpp.
Referenced by ConnectTip().
Increase a node's misbehavior score.
Definition at line 1441 of file main.cpp.
References GetArg(), and LogPrintf.
Referenced by InvalidBlockFound(), and ProcessMessage().
FILE* OpenBlockFile | ( | const CDiskBlockPos & | pos, |
bool | fReadOnly | ||
) |
Open a block file (blk?????.dat)
Definition at line 2840 of file main.cpp.
References OpenDiskFile().
Referenced by FindBlockPos(), FlushBlockFile(), GetTransaction(), ReadBlockFromDisk(), ThreadImport(), and WriteBlockToDisk().
FILE* OpenDiskFile | ( | const CDiskBlockPos & | pos, |
const char * | prefix, | ||
bool | fReadOnly | ||
) |
Definition at line 2817 of file main.cpp.
References GetDataDir(), CDiskBlockPos::IsNull(), LogPrintf, CDiskBlockPos::nFile, CDiskBlockPos::nPos, and strprintf.
Referenced by OpenBlockFile(), and OpenUndoFile().
FILE* OpenUndoFile | ( | const CDiskBlockPos & | pos, |
bool | fReadOnly | ||
) |
Open an undo file (rev?????.dat)
Definition at line 2844 of file main.cpp.
References OpenDiskFile().
Referenced by FindUndoPos(), and FlushBlockFile().
void PrintBlockTree | ( | ) |
Print the loaded block tree.
Definition at line 3049 of file main.cpp.
References AssertLockHeld, DateTimeStrFormat(), CChain::Genesis(), CBlockIndex::GetBlockPos(), CBlockHeader::GetBlockTime(), LogPrintf, CChain::Next(), CDiskBlockPos::nFile, CBlockIndex::nHeight, CDiskBlockPos::nPos, CBlockIndex::pprev, ReadBlockFromDisk(), and CBlock::vtx.
Referenced by AppInit2().
bool ProcessBlock | ( | CValidationState & | state, |
CNode * | pfrom, | ||
CBlock * | pblock, | ||
CDiskBlockPos * | dbp | ||
) |
Process an incoming block.
Definition at line 2542 of file main.cpp.
References AcceptBlock(), AssertLockHeld, CDataStream::begin(), CBlock::BuildMerkleTree(), CheckBlock(), CLIENT_VERSION, ComputeMinWork(), CValidationState::DoS(), CDataStream::end(), error(), CBlockIndex::GetBlockHash(), CBlockHeader::GetBlockTime(), CBlockHeader::GetHash(), Checkpoints::GetLastCheckpoint(), GetOrphanRoot(), COrphanBlock::hashBlock, COrphanBlock::hashPrev, CBlockHeader::hashPrevBlock, CValidationState::Invalid(), LogPrintf, CBlockHeader::nBits, CBlockIndex::nBits, CBlockIndex::nTime, PruneOrphanBlocks(), PushGetBlocks(), REJECT_CHECKPOINT, REJECT_INVALID, SER_DISK, CBigNum::SetCompact(), CChain::Tip(), base_uint< BITS >::ToString(), and COrphanBlock::vchBlock.
Referenced by LoadExternalBlockFile(), ProcessMessage(), and submitblock().
|
static |
Definition at line 3289 of file main.cpp.
References CChain::Contains(), mruset< T >::count(), CNode::cs_filter, cs_mapRelay, g_signals, CBlockIndex::GetBlockHash(), CInv::GetCommand(), Checkpoints::GetLastCheckpoint(), CInv::hash, CNode::hashContinue, CInv::IsKnownType(), LOCK, LogPrintf, CTxMemPool::lookup(), mapRelay, MSG_BLOCK, MSG_FILTERED_BLOCK, MSG_TX, CNode::nSendSize, CNode::pfilter, PROTOCOL_VERSION, CNode::PushMessage(), ReadBlockFromDisk(), CDataStream::reserve(), SendBufferSize(), SER_NETWORK, CNode::setInventoryKnown, CChain::Tip(), CInv::type, CMerkleBlock::vMatchedTxn, CNode::vRecvGetData, and CBlock::vtx.
Referenced by ProcessMessage(), and ProcessMessages().
|
static |
Definition at line 3419 of file main.cpp.
References AcceptToMemoryPool(), CAddrMan::Add(), CNode::AddAddressKnown(), CNode::AddInventoryKnown(), AddOrphanTx(), CNode::addr, AddressCurrentlyConnected(), CNode::addrLocal, addrman, AddTimeData(), AlreadyHave(), CNode::AskFor(), atoi(), BEGIN, BIP0031_VERSION, CADDR_TIME_VERSION, CTxMemPool::check(), CNode::cleanSubVer, CNode::cs_filter, cs_mapAlerts, cs_vNodes, DEFAULT_MAX_ORPHAN_TRANSACTIONS, CDataStream::empty(), END, EraseOrphanTx(), error(), CNode::fClient, fDebug, CNode::fDisconnect, CNode::fGetAddr, fImporting, CNode::fInbound, CChain::FindFork(), CNode::fNetworkNode, fNoListen, CNode::fOneShot, fReindex, CNode::fRelayTxes, CNode::fSuccessfullyConnected, g_signals, CAddrMan::GetAddr(), GetAdjustedTime(), GetArg(), CBlockIndex::GetBlockHash(), CBlockIndex::GetBlockHeader(), CNetAddr::GetHash(), CNode::GetId(), GetLocalAddress(), GetOrphanRoot(), GetRand(), GetRandHash(), CValidationState::GetRejectCode(), CValidationState::GetRejectReason(), GetTime(), GetTimeMicros(), CAddrMan::Good(), Hash(), CInv::hash, CNode::hashContinue, CDataStream::in_avail(), CBloomFilter::insert(), IsInitialBlockDownload(), CValidationState::IsInvalid(), CBlockLocator::IsNull(), IsReachable(), CBloomFilter::IsRelevantAndUpdate(), CNetAddr::IsRoutable(), itostr(), LIMITED_STRING, LimitOrphanTxSize(), LOCK, LOCK2, LogPrint(), LogPrintf, CTxMemPool::lookup(), mapAlerts, mapAlreadyAskedFor, mapArgs, CTxMemPool::mapTx, MAX_INV_SZ, MAX_SCRIPT_ELEMENT_SIZE, memcpy(), MIN_PEER_PROTO_VERSION, Misbehaving(), MSG_BLOCK, MSG_TX, CChain::Next(), CBlockIndex::nHeight, nLocalHostNonce, NODE_NETWORK, CNode::nPingNonceSent, CNode::nPingUsecStart, CNode::nPingUsecTime, CNode::nSendSize, CNode::nServices, CNode::nStartingHeight, CAddress::nTime, CNode::nVersion, PAIRTYPE, CNode::pfilter, ProcessBlock(), ProcessGetData(), PROTOCOL_VERSION, CNode::PushAddress(), PushGetBlocks(), CNode::PushInventory(), CNode::PushMessage(), CNode::PushVersion(), CTxMemPool::queryHashes(), RandAddSeedPerfmon(), REJECT_DUPLICATE, REJECT_OBSOLETE, CAlert::RelayTo(), RelayTransaction(), SanitizeString(), SeenLocal(), SendBufferSize(), CNode::setKnown, CNode::SetRecvVersion(), CDataStream::SetVersion(), CAddrMan::size(), CDataStream::size(), CNode::ssSend, strprintf, CNode::strSubVer, CChain::Tip(), CService::ToString(), CInv::ToString(), base_uint< BITS >::ToString(), CInv::type, CBloomFilter::UpdateEmptyFull(), CNode::vAddrToSend, vNodes, and CNode::vRecvGetData.
Referenced by ProcessMessages().
bool ProcessMessages | ( | CNode * | pfrom | ) |
Process protocol messages received from a given node.
Definition at line 4114 of file main.cpp.
References CDataStream::begin(), CNetMessage::complete(), CNode::fDisconnect, CMessageHeader::GetCommand(), Hash(), CNetMessage::hdr, CMessageHeader::IsValid(), LogPrintf, memcpy(), MESSAGE_START_SIZE, CMessageHeader::nChecksum, CMessageHeader::nMessageSize, CNode::nSendSize, Params(), CMessageHeader::pchMessageStart, PrintExceptionContinue(), ProcessGetData(), ProcessMessage(), CNode::PushMessage(), REJECT_MALFORMED, SendBufferSize(), CNetMessage::vRecv, CNode::vRecvGetData, and CNode::vRecvMsg.
Referenced by RegisterNodeSignals(), and UnregisterNodeSignals().
|
static |
Definition at line 1194 of file main.cpp.
References DEFAULT_MAX_ORPHAN_BLOCKS, GetArg(), and insecure_rand().
Referenced by ProcessBlock().
void PushGetBlocks | ( | CNode * | pnode, |
CBlockIndex * | pindexBegin, | ||
uint256 | hashEnd | ||
) |
Definition at line 2530 of file main.cpp.
References AssertLockHeld, CChain::GetLocator(), CNode::hashLastGetBlocksEnd, CNode::pindexLastGetBlocksBegin, and CNode::PushMessage().
Referenced by ProcessBlock(), ProcessMessage(), and SendMessages().
bool ReadBlockFromDisk | ( | CBlock & | block, |
const CDiskBlockPos & | pos | ||
) |
Definition at line 1145 of file main.cpp.
References CheckProofOfWork(), CLIENT_VERSION, error(), CBlockHeader::GetHash(), CBlockHeader::nBits, OpenBlockFile(), and SER_DISK.
Referenced by AppInit2(), ConnectTip(), DisconnectTip(), getblock(), GetTransaction(), listblocktransactions_MP(), msc_initial_scan(), PrintBlockTree(), ProcessGetData(), ReadBlockFromDisk(), CWallet::ScanForWalletTransactions(), and VerifyDB().
bool ReadBlockFromDisk | ( | CBlock & | block, |
const CBlockIndex * | pindex | ||
) |
Definition at line 1169 of file main.cpp.
References error(), CBlockIndex::GetBlockHash(), CBlockIndex::GetBlockPos(), CBlockHeader::GetHash(), and ReadBlockFromDisk().
void RegisterNodeSignals | ( | CNodeSignals & | nodeSignals | ) |
Register with a network node to receive its signals.
Definition at line 336 of file main.cpp.
References CNodeSignals::FinalizeNode, CNodeSignals::GetHeight, mastercore::GetHeight(), CNodeSignals::InitializeNode, CNodeSignals::ProcessMessages, ProcessMessages(), CNodeSignals::SendMessages, and SendMessages().
Referenced by AppInit2().
void RegisterWallet | ( | CWalletInterface * | pwalletIn | ) |
Register a wallet to receive updates from core.
Definition at line 160 of file main.cpp.
References CWalletInterface::EraseFromWallet(), g_signals, CWalletInterface::Inventory(), CWalletInterface::ResendWalletTransactions(), CWalletInterface::SetBestChain(), CWalletInterface::SyncTransaction(), and CWalletInterface::UpdatedTransaction().
Referenced by AppInit2().
bool SendMessages | ( | CNode * | pto, |
bool | fSendTrickle | ||
) |
Send queued protocol messages to be sent to a give node.
Definition at line 4235 of file main.cpp.
References CNode::addr, AlreadyHave(), CNode::Ban(), BEGIN, BIP0031_VERSION, BLOCK_DOWNLOAD_TIMEOUT, mruset< T >::clear(), mruset< T >::count(), CNode::cs_inventory, cs_vNodes, END, fDebug, CNode::fDisconnect, fImporting, fNoListen, CNode::fPingQueued, fReindex, CNode::fStartSync, g_signals, CNode::GetId(), GetLocalAddress(), GetRandHash(), GetTime(), GetTimeMicros(), Hash(), CInv::hash, mruset< T >::insert(), IsInitialBlockDownload(), CNetAddr::IsLocal(), CNetAddr::IsRoutable(), LOCK, LogPrint(), LogPrintf, CNode::mapAskFor, MAX_BLOCKS_IN_TRANSIT_PER_PEER, MSG_BLOCK, MSG_TX, CNode::nLastSend, CNode::nPingNonceSent, CNode::nPingUsecStart, CNode::nVersion, CNode::PushAddress(), PushGetBlocks(), CNode::PushMessage(), CNode::setAddrKnown, CNode::setInventoryKnown, CChain::Tip(), CService::ToString(), CInv::ToString(), base_uint< BITS >::ToString(), TRY_LOCK, CInv::type, CNode::vAddrToSend, CNode::vInventoryToSend, vNodes, and CNode::vSendMsg.
Referenced by RegisterNodeSignals(), and UnregisterNodeSignals().
void SyncWithWallets | ( | const uint256 & | hash, |
const CTransaction & | tx, | ||
const CBlock * | pblock | ||
) |
Push an updated transaction to all registered wallets.
Definition at line 187 of file main.cpp.
References g_signals.
Referenced by ConnectTip(), DisconnectTip(), and sendrawtransaction().
void ThreadScriptCheck | ( | ) |
Run an instance of the script checking thread.
Definition at line 1753 of file main.cpp.
References RenameThread(), and scriptcheckqueue.
Referenced by AppInit2().
void UnloadBlockIndex | ( | ) |
Unload database information.
Definition at line 2997 of file main.cpp.
References CChain::SetTip().
Referenced by AppInit2().
void UnregisterAllWallets | ( | ) |
Unregister all wallets from core.
Definition at line 178 of file main.cpp.
References g_signals.
Referenced by Shutdown().
void UnregisterNodeSignals | ( | CNodeSignals & | nodeSignals | ) |
Unregister a network node.
Definition at line 345 of file main.cpp.
References CNodeSignals::FinalizeNode, CNodeSignals::GetHeight, mastercore::GetHeight(), CNodeSignals::InitializeNode, CNodeSignals::ProcessMessages, ProcessMessages(), CNodeSignals::SendMessages, and SendMessages().
Referenced by Shutdown().
void UnregisterWallet | ( | CWalletInterface * | pwalletIn | ) |
Unregister a wallet from core.
Definition at line 169 of file main.cpp.
References CWalletInterface::EraseFromWallet(), g_signals, CWalletInterface::Inventory(), CWalletInterface::ResendWalletTransactions(), CWalletInterface::SetBestChain(), CWalletInterface::SyncTransaction(), and CWalletInterface::UpdatedTransaction().
void UpdateCoins | ( | const CTransaction & | tx, |
CValidationState & | state, | ||
CCoinsViewCache & | inputs, | ||
CTxUndo & | txundo, | ||
int | nHeight, | ||
const uint256 & | txhash | ||
) |
Definition at line 1518 of file main.cpp.
References CCoinsViewCache::GetCoins(), COutPoint::hash, CTransaction::IsCoinBase(), CTxIn::prevout, CCoinsViewCache::SetCoins(), CCoins::Spend(), CTransaction::vin, and CTxUndo::vprevout.
Referenced by ConnectBlock(), and CreateNewBlock().
void UpdateTime | ( | CBlockHeader & | block, |
const CBlockIndex * | pindexPrev | ||
) |
Definition at line 1499 of file main.cpp.
References GetAdjustedTime(), CBlockIndex::GetMedianTimePast(), GetNextWorkRequired(), CBlockHeader::nBits, CBlockHeader::nTime, and TestNet().
Referenced by CreateNewBlock(), and getblocktemplate().
|
static |
Definition at line 1941 of file main.cpp.
References _(), CTxMemPool::AddTransactionsUpdated(), CBlockHeader::CURRENT_VERSION, DateTimeStrFormat(), g_signals, CBlockIndex::GetBlockHash(), CBlockIndex::GetBlockTime(), base_uint< BITS >::getdouble(), CChain::GetLocator(), GetTime(), Checkpoints::GuessVerificationProgress(), CChain::Height(), IsInitialBlockDownload(), LogPrintf, CBlockIndex::nChainTx, CBlockIndex::nChainWork, nTimeBestReceived, CBlockIndex::nVersion, CBlockIndex::pprev, CChain::SetTip(), strMiscWarning, CChain::Tip(), and base_uint< BITS >::ToString().
Referenced by ConnectTip(), and DisconnectTip().
Verify consistency of the block and coin databases.
Definition at line 2923 of file main.cpp.
References CheckBlock(), ConnectBlock(), DisconnectBlock(), error(), CBlockIndex::GetBlockHash(), CCoinsViewCache::GetCacheSize(), CBlockIndex::GetUndoPos(), CChain::Height(), CDiskBlockPos::IsNull(), LOCK, LogPrintf, nCoinCacheSize, CChain::Next(), CBlockIndex::nHeight, CBlockIndex::pprev, ReadBlockFromDisk(), CChain::Tip(), base_uint< BITS >::ToString(), and CBlock::vtx.
Referenced by AppInit2(), and verifychain().
bool VerifySignature | ( | const CCoins & | txFrom, |
const CTransaction & | txTo, | ||
unsigned int | nIn, | ||
unsigned int | flags, | ||
int | nHashType | ||
) |
bool WriteBlockToDisk | ( | CBlock & | block, |
CDiskBlockPos & | pos | ||
) |
Functions for disk access for blocks.
Definition at line 1119 of file main.cpp.
References CLIENT_VERSION, error(), FileCommit(), fileout, FLATDATA, CAutoFile::GetSerializeSize(), IsInitialBlockDownload(), CDiskBlockPos::nPos, OpenBlockFile(), Params(), and SER_DISK.
Referenced by AcceptBlock(), and InitBlockIndex().
|
static |
Definition at line 1921 of file main.cpp.
References _(), CValidationState::Abort(), CheckDiskSpace(), CValidationState::Error(), CCoinsViewCache::Flush(), FlushBlockFile(), CCoinsViewCache::GetCacheSize(), GetTimeMicros(), IsInitialBlockDownload(), nCoinCacheSize, and CLevelDBWrapper::Sync().
Referenced by ConnectTip(), and DisconnectTip().
CChain chainActive |
The currently-connected chain of blocks.
Definition at line 48 of file main.cpp.
Referenced by AppInit2(), blockToJSON(), mastercore::checkExpiredAlerts(), CreateNewBlock(), dumpwallet(), mastercore::eraseMaxedCrowdsale(), TransactionDesc::FormatTxStatus(), getbestblockhash(), getblockchaininfo(), getblockcount(), getblockhash(), getblocktemplate(), CMPMetaDEx::getBlockTime(), GetDifficulty(), mastercore::GetHeight(), getinfo(), getinfo_MP(), CWallet::GetKeyBirthTimes(), ClientModel::getLastBlockDate(), mastercore::GetLatestBlockTime(), getmininginfo(), GetNetworkHashPS(), ClientModel::getNumBlocks(), getrawmempool(), ClientModel::getVerificationProgress(), importprivkey(), importwallet(), CMPTransaction::interpretPacket(), listblocktransactions_MP(), listsinceblock(), load_most_relevant_state(), CMPTransaction::logicMath_ChangeIssuer(), CMPTransaction::logicMath_GrantTokens(), CMPTransaction::logicMath_RevokeTokens(), msc_initial_scan(), WalletModel::pollBalanceChanged(), CWallet::ScanForWalletTransactions(), CMPTxList::setLastAlert(), Shutdown(), TransactionRecord::statusUpdateNeeded(), TxToJSON(), and TransactionRecord::updateStatus().
CChain chainMostWork |
CScript COINBASE_FLAGS |
Definition at line 80 of file main.cpp.
Referenced by getblocktemplate(), and IncrementExtraNonce().
CCriticalSection cs_main |
Definition at line 43 of file main.cpp.
Referenced by CWallet::AddReserveKey(), CWallet::AvailableCoins(), CWallet::CommitTransaction(), CreateNewBlock(), TransactionTablePriv::describe(), CRPCTable::execute(), TransactionDesc::FormatTxStatus(), CWallet::GetAllReserveKeys(), CWallet::GetBalance(), mastercore::GetHeight(), CWallet::GetImmatureBalance(), ClientModel::getLastBlockDate(), mastercore::GetLatestBlockTime(), ClientModel::getNumBlocks(), WalletModel::getOutputs(), CWallet::GetUnconfirmedBalance(), ClientModel::getVerificationProgress(), importprivkey(), TransactionTablePriv::index(), WalletModel::isLockedCoin(), WalletModel::isSpent(), WalletModel::listCoins(), WalletModel::listLockedCoins(), WalletModel::lockCoin(), WalletModel::pollBalanceChanged(), WalletModel::prepareTransaction(), CWallet::ReacceptWalletTransactions(), TransactionTablePriv::refreshWallet(), CWallet::ScanForWalletTransactions(), WalletModel::sendCoins(), Shutdown(), TransactionRecord::statusUpdateNeeded(), CWallet::SyncTransaction(), TransactionDesc::toHTML(), WalletModel::unlockCoin(), TransactionRecord::updateStatus(), ClientModel::updateTimer(), and TransactionTablePriv::updateWallet().
bool fBenchmark = false |
Definition at line 54 of file main.cpp.
Referenced by AppInit2(), ConnectBlock(), ConnectTip(), and DisconnectTip().
bool fImporting = false |
Definition at line 52 of file main.cpp.
Referenced by CImportingNow::CImportingNow(), ClientModel::getBlockSource(), IsInitialBlockDownload(), ProcessMessage(), SendMessages(), ClientModel::updateTimer(), and CImportingNow::~CImportingNow().
bool fReindex = false |
Definition at line 53 of file main.cpp.
Referenced by AppInit2(), DisconnectTip(), ClientModel::getBlockSource(), InitBlockIndex(), IsInitialBlockDownload(), LoadBlockIndex(), LoadBlockIndexDB(), mastercore_init(), ProcessMessage(), SendMessages(), ThreadImport(), and ClientModel::updateTimer().
bool fTxIndex = false |
Definition at line 55 of file main.cpp.
Referenced by AppInit2(), ConnectBlock(), GetTransaction(), InitBlockIndex(), and LoadBlockIndexDB().
class CMainCleanup instance_of_cmaincleanup |
map<uint256, CBlockIndex*> mapBlockIndex |
Definition at line 47 of file main.cpp.
Referenced by CWallet::AddToWallet(), AppInit2(), getactivecrowdsales_MP(), getblock(), getcrowdsale_MP(), CWallet::GetKeyBirthTimes(), CCoinsViewDB::GetStats(), gettxout(), listsinceblock(), listtransactions_MP(), load_most_relevant_state(), populateRPCTransactionObject(), prune_state_files(), TxToJSON(), TransactionRecord::updateStatus(), and WalletTxToJSON().
map<uint256, COrphanBlock*> mapOrphanBlocks |
multimap<uint256, COrphanBlock*> mapOrphanBlocksByPrev |
CTxMemPool mempool |
Definition at line 45 of file main.cpp.
Referenced by AppInit2(), CreateNewBlock(), getblocktemplate(), getmininginfo(), getrawmempool(), gettxout(), CWallet::ReacceptWalletTransactions(), sendrawtransaction(), Shutdown(), and signrawtransaction().
unsigned int nCoinCacheSize = 5000 |
Definition at line 56 of file main.cpp.
Referenced by AppInit2(), VerifyDB(), and WriteChainState().
|
static |
int nScriptCheckThreads = 0 |
Definition at line 51 of file main.cpp.
Referenced by AppInit2().
|
static |
Definition at line 1233 of file main.cpp.
Referenced by GetNextWorkRequired().
int64_t nTimeBestReceived = 0 |
Definition at line 50 of file main.cpp.
Referenced by CWallet::ResendWalletTransactions(), and UpdateTip().
CBlockTreeDB* pblocktree = NULL |
Global variable that points to the active block tree (protected by cs_main)
Definition at line 414 of file main.cpp.
Referenced by AppInit2(), Shutdown(), and ThreadImport().
CCoinsViewCache* pcoinsTip = NULL |
Global variable that points to the active CCoinsView (protected by cs_main)
Definition at line 413 of file main.cpp.
Referenced by AppInit2(), CreateNewBlock(), GetTransaction(), gettxout(), gettxoutsetinfo(), sendrawtransaction(), Shutdown(), signrawtransaction(), and TransactionDesc::toHTML().
CBlockIndex * pindexBestForkBase = NULL |
CBlockIndex* pindexBestForkTip = NULL |
|
static |
Referenced by ConnectBlock(), and ThreadScriptCheck().
const string strMessageMagic = "Bitcoin Signed Message:\n" |
Definition at line 82 of file main.cpp.
Referenced by SignVerifyMessageDialog::on_signMessageButton_SM_clicked(), SignVerifyMessageDialog::on_verifyMessageButton_VM_clicked(), signmessage(), and verifymessage().