Raven Core  3.0.0
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 // Copyright (c) 2017-2019 The Raven Core developers
4 // Distributed under the MIT software license, see the accompanying
5 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
6 
7 #ifndef RAVEN_VALIDATIONINTERFACE_H
8 #define RAVEN_VALIDATIONINTERFACE_H
9 
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 class CMessage;
25 
26 // These functions dispatch to one or all registered wallets
27 
34 
36 protected:
38  virtual void UpdatedBlockTip(const CBlockIndex *pindexNew, const CBlockIndex *pindexFork, bool fInitialDownload) {}
40  virtual void TransactionAddedToMempool(const CTransactionRef &ptxn) {}
45  virtual void BlockConnected(const std::shared_ptr<const CBlock> &block, const CBlockIndex *pindex, const std::vector<CTransactionRef> &txnConflicted) {}
47  virtual void BlockDisconnected(const std::shared_ptr<const CBlock> &block) {}
49  virtual void SetBestChain(const CBlockLocator &locator) {}
51  virtual void Inventory(const uint256 &hash) {}
53  virtual void ResendWalletTransactions(int64_t nBestBlockTime, CConnman* connman) {}
60  virtual void BlockChecked(const CBlock&, const CValidationState&) {}
64  virtual void NewPoWValidBlock(const CBlockIndex *pindex, const std::shared_ptr<const CBlock>& block) {};
65 
66  virtual void BlockFound(const uint256 &hash) {};
67  virtual void NewAssetMessage(const CMessage &message) {};
68 
69 // virtual void GetScriptForMining(std::shared_ptr<CReserveScript>&) {};
70 
74 };
75 
76 struct MainSignalsInstance;
77 
78 class CMainSignals {
79 private:
80  std::unique_ptr<MainSignalsInstance> m_internals;
81 
85 
86 public:
88  void RegisterBackgroundSignalScheduler(CScheduler& scheduler);
90  void UnregisterBackgroundSignalScheduler();
92  void FlushBackgroundCallbacks();
93 
94  void UpdatedBlockTip(const CBlockIndex *, const CBlockIndex *, bool fInitialDownload);
96  void BlockConnected(const std::shared_ptr<const CBlock> &, const CBlockIndex *pindex, const std::vector<CTransactionRef> &);
97  void BlockDisconnected(const std::shared_ptr<const CBlock> &);
98  void SetBestChain(const CBlockLocator &);
99  void Inventory(const uint256 &);
100  void Broadcast(int64_t nBestBlockTime, CConnman* connman);
101  void BlockChecked(const CBlock&, const CValidationState&);
102  void NewPoWValidBlock(const CBlockIndex *, const std::shared_ptr<const CBlock>&);
103  void BlockFound(const uint256 &);
104  void NewAssetMessage(const CMessage&);
105 // void ScriptForMining(std::shared_ptr<CReserveScript>&);
106 
107 };
108 
110 
111 #endif // RAVEN_VALIDATIONINTERFACE_H
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:132
Definition: block.h:73
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.
std::shared_ptr< const CTransaction > CTransactionRef
Definition: transaction.h:436
virtual void NewAssetMessage(const CMessage &message)
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
CMainSignals & GetMainSignals()
virtual void BlockFound(const uint256 &hash)
RVN END.
Definition: validation.h:30
256-bit opaque blob.
Definition: uint256.h:123
The block chain is a tree shaped structure starting with the genesis block at the root...
Definition: chain.h:172
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.
void UnregisterValidationInterface(CValidationInterface *pwalletIn)
Unregister a wallet from core.