Changeset View
Changeset View
Standalone View
Standalone View
src/validationinterface.h
// Copyright (c) 2009-2010 Satoshi Nakamoto | // Copyright (c) 2009-2010 Satoshi Nakamoto | ||||
// Copyright (c) 2009-2016 The Bitcoin Core developers | // Copyright (c) 2009-2016 The Bitcoin Core developers | ||||
// Distributed under the MIT software license, see the accompanying | // Distributed under the MIT software license, see the accompanying | ||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php. | // file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||||
#ifndef BITCOIN_VALIDATIONINTERFACE_H | #ifndef BITCOIN_VALIDATIONINTERFACE_H | ||||
#define BITCOIN_VALIDATIONINTERFACE_H | #define BITCOIN_VALIDATIONINTERFACE_H | ||||
#include <primitives/transaction.h> // CTransaction(Ref) | #include <primitives/transaction.h> // CTransaction(Ref) | ||||
#include <sync.h> | #include <sync.h> | ||||
#include <functional> | #include <functional> | ||||
#include <memory> | #include <memory> | ||||
extern RecursiveMutex cs_main; | extern RecursiveMutex cs_main; | ||||
class BlockValidationState; | |||||
class CBlock; | class CBlock; | ||||
class CBlockIndex; | class CBlockIndex; | ||||
struct CBlockLocator; | struct CBlockLocator; | ||||
class CBlockIndex; | class CBlockIndex; | ||||
class CConnman; | class CConnman; | ||||
class CValidationInterface; | class CValidationInterface; | ||||
class CValidationState; | |||||
class uint256; | class uint256; | ||||
class CScheduler; | class CScheduler; | ||||
// These functions dispatch to one or all registered wallets | // These functions dispatch to one or all registered wallets | ||||
/** Register a wallet to receive updates from core */ | /** Register a wallet to receive updates from core */ | ||||
void RegisterValidationInterface(CValidationInterface *pwalletIn); | void RegisterValidationInterface(CValidationInterface *pwalletIn); | ||||
/** Unregister a wallet from core */ | /** Unregister a wallet from core */ | ||||
▲ Show 20 Lines • Show All 114 Lines • ▼ Show 20 Lines | protected: | ||||
* Provides a locator describing the best chain, which is likely useful for | * Provides a locator describing the best chain, which is likely useful for | ||||
* storing current state on disk in client DBs. | * storing current state on disk in client DBs. | ||||
* | * | ||||
* Called on a background thread. | * Called on a background thread. | ||||
*/ | */ | ||||
virtual void ChainStateFlushed(const CBlockLocator &locator) {} | virtual void ChainStateFlushed(const CBlockLocator &locator) {} | ||||
/** | /** | ||||
* Notifies listeners of a block validation result. | * Notifies listeners of a block validation result. | ||||
* If the provided CValidationState IsValid, the provided block | * If the provided BlockValidationState IsValid, the provided block | ||||
* is guaranteed to be the current best block at the time the | * is guaranteed to be the current best block at the time the | ||||
* callback was generated (not necessarily now) | * callback was generated (not necessarily now) | ||||
*/ | */ | ||||
virtual void BlockChecked(const CBlock &, const CValidationState &) {} | virtual void BlockChecked(const CBlock &, const BlockValidationState &) {} | ||||
/** | /** | ||||
* Notifies listeners that a block which builds directly on our current tip | * Notifies listeners that a block which builds directly on our current tip | ||||
* has been received and connected to the headers tree, though not validated | * has been received and connected to the headers tree, though not validated | ||||
* yet. | * yet. | ||||
*/ | */ | ||||
virtual void NewPoWValidBlock(const CBlockIndex *pindex, | virtual void NewPoWValidBlock(const CBlockIndex *pindex, | ||||
const std::shared_ptr<const CBlock> &block){}; | const std::shared_ptr<const CBlock> &block){}; | ||||
friend class CMainSignals; | friend class CMainSignals; | ||||
Show All 32 Lines | public: | ||||
void TransactionAddedToMempool(const CTransactionRef &); | void TransactionAddedToMempool(const CTransactionRef &); | ||||
void TransactionRemovedFromMempool(const CTransactionRef &); | void TransactionRemovedFromMempool(const CTransactionRef &); | ||||
void | void | ||||
BlockConnected(const std::shared_ptr<const CBlock> &, | BlockConnected(const std::shared_ptr<const CBlock> &, | ||||
const CBlockIndex *pindex, | const CBlockIndex *pindex, | ||||
const std::shared_ptr<const std::vector<CTransactionRef>> &); | const std::shared_ptr<const std::vector<CTransactionRef>> &); | ||||
void BlockDisconnected(const std::shared_ptr<const CBlock> &); | void BlockDisconnected(const std::shared_ptr<const CBlock> &); | ||||
void ChainStateFlushed(const CBlockLocator &); | void ChainStateFlushed(const CBlockLocator &); | ||||
void BlockChecked(const CBlock &, const CValidationState &); | void BlockChecked(const CBlock &, const BlockValidationState &); | ||||
void NewPoWValidBlock(const CBlockIndex *, | void NewPoWValidBlock(const CBlockIndex *, | ||||
const std::shared_ptr<const CBlock> &); | const std::shared_ptr<const CBlock> &); | ||||
}; | }; | ||||
CMainSignals &GetMainSignals(); | CMainSignals &GetMainSignals(); | ||||
#endif // BITCOIN_VALIDATIONINTERFACE_H | #endif // BITCOIN_VALIDATIONINTERFACE_H |