|
|
|
@ -152,6 +152,8 @@ struct CMainSignals {
@@ -152,6 +152,8 @@ struct CMainSignals {
|
|
|
|
|
boost::signals2::signal<void (const uint256 &)> Inventory; |
|
|
|
|
// Tells listeners to broadcast their data.
|
|
|
|
|
boost::signals2::signal<void ()> Broadcast; |
|
|
|
|
// Notifies listeners of a block validation result
|
|
|
|
|
boost::signals2::signal<void (const CBlock&, const CValidationState&)> BlockChecked; |
|
|
|
|
} g_signals; |
|
|
|
|
|
|
|
|
|
} // anon namespace
|
|
|
|
@ -163,9 +165,11 @@ void RegisterValidationInterface(CValidationInterface* pwalletIn) {
@@ -163,9 +165,11 @@ void RegisterValidationInterface(CValidationInterface* pwalletIn) {
|
|
|
|
|
g_signals.SetBestChain.connect(boost::bind(&CValidationInterface::SetBestChain, pwalletIn, _1)); |
|
|
|
|
g_signals.Inventory.connect(boost::bind(&CValidationInterface::Inventory, pwalletIn, _1)); |
|
|
|
|
g_signals.Broadcast.connect(boost::bind(&CValidationInterface::ResendWalletTransactions, pwalletIn)); |
|
|
|
|
g_signals.BlockChecked.connect(boost::bind(&CValidationInterface::BlockChecked, pwalletIn, _1, _2)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void UnregisterValidationInterface(CValidationInterface* pwalletIn) { |
|
|
|
|
g_signals.BlockChecked.disconnect(boost::bind(&CValidationInterface::BlockChecked, pwalletIn, _1, _2)); |
|
|
|
|
g_signals.Broadcast.disconnect(boost::bind(&CValidationInterface::ResendWalletTransactions, pwalletIn)); |
|
|
|
|
g_signals.Inventory.disconnect(boost::bind(&CValidationInterface::Inventory, pwalletIn, _1)); |
|
|
|
|
g_signals.SetBestChain.disconnect(boost::bind(&CValidationInterface::SetBestChain, pwalletIn, _1)); |
|
|
|
@ -175,6 +179,7 @@ void UnregisterValidationInterface(CValidationInterface* pwalletIn) {
@@ -175,6 +179,7 @@ void UnregisterValidationInterface(CValidationInterface* pwalletIn) {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void UnregisterAllValidationInterfaces() { |
|
|
|
|
g_signals.BlockChecked.disconnect_all_slots(); |
|
|
|
|
g_signals.Broadcast.disconnect_all_slots(); |
|
|
|
|
g_signals.Inventory.disconnect_all_slots(); |
|
|
|
|
g_signals.SetBestChain.disconnect_all_slots(); |
|
|
|
@ -1868,7 +1873,9 @@ bool static ConnectTip(CValidationState &state, CBlockIndex *pindexNew, CBlock *
@@ -1868,7 +1873,9 @@ bool static ConnectTip(CValidationState &state, CBlockIndex *pindexNew, CBlock *
|
|
|
|
|
{ |
|
|
|
|
CCoinsViewCache view(pcoinsTip); |
|
|
|
|
CInv inv(MSG_BLOCK, pindexNew->GetBlockHash()); |
|
|
|
|
if (!ConnectBlock(*pblock, state, pindexNew, view)) { |
|
|
|
|
bool rv = ConnectBlock(*pblock, state, pindexNew, view); |
|
|
|
|
g_signals.BlockChecked(*pblock, state); |
|
|
|
|
if (!rv) { |
|
|
|
|
if (state.IsInvalid()) |
|
|
|
|
InvalidBlockFound(pindexNew, state); |
|
|
|
|
return error("ConnectTip() : ConnectBlock %s failed", pindexNew->GetBlockHash().ToString()); |
|
|
|
|