LCOV - code coverage report
Current view: top level - src - validationinterface.h (source / functions) Hit Total Coverage
Test: total_coverage.info Lines: 4 11 36.4 %
Date: 2015-10-12 22:39:14 Functions: 4 12 33.3 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : // Copyright (c) 2009-2010 Satoshi Nakamoto
       2             : // Copyright (c) 2009-2014 The Bitcoin Core developers
       3             : // Distributed under the MIT software license, see the accompanying
       4             : // file COPYING or http://www.opensource.org/licenses/mit-license.php.
       5             : 
       6             : #ifndef BITCOIN_VALIDATIONINTERFACE_H
       7             : #define BITCOIN_VALIDATIONINTERFACE_H
       8             : 
       9             : #include <boost/signals2/signal.hpp>
      10             : #include <boost/shared_ptr.hpp>
      11             : 
      12             : class CBlock;
      13             : struct CBlockLocator;
      14             : class CBlockIndex;
      15             : class CReserveScript;
      16             : class CTransaction;
      17             : class CValidationInterface;
      18             : class CValidationState;
      19             : class uint256;
      20             : 
      21             : // These functions dispatch to one or all registered wallets
      22             : 
      23             : /** Register a wallet to receive updates from core */
      24             : void RegisterValidationInterface(CValidationInterface* pwalletIn);
      25             : /** Unregister a wallet from core */
      26             : void UnregisterValidationInterface(CValidationInterface* pwalletIn);
      27             : /** Unregister all wallets from core */
      28             : void UnregisterAllValidationInterfaces();
      29             : /** Push an updated transaction to all registered wallets */
      30             : void SyncWithWallets(const CTransaction& tx, const CBlock* pblock = NULL);
      31             : 
      32         121 : class CValidationInterface {
      33             : protected:
      34        5110 :     virtual void UpdatedBlockTip(const CBlockIndex *pindex) {}
      35           0 :     virtual void SyncTransaction(const CTransaction &tx, const CBlock *pblock) {}
      36           0 :     virtual void SetBestChain(const CBlockLocator &locator) {}
      37           0 :     virtual void UpdatedTransaction(const uint256 &hash) {}
      38           0 :     virtual void Inventory(const uint256 &hash) {}
      39           0 :     virtual void ResendWalletTransactions(int64_t nBestBlockTime) {}
      40        5457 :     virtual void BlockChecked(const CBlock&, const CValidationState&) {}
      41           0 :     virtual void GetScriptForMining(boost::shared_ptr<CReserveScript>&) {};
      42           0 :     virtual void ResetRequestCount(const uint256 &hash) {};
      43             :     friend void ::RegisterValidationInterface(CValidationInterface*);
      44             :     friend void ::UnregisterValidationInterface(CValidationInterface*);
      45             :     friend void ::UnregisterAllValidationInterfaces();
      46             : };
      47             : 
      48        1920 : struct CMainSignals {
      49             :     /** Notifies listeners of updated block chain tip */
      50             :     boost::signals2::signal<void (const CBlockIndex *)> UpdatedBlockTip;
      51             :     /** Notifies listeners of updated transaction data (transaction, and optionally the block it is found in. */
      52             :     boost::signals2::signal<void (const CTransaction &, const CBlock *)> SyncTransaction;
      53             :     /** Notifies listeners of an updated transaction without new data (for now: a coinbase potentially becoming visible). */
      54             :     boost::signals2::signal<void (const uint256 &)> UpdatedTransaction;
      55             :     /** Notifies listeners of a new active block chain. */
      56             :     boost::signals2::signal<void (const CBlockLocator &)> SetBestChain;
      57             :     /** Notifies listeners about an inventory item being seen on the network. */
      58             :     boost::signals2::signal<void (const uint256 &)> Inventory;
      59             :     /** Tells listeners to broadcast their data. */
      60             :     boost::signals2::signal<void (int64_t nBestBlockTime)> Broadcast;
      61             :     /** Notifies listeners of a block validation result */
      62             :     boost::signals2::signal<void (const CBlock&, const CValidationState&)> BlockChecked;
      63             :     /** Notifies listeners that a key for mining is required (coinbase) */
      64             :     boost::signals2::signal<void (boost::shared_ptr<CReserveScript>&)> ScriptForMining;
      65             :     /** Notifies listeners that a block has been successfully mined */
      66             :     boost::signals2::signal<void (const uint256 &)> BlockFound;
      67             : };
      68             : 
      69             : CMainSignals& GetMainSignals();
      70             : 
      71             : #endif // BITCOIN_VALIDATIONINTERFACE_H

Generated by: LCOV version 1.11