]> Git Repo - VerusCoin.git/blob - src/validationinterface.h
Integrate latest Zcash fixes and update for non-latin user names
[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 #include "zcash/IncrementalMerkleTree.hpp"
12
13 class CBlock;
14 class CBlockIndex;
15 struct CBlockLocator;
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 /** Erase a transaction from all registered wallets */
32 void EraseFromWallets(const uint256 &hash);
33 /** Rescan all registered wallets */
34 void RescanWallets();
35
36 class CValidationInterface {
37 protected:
38     virtual void UpdatedBlockTip(const CBlockIndex *pindex) {}
39     virtual void SyncTransaction(const CTransaction &tx, const CBlock *pblock) {}
40     virtual void EraseFromWallet(const uint256 &hash) {}
41     virtual void RescanWallet() {}
42     virtual void ChainTip(const CBlockIndex *pindex, const CBlock *pblock, SproutMerkleTree sproutTree, SaplingMerkleTree saplingTree, bool added) {}
43     virtual void SetBestChain(const CBlockLocator &locator) {}
44     virtual void UpdatedTransaction(const uint256 &hash) {}
45     virtual void Inventory(const uint256 &hash) {}
46     virtual void ResendWalletTransactions(int64_t nBestBlockTime) {}
47     virtual void BlockChecked(const CBlock&, const CValidationState&) {}
48     friend void ::RegisterValidationInterface(CValidationInterface*);
49     friend void ::UnregisterValidationInterface(CValidationInterface*);
50     friend void ::UnregisterAllValidationInterfaces();
51 };
52
53 struct CMainSignals {
54     /** Notifies listeners of updated block chain tip */
55     boost::signals2::signal<void (const CBlockIndex *)> UpdatedBlockTip;
56     /** Notifies listeners of updated transaction data (transaction, and optionally the block it is found in. */
57     boost::signals2::signal<void (const CTransaction &, const CBlock *)> SyncTransaction;
58     /** Notifies listeners of an erased transaction. */
59     boost::signals2::signal<void (const uint256 &)> EraseTransaction;
60     /** Notifies listeners of the need to rescan the wallet. */
61     boost::signals2::signal<void ()> RescanWallet;
62     /** Notifies listeners of an updated transaction without new data (for now: a coinbase potentially becoming visible). */
63     boost::signals2::signal<void (const uint256 &)> UpdatedTransaction;
64     /** Notifies listeners of a change to the tip of the active block chain. */
65     boost::signals2::signal<void (const CBlockIndex *, const CBlock *, SproutMerkleTree, SaplingMerkleTree, bool)> ChainTip;
66     /** Notifies listeners of a new active block chain. */
67     boost::signals2::signal<void (const CBlockLocator &)> SetBestChain;
68     /** Notifies listeners about an inventory item being seen on the network. */
69     boost::signals2::signal<void (const uint256 &)> Inventory;
70     /** Tells listeners to broadcast their data. */
71     boost::signals2::signal<void (int64_t nBestBlockTime)> Broadcast;
72     /** Notifies listeners of a block validation result */
73     boost::signals2::signal<void (const CBlock&, const CValidationState&)> BlockChecked;
74 };
75
76 CMainSignals& GetMainSignals();
77
78 #endif // BITCOIN_VALIDATIONINTERFACE_H
This page took 0.028825 seconds and 4 git commands to generate.