forked from dogecoin/dogecoin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvalidationinterface.cpp
83 lines (76 loc) · 5.17 KB
/
validationinterface.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
// Copyright (c) 2009-2010 Satoshi Nakamoto
// Copyright (c) 2009-2016 The Bitcoin Core developers
// Copyright (c) 2022 The Dogecoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include "validationinterface.h"
#include <boost/bind/bind.hpp>
static CMainSignals g_signals;
CMainSignals& GetMainSignals()
{
return g_signals;
}
void RegisterValidationInterface(CValidationInterface* pwalletIn) {
g_signals.UpdatedBlockTip.connect(boost::bind(&CValidationInterface::UpdatedBlockTip,
pwalletIn, boost::placeholders::_1,
boost::placeholders::_2,
boost::placeholders::_3));
g_signals.SyncTransaction.connect(boost::bind(&CValidationInterface::SyncTransaction,
pwalletIn, boost::placeholders::_1,
boost::placeholders::_2,
boost::placeholders::_3));
g_signals.UpdatedTransaction.connect(boost::bind(&CValidationInterface::UpdatedTransaction,
pwalletIn, boost::placeholders::_1));
g_signals.SetBestChain.connect(boost::bind(&CValidationInterface::SetBestChain,
pwalletIn, boost::placeholders::_1));
g_signals.Broadcast.connect(boost::bind(&CValidationInterface::ResendWalletTransactions,
pwalletIn, boost::placeholders::_1, boost::placeholders::_2));
g_signals.BlockChecked.connect(boost::bind(&CValidationInterface::BlockChecked,
pwalletIn, boost::placeholders::_1,
boost::placeholders::_2));
g_signals.ScriptForMining.connect(boost::bind(&CValidationInterface::GetScriptForMining,
pwalletIn, boost::placeholders::_1));
g_signals.BlockFound.connect(boost::bind(&CValidationInterface::ResetRequestCount,
pwalletIn, boost::placeholders::_1));
g_signals.NewPoWValidBlock.connect(boost::bind(&CValidationInterface::NewPoWValidBlock,
pwalletIn, boost::placeholders::_1,
boost::placeholders::_2));
}
void UnregisterValidationInterface(CValidationInterface* pwalletIn) {
g_signals.BlockFound.disconnect(boost::bind(&CValidationInterface::ResetRequestCount,
pwalletIn, boost::placeholders::_1));
g_signals.ScriptForMining.disconnect(boost::bind(&CValidationInterface::GetScriptForMining,
pwalletIn, boost::placeholders::_1));
g_signals.BlockChecked.disconnect(boost::bind(&CValidationInterface::BlockChecked,
pwalletIn, boost::placeholders::_1,
boost::placeholders::_2));
g_signals.Broadcast.disconnect(boost::bind(&CValidationInterface::ResendWalletTransactions,
pwalletIn, boost::placeholders::_1,
boost::placeholders::_2));
g_signals.SetBestChain.disconnect(boost::bind(&CValidationInterface::SetBestChain,
pwalletIn, boost::placeholders::_1));
g_signals.UpdatedTransaction.disconnect(boost::bind(&CValidationInterface::UpdatedTransaction,
pwalletIn, boost::placeholders::_1));
g_signals.SyncTransaction.disconnect(boost::bind(&CValidationInterface::SyncTransaction,
pwalletIn, boost::placeholders::_1,
boost::placeholders::_2,
boost::placeholders::_3));
g_signals.UpdatedBlockTip.disconnect(boost::bind(&CValidationInterface::UpdatedBlockTip,
pwalletIn, boost::placeholders::_1,
boost::placeholders::_2,
boost::placeholders::_3));
g_signals.NewPoWValidBlock.disconnect(boost::bind(&CValidationInterface::NewPoWValidBlock,
pwalletIn, boost::placeholders::_1,
boost::placeholders::_2));
}
void UnregisterAllValidationInterfaces() {
g_signals.BlockFound.disconnect_all_slots();
g_signals.ScriptForMining.disconnect_all_slots();
g_signals.BlockChecked.disconnect_all_slots();
g_signals.Broadcast.disconnect_all_slots();
g_signals.SetBestChain.disconnect_all_slots();
g_signals.UpdatedTransaction.disconnect_all_slots();
g_signals.SyncTransaction.disconnect_all_slots();
g_signals.UpdatedBlockTip.disconnect_all_slots();
g_signals.NewPoWValidBlock.disconnect_all_slots();
}