Fabcoin Core  0.16.2
P2P Digital Currency
validationinterface.h
Go to the documentation of this file.
1 // Copyright (c) 2009-2010 Satoshi Nakamoto
2 // Copyright (c) 2009-2017 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 FABCOIN_VALIDATIONINTERFACE_H
7 #define FABCOIN_VALIDATIONINTERFACE_H
8 #include <boost/signals2/signal.hpp>
9 #include <boost/shared_ptr.hpp>
10 #include <memory>
11 
12 #include <primitives/transaction.h> // CTransaction(Ref)
13 
14 class CBlock;
15 class CBlockIndex;
16 struct CBlockLocator;
17 class CBlockIndex;
18 class CConnman;
19 class CReserveScript;
21 class CValidationState;
22 class uint256;
23 class CScheduler;
24 
25 // These functions dispatch to one or all registered wallets
26 
33 
35 protected:
37  virtual void UpdatedBlockTip(const CBlockIndex *pindexNew, const CBlockIndex *pindexFork, bool fInitialDownload) {}
39  virtual void TransactionAddedToMempool(const CTransactionRef &ptxn) {}
44  virtual void BlockConnected(const std::shared_ptr<const CBlock> &block, const CBlockIndex *pindex, const std::vector<CTransactionRef> &txnConflicted) {}
46  virtual void BlockDisconnected(const std::shared_ptr<const CBlock> &block) {}
47  virtual void SyncTransaction(const CTransaction &tx, const CBlockIndex *pindex, int posInBlock) {}
48  virtual void UpdatedTransaction(const uint256 &hash) {}
50  virtual void SetBestChain(const CBlockLocator &locator) {}
52  virtual void Inventory(const uint256 &hash) {}
54  virtual void ResendWalletTransactions(int64_t nBestBlockTime, CConnman* connman) {}
61  virtual void BlockChecked(const CBlock&, const CValidationState&) {}
65  virtual void NewPoWValidBlock(const CBlockIndex *pindex, const std::shared_ptr<const CBlock>& block) {};
66  virtual void GetScriptForMining(std::shared_ptr<CReserveScript> &coinbaseScript){};
67  virtual void ResetRequestCount(const uint256 &){};
71 };
72 
73 struct MainSignalsInstance;
74 class CMainSignals {
75 private:
76  std::unique_ptr<MainSignalsInstance> m_internals;
77 
81 
82 public:
83  static const int SYNC_TRANSACTION_NOT_IN_BLOCK = -1;
84  boost::signals2::signal<void (const CTransaction &, const CBlockIndex *pindex, int posInBlock)> SyncTransaction;
85  boost::signals2::signal<void (const uint256 &)> UpdatedTransaction;
87  void RegisterBackgroundSignalScheduler(CScheduler& scheduler);
89  void UnregisterBackgroundSignalScheduler();
91  void FlushBackgroundCallbacks();
92 
93  void UpdatedBlockTip(const CBlockIndex *, const CBlockIndex *, bool fInitialDownload);
95  void BlockConnected(const std::shared_ptr<const CBlock> &, const CBlockIndex *pindex, const std::vector<CTransactionRef> &);
96  void BlockDisconnected(const std::shared_ptr<const CBlock> &);
97  void SetBestChain(const CBlockLocator &);
98  void Inventory(const uint256 &);
99  void Broadcast(int64_t nBestBlockTime, CConnman* connman);
100  void BlockChecked(const CBlock&, const CValidationState&);
101  void NewPoWValidBlock(const CBlockIndex *, const std::shared_ptr<const CBlock>&);
102  void ScriptForMining(std::shared_ptr<CReserveScript> &coinbaseScript);
103  void BlockFound(const uint256 &);
104 };
105 
107 
108 #endif // FABCOIN_VALIDATIONINTERFACE_H
virtual void ResetRequestCount(const uint256 &)
std::unique_ptr< MainSignalsInstance > m_internals
virtual void BlockChecked(const CBlock &, const CValidationState &)
Notifies listeners of a block validation result.
Describes a place in the block chain to another node such that if the other node doesn&#39;t have the sam...
Definition: block.h:251
Definition: block.h:155
boost::signals2::signal< void(const uint256 &)> UpdatedTransaction
virtual void SyncTransaction(const CTransaction &tx, const CBlockIndex *pindex, int posInBlock)
virtual void ResendWalletTransactions(int64_t nBestBlockTime, CConnman *connman)
Tells listeners to broadcast their data.
virtual void NewPoWValidBlock(const CBlockIndex *pindex, const std::shared_ptr< const CBlock > &block)
Notifies listeners that a block which builds directly on our current tip has been received and connec...
virtual void SetBestChain(const CBlockLocator &locator)
Notifies listeners of the new active block chain on-disk.
boost::signals2::signal< void(const CTransaction &, const CBlockIndex *pindex, int posInBlock)> SyncTransaction
std::shared_ptr< const CTransaction > CTransactionRef
Definition: transaction.h:437
virtual void BlockDisconnected(const std::shared_ptr< const CBlock > &block)
Notifies listeners of a block being disconnected.
virtual void Inventory(const uint256 &hash)
Notifies listeners about an inventory item being seen on the network.
void RegisterValidationInterface(CValidationInterface *pwalletIn)
Register a wallet to receive updates from core.
virtual void UpdatedBlockTip(const CBlockIndex *pindexNew, const CBlockIndex *pindexFork, bool fInitialDownload)
Notifies listeners of updated block chain tip.
Definition: net.h:120
virtual void GetScriptForMining(std::shared_ptr< CReserveScript > &coinbaseScript)
CMainSignals & GetMainSignals()
Capture information about block/transaction validation.
Definition: validation.h:27
256-bit opaque blob.
Definition: uint256.h:132
The block chain is a tree shaped structure starting with the genesis block at the root...
Definition: chain.h:177
void UnregisterAllValidationInterfaces()
Unregister all wallets from core.
virtual void TransactionAddedToMempool(const CTransactionRef &ptxn)
Notifies listeners of a transaction having been added to mempool.
virtual void BlockConnected(const std::shared_ptr< const CBlock > &block, const CBlockIndex *pindex, const std::vector< CTransactionRef > &txnConflicted)
Notifies listeners of a block being connected.
The basic transaction that is broadcasted on the network and contained in blocks. ...
Definition: transaction.h:275
void UnregisterValidationInterface(CValidationInterface *pwalletIn)
Unregister a wallet from core.
virtual void UpdatedTransaction(const uint256 &hash)