Dogecoin Core  1.14.2
P2P Digital Currency
validationinterface.h
Go to the documentation of this file.
1 // Copyright (c) 2009-2010 Satoshi Nakamoto
2 // Copyright (c) 2009-2016 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 #include <memory>
12 
13 class CBlock;
14 class CBlockIndex;
15 struct CBlockLocator;
16 class CBlockIndex;
17 class CConnman;
18 class CReserveScript;
19 class CTransaction;
21 class CValidationState;
22 class uint256;
23 
24 // These functions dispatch to one or all registered wallets
25 
32 
34 protected:
35  virtual void UpdatedBlockTip(const CBlockIndex *pindexNew, const CBlockIndex *pindexFork, bool fInitialDownload) {}
36  virtual void SyncTransaction(const CTransaction &tx, const CBlockIndex *pindex, int posInBlock) {}
37  virtual void SetBestChain(const CBlockLocator &locator) {}
38  virtual void UpdatedTransaction(const uint256 &hash) {}
39  virtual void Inventory(const uint256 &hash) {}
40  virtual void ResendWalletTransactions(int64_t nBestBlockTime, CConnman* connman) {}
41  virtual void BlockChecked(const CBlock&, const CValidationState&) {}
42  virtual void GetScriptForMining(boost::shared_ptr<CReserveScript>&) {};
43  virtual void ResetRequestCount(const uint256 &hash) {};
44  virtual void NewPoWValidBlock(const CBlockIndex *pindex, const std::shared_ptr<const CBlock>& block) {};
48 };
49 
50 struct CMainSignals {
52  boost::signals2::signal<void (const CBlockIndex *, const CBlockIndex *, bool fInitialDownload)> UpdatedBlockTip;
56  static const int SYNC_TRANSACTION_NOT_IN_BLOCK = -1;
63  boost::signals2::signal<void (const CTransaction &, const CBlockIndex *pindex, int posInBlock)> SyncTransaction;
65  boost::signals2::signal<void (const uint256 &)> UpdatedTransaction;
67  boost::signals2::signal<void (const CBlockLocator &)> SetBestChain;
69  boost::signals2::signal<void (const uint256 &)> Inventory;
71  boost::signals2::signal<void (int64_t nBestBlockTime, CConnman* connman)> Broadcast;
73  boost::signals2::signal<void (const CBlock&, const CValidationState&)> BlockChecked;
75  boost::signals2::signal<void (boost::shared_ptr<CReserveScript>&)> ScriptForMining;
77  boost::signals2::signal<void (const uint256 &)> BlockFound;
81  boost::signals2::signal<void (const CBlockIndex *, const std::shared_ptr<const CBlock>&)> NewPoWValidBlock;
82 };
83 
85 
86 #endif // BITCOIN_VALIDATIONINTERFACE_H
Definition: block.h:67
The block chain is a tree shaped structure starting with the genesis block at the root,...
Definition: chain.h:158
Definition: net.h:125
The basic transaction that is broadcasted on the network and contained in blocks.
Definition: transaction.h:308
virtual void NewPoWValidBlock(const CBlockIndex *pindex, const std::shared_ptr< const CBlock > &block)
virtual void GetScriptForMining(boost::shared_ptr< CReserveScript > &)
virtual void ResendWalletTransactions(int64_t nBestBlockTime, CConnman *connman)
virtual void SyncTransaction(const CTransaction &tx, const CBlockIndex *pindex, int posInBlock)
virtual void UpdatedBlockTip(const CBlockIndex *pindexNew, const CBlockIndex *pindexFork, bool fInitialDownload)
virtual void UpdatedTransaction(const uint256 &hash)
virtual void SetBestChain(const CBlockLocator &locator)
virtual void Inventory(const uint256 &hash)
virtual void BlockChecked(const CBlock &, const CValidationState &)
virtual void ResetRequestCount(const uint256 &hash)
Capture information about block/transaction validation.
Definition: validation.h:22
256-bit opaque blob.
Definition: uint256.h:123
Describes a place in the block chain to another node such that if the other node doesn't have the sam...
Definition: block.h:130
boost::signals2::signal< void(const CBlockLocator &)> SetBestChain
Notifies listeners of a new active block chain.
boost::signals2::signal< void(const uint256 &)> BlockFound
Notifies listeners that a block has been successfully mined.
boost::signals2::signal< void(const uint256 &)> Inventory
Notifies listeners about an inventory item being seen on the network.
boost::signals2::signal< void(boost::shared_ptr< CReserveScript > &)> ScriptForMining
Notifies listeners that a key for mining is required (coinbase)
boost::signals2::signal< void(const uint256 &)> UpdatedTransaction
Notifies listeners of an updated transaction without new data (for now: a coinbase potentially becomi...
static const int SYNC_TRANSACTION_NOT_IN_BLOCK
A posInBlock value for SyncTransaction calls for tranactions not included in connected blocks such as...
boost::signals2::signal< void(const CBlock &, const CValidationState &)> BlockChecked
Notifies listeners of a block validation result.
boost::signals2::signal< void(const CBlockIndex *, const std::shared_ptr< const CBlock > &)> NewPoWValidBlock
Notifies listeners that a block which builds directly on our current tip has been received and connec...
boost::signals2::signal< void(int64_t nBestBlockTime, CConnman *connman)> Broadcast
Tells listeners to broadcast their data.
boost::signals2::signal< void(const CBlockIndex *, const CBlockIndex *, bool fInitialDownload)> UpdatedBlockTip
Notifies listeners of updated block chain tip.
boost::signals2::signal< void(const CTransaction &, const CBlockIndex *pindex, int posInBlock)> SyncTransaction
Notifies listeners of updated transaction data (transaction, and optionally the block it is found in)...
CMainSignals & GetMainSignals()
void UnregisterValidationInterface(CValidationInterface *pwalletIn)
Unregister a wallet from core.
void UnregisterAllValidationInterfaces()
Unregister all wallets from core.
void RegisterValidationInterface(CValidationInterface *pwalletIn)
Register a wallet to receive updates from core.