]>
Commit | Line | Data |
---|---|---|
26c16d9d JT |
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 | #include "validationinterface.h" | |
7 | ||
8 | static CMainSignals g_signals; | |
9 | ||
10 | CMainSignals& GetMainSignals() | |
11 | { | |
12 | return g_signals; | |
13 | } | |
14 | ||
15 | void RegisterValidationInterface(CValidationInterface* pwalletIn) { | |
16 | g_signals.SyncTransaction.connect(boost::bind(&CValidationInterface::SyncTransaction, pwalletIn, _1, _2)); | |
17 | g_signals.EraseTransaction.connect(boost::bind(&CValidationInterface::EraseFromWallet, pwalletIn, _1)); | |
18 | g_signals.UpdatedTransaction.connect(boost::bind(&CValidationInterface::UpdatedTransaction, pwalletIn, _1)); | |
de42390f | 19 | g_signals.ChainTip.connect(boost::bind(&CValidationInterface::ChainTip, pwalletIn, _1, _2, _3, _4)); |
26c16d9d JT |
20 | g_signals.SetBestChain.connect(boost::bind(&CValidationInterface::SetBestChain, pwalletIn, _1)); |
21 | g_signals.Inventory.connect(boost::bind(&CValidationInterface::Inventory, pwalletIn, _1)); | |
0f5954c4 | 22 | g_signals.Broadcast.connect(boost::bind(&CValidationInterface::ResendWalletTransactions, pwalletIn, _1)); |
26c16d9d JT |
23 | g_signals.BlockChecked.connect(boost::bind(&CValidationInterface::BlockChecked, pwalletIn, _1, _2)); |
24 | } | |
25 | ||
26 | void UnregisterValidationInterface(CValidationInterface* pwalletIn) { | |
27 | g_signals.BlockChecked.disconnect(boost::bind(&CValidationInterface::BlockChecked, pwalletIn, _1, _2)); | |
0f5954c4 | 28 | g_signals.Broadcast.disconnect(boost::bind(&CValidationInterface::ResendWalletTransactions, pwalletIn, _1)); |
26c16d9d | 29 | g_signals.Inventory.disconnect(boost::bind(&CValidationInterface::Inventory, pwalletIn, _1)); |
de42390f | 30 | g_signals.ChainTip.disconnect(boost::bind(&CValidationInterface::ChainTip, pwalletIn, _1, _2, _3, _4)); |
26c16d9d JT |
31 | g_signals.SetBestChain.disconnect(boost::bind(&CValidationInterface::SetBestChain, pwalletIn, _1)); |
32 | g_signals.UpdatedTransaction.disconnect(boost::bind(&CValidationInterface::UpdatedTransaction, pwalletIn, _1)); | |
33 | g_signals.EraseTransaction.disconnect(boost::bind(&CValidationInterface::EraseFromWallet, pwalletIn, _1)); | |
34 | g_signals.SyncTransaction.disconnect(boost::bind(&CValidationInterface::SyncTransaction, pwalletIn, _1, _2)); | |
35 | } | |
36 | ||
37 | void UnregisterAllValidationInterfaces() { | |
38 | g_signals.BlockChecked.disconnect_all_slots(); | |
39 | g_signals.Broadcast.disconnect_all_slots(); | |
40 | g_signals.Inventory.disconnect_all_slots(); | |
769e031c | 41 | g_signals.ChainTip.disconnect_all_slots(); |
26c16d9d JT |
42 | g_signals.SetBestChain.disconnect_all_slots(); |
43 | g_signals.UpdatedTransaction.disconnect_all_slots(); | |
44 | g_signals.EraseTransaction.disconnect_all_slots(); | |
45 | g_signals.SyncTransaction.disconnect_all_slots(); | |
46 | } | |
47 | ||
48 | void SyncWithWallets(const CTransaction &tx, const CBlock *pblock) { | |
49 | g_signals.SyncTransaction(tx, pblock); | |
50 | } |