2015-02-05 01:11:44 +01:00
|
|
|
// Copyright (c) 2009-2010 Satoshi Nakamoto
|
|
|
|
// Copyright (c) 2009-2014 The Bitcoin 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"
|
|
|
|
|
|
|
|
static CMainSignals g_signals;
|
|
|
|
|
|
|
|
CMainSignals& GetMainSignals()
|
|
|
|
{
|
|
|
|
return g_signals;
|
|
|
|
}
|
|
|
|
|
|
|
|
void RegisterValidationInterface(CValidationInterface* pwalletIn) {
|
2015-05-07 16:49:00 +02:00
|
|
|
g_signals.UpdatedBlockTip.connect(boost::bind(&CValidationInterface::UpdatedBlockTip, pwalletIn, _1));
|
2015-07-27 15:33:03 +02:00
|
|
|
g_signals.SyncTransaction.connect(boost::bind(&CValidationInterface::SyncTransaction, pwalletIn, _1, _2, _3));
|
2015-02-05 01:11:44 +01:00
|
|
|
g_signals.UpdatedTransaction.connect(boost::bind(&CValidationInterface::UpdatedTransaction, pwalletIn, _1));
|
|
|
|
g_signals.SetBestChain.connect(boost::bind(&CValidationInterface::SetBestChain, pwalletIn, _1));
|
|
|
|
g_signals.Inventory.connect(boost::bind(&CValidationInterface::Inventory, pwalletIn, _1));
|
2015-03-23 18:47:18 +01:00
|
|
|
g_signals.Broadcast.connect(boost::bind(&CValidationInterface::ResendWalletTransactions, pwalletIn, _1));
|
2015-02-05 01:11:44 +01:00
|
|
|
g_signals.BlockChecked.connect(boost::bind(&CValidationInterface::BlockChecked, pwalletIn, _1, _2));
|
2015-04-10 12:49:01 +02:00
|
|
|
g_signals.ScriptForMining.connect(boost::bind(&CValidationInterface::GetScriptForMining, pwalletIn, _1));
|
2015-07-01 16:06:49 +02:00
|
|
|
g_signals.BlockFound.connect(boost::bind(&CValidationInterface::ResetRequestCount, pwalletIn, _1));
|
2015-02-05 01:11:44 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void UnregisterValidationInterface(CValidationInterface* pwalletIn) {
|
2015-07-01 16:06:49 +02:00
|
|
|
g_signals.BlockFound.disconnect(boost::bind(&CValidationInterface::ResetRequestCount, pwalletIn, _1));
|
2015-04-10 12:49:01 +02:00
|
|
|
g_signals.ScriptForMining.disconnect(boost::bind(&CValidationInterface::GetScriptForMining, pwalletIn, _1));
|
2015-02-05 01:11:44 +01:00
|
|
|
g_signals.BlockChecked.disconnect(boost::bind(&CValidationInterface::BlockChecked, pwalletIn, _1, _2));
|
2015-03-23 18:47:18 +01:00
|
|
|
g_signals.Broadcast.disconnect(boost::bind(&CValidationInterface::ResendWalletTransactions, pwalletIn, _1));
|
2015-02-05 01:11:44 +01:00
|
|
|
g_signals.Inventory.disconnect(boost::bind(&CValidationInterface::Inventory, pwalletIn, _1));
|
|
|
|
g_signals.SetBestChain.disconnect(boost::bind(&CValidationInterface::SetBestChain, pwalletIn, _1));
|
|
|
|
g_signals.UpdatedTransaction.disconnect(boost::bind(&CValidationInterface::UpdatedTransaction, pwalletIn, _1));
|
2015-07-27 15:33:03 +02:00
|
|
|
g_signals.SyncTransaction.disconnect(boost::bind(&CValidationInterface::SyncTransaction, pwalletIn, _1, _2, _3));
|
2015-05-07 16:49:00 +02:00
|
|
|
g_signals.UpdatedBlockTip.disconnect(boost::bind(&CValidationInterface::UpdatedBlockTip, pwalletIn, _1));
|
2015-02-05 01:11:44 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void UnregisterAllValidationInterfaces() {
|
2015-04-10 12:49:01 +02:00
|
|
|
g_signals.BlockFound.disconnect_all_slots();
|
|
|
|
g_signals.ScriptForMining.disconnect_all_slots();
|
2015-02-05 01:11:44 +01:00
|
|
|
g_signals.BlockChecked.disconnect_all_slots();
|
|
|
|
g_signals.Broadcast.disconnect_all_slots();
|
|
|
|
g_signals.Inventory.disconnect_all_slots();
|
|
|
|
g_signals.SetBestChain.disconnect_all_slots();
|
|
|
|
g_signals.UpdatedTransaction.disconnect_all_slots();
|
|
|
|
g_signals.SyncTransaction.disconnect_all_slots();
|
2015-05-07 16:49:00 +02:00
|
|
|
g_signals.UpdatedBlockTip.disconnect_all_slots();
|
2015-02-05 01:11:44 +01:00
|
|
|
}
|
|
|
|
|
2016-04-26 13:55:13 +02:00
|
|
|
void SyncWithWallets(const CTransaction &tx, const CBlockIndex *pindex, int posInBlock) {
|
|
|
|
g_signals.SyncTransaction(tx, pindex, posInBlock);
|
2015-02-05 01:11:44 +01:00
|
|
|
}
|