]> Git Repo - VerusCoin.git/blob - src/validationinterface.h
Merge pull request #5511
[VerusCoin.git] / src / validationinterface.h
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
11 class CBlock;
12 struct CBlockLocator;
13 class CTransaction;
14 class CValidationInterface;
15 class CValidationState;
16 class uint256;
17
18 // These functions dispatch to one or all registered wallets
19
20 /** Register a wallet to receive updates from core */
21 void RegisterValidationInterface(CValidationInterface* pwalletIn);
22 /** Unregister a wallet from core */
23 void UnregisterValidationInterface(CValidationInterface* pwalletIn);
24 /** Unregister all wallets from core */
25 void UnregisterAllValidationInterfaces();
26 /** Push an updated transaction to all registered wallets */
27 void SyncWithWallets(const CTransaction& tx, const CBlock* pblock = NULL);
28
29 class CValidationInterface {
30 protected:
31     virtual void SyncTransaction(const CTransaction &tx, const CBlock *pblock) {};
32     virtual void EraseFromWallet(const uint256 &hash) {};
33     virtual void SetBestChain(const CBlockLocator &locator) {};
34     virtual void UpdatedTransaction(const uint256 &hash) {};
35     virtual void Inventory(const uint256 &hash) {};
36     virtual void ResendWalletTransactions(int64_t nBestBlockTime) {};
37     virtual void BlockChecked(const CBlock&, const CValidationState&) {};
38     friend void ::RegisterValidationInterface(CValidationInterface*);
39     friend void ::UnregisterValidationInterface(CValidationInterface*);
40     friend void ::UnregisterAllValidationInterfaces();
41 };
42
43 struct CMainSignals {
44     /** Notifies listeners of updated transaction data (transaction, and optionally the block it is found in. */
45     boost::signals2::signal<void (const CTransaction &, const CBlock *)> SyncTransaction;
46     /** Notifies listeners of an erased transaction (currently disabled, requires transaction replacement). */
47     boost::signals2::signal<void (const uint256 &)> EraseTransaction;
48     /** Notifies listeners of an updated transaction without new data (for now: a coinbase potentially becoming visible). */
49     boost::signals2::signal<void (const uint256 &)> UpdatedTransaction;
50     /** Notifies listeners of a new active block chain. */
51     boost::signals2::signal<void (const CBlockLocator &)> SetBestChain;
52     /** Notifies listeners about an inventory item being seen on the network. */
53     boost::signals2::signal<void (const uint256 &)> Inventory;
54     /** Tells listeners to broadcast their data. */
55     boost::signals2::signal<void (int64_t nBestBlockTime)> Broadcast;
56     /** Notifies listeners of a block validation result */
57     boost::signals2::signal<void (const CBlock&, const CValidationState&)> BlockChecked;
58 };
59
60 CMainSignals& GetMainSignals();
61
62 #endif // BITCOIN_VALIDATIONINTERFACE_H
This page took 0.02718 seconds and 4 git commands to generate.