1 // Copyright (c) 2009-2010 Satoshi Nakamoto
2 // Copyright (c) 2009-2016 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.
6 #include "validationinterface.h"
8 static CMainSignals g_signals
;
10 CMainSignals
& GetMainSignals()
15 void RegisterValidationInterface(CValidationInterface
* pwalletIn
) {
16 g_signals
.UpdatedBlockTip
.connect(boost::bind(&CValidationInterface::UpdatedBlockTip
, pwalletIn
, _1
, _2
, _3
));
17 g_signals
.TransactionAddedToMempool
.connect(boost::bind(&CValidationInterface::TransactionAddedToMempool
, pwalletIn
, _1
));
18 g_signals
.BlockConnected
.connect(boost::bind(&CValidationInterface::BlockConnected
, pwalletIn
, _1
, _2
, _3
));
19 g_signals
.BlockDisconnected
.connect(boost::bind(&CValidationInterface::BlockDisconnected
, pwalletIn
, _1
));
20 g_signals
.SetBestChain
.connect(boost::bind(&CValidationInterface::SetBestChain
, pwalletIn
, _1
));
21 g_signals
.Inventory
.connect(boost::bind(&CValidationInterface::Inventory
, pwalletIn
, _1
));
22 g_signals
.Broadcast
.connect(boost::bind(&CValidationInterface::ResendWalletTransactions
, pwalletIn
, _1
, _2
));
23 g_signals
.BlockChecked
.connect(boost::bind(&CValidationInterface::BlockChecked
, pwalletIn
, _1
, _2
));
24 g_signals
.ScriptForMining
.connect(boost::bind(&CValidationInterface::GetScriptForMining
, pwalletIn
, _1
));
25 g_signals
.NewPoWValidBlock
.connect(boost::bind(&CValidationInterface::NewPoWValidBlock
, pwalletIn
, _1
, _2
));
28 void UnregisterValidationInterface(CValidationInterface
* pwalletIn
) {
29 g_signals
.ScriptForMining
.disconnect(boost::bind(&CValidationInterface::GetScriptForMining
, pwalletIn
, _1
));
30 g_signals
.BlockChecked
.disconnect(boost::bind(&CValidationInterface::BlockChecked
, pwalletIn
, _1
, _2
));
31 g_signals
.Broadcast
.disconnect(boost::bind(&CValidationInterface::ResendWalletTransactions
, pwalletIn
, _1
, _2
));
32 g_signals
.Inventory
.disconnect(boost::bind(&CValidationInterface::Inventory
, pwalletIn
, _1
));
33 g_signals
.SetBestChain
.disconnect(boost::bind(&CValidationInterface::SetBestChain
, pwalletIn
, _1
));
34 g_signals
.TransactionAddedToMempool
.disconnect(boost::bind(&CValidationInterface::TransactionAddedToMempool
, pwalletIn
, _1
));
35 g_signals
.BlockConnected
.disconnect(boost::bind(&CValidationInterface::BlockConnected
, pwalletIn
, _1
, _2
, _3
));
36 g_signals
.BlockDisconnected
.disconnect(boost::bind(&CValidationInterface::BlockDisconnected
, pwalletIn
, _1
));
37 g_signals
.UpdatedBlockTip
.disconnect(boost::bind(&CValidationInterface::UpdatedBlockTip
, pwalletIn
, _1
, _2
, _3
));
38 g_signals
.NewPoWValidBlock
.disconnect(boost::bind(&CValidationInterface::NewPoWValidBlock
, pwalletIn
, _1
, _2
));
41 void UnregisterAllValidationInterfaces() {
42 g_signals
.ScriptForMining
.disconnect_all_slots();
43 g_signals
.BlockChecked
.disconnect_all_slots();
44 g_signals
.Broadcast
.disconnect_all_slots();
45 g_signals
.Inventory
.disconnect_all_slots();
46 g_signals
.SetBestChain
.disconnect_all_slots();
47 g_signals
.TransactionAddedToMempool
.disconnect_all_slots();
48 g_signals
.BlockConnected
.disconnect_all_slots();
49 g_signals
.BlockDisconnected
.disconnect_all_slots();
50 g_signals
.UpdatedBlockTip
.disconnect_all_slots();
51 g_signals
.NewPoWValidBlock
.disconnect_all_slots();