Changeset View
Changeset View
Standalone View
Standalone View
src/validationinterface.cpp
// Copyright (c) 2009-2010 Satoshi Nakamoto | // Copyright (c) 2009-2010 Satoshi Nakamoto | ||||
// Copyright (c) 2009-2016 The Bitcoin Core developers | // Copyright (c) 2009-2016 The Bitcoin Core developers | ||||
// Distributed under the MIT software license, see the accompanying | // Distributed under the MIT software license, see the accompanying | ||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php. | // file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||||
#include <validationinterface.h> | #include <validationinterface.h> | ||||
#include <chain.h> | #include <chain.h> | ||||
#include <consensus/validation.h> | #include <consensus/validation.h> | ||||
#include <logging.h> | #include <logging.h> | ||||
#include <primitives/block.h> | #include <primitives/block.h> | ||||
#include <primitives/transaction.h> | #include <primitives/transaction.h> | ||||
#include <scheduler.h> | #include <scheduler.h> | ||||
#include <util/validation.h> | |||||
#include <future> | #include <future> | ||||
#include <tuple> | #include <tuple> | ||||
#include <unordered_map> | #include <unordered_map> | ||||
#include <utility> | #include <utility> | ||||
//! The MainSignalsInstance manages a list of shared_ptr<CValidationInterface> | //! The MainSignalsInstance manages a list of shared_ptr<CValidationInterface> | ||||
//! callbacks. | //! callbacks. | ||||
▲ Show 20 Lines • Show All 233 Lines • ▼ Show 20 Lines | void CMainSignals::ChainStateFlushed(const CBlockLocator &locator) { | ||||
ENQUEUE_AND_LOG_EVENT(event, "%s: block hash=%s", __func__, | ENQUEUE_AND_LOG_EVENT(event, "%s: block hash=%s", __func__, | ||||
locator.IsNull() ? "null" | locator.IsNull() ? "null" | ||||
: locator.vHave.front().ToString()); | : locator.vHave.front().ToString()); | ||||
} | } | ||||
void CMainSignals::BlockChecked(const CBlock &block, | void CMainSignals::BlockChecked(const CBlock &block, | ||||
const BlockValidationState &state) { | const BlockValidationState &state) { | ||||
LOG_EVENT("%s: block hash=%s state=%s", __func__, | LOG_EVENT("%s: block hash=%s state=%s", __func__, | ||||
block.GetHash().ToString(), FormatStateMessage(state)); | block.GetHash().ToString(), state.ToString()); | ||||
m_internals->Iterate([&](CValidationInterface &callbacks) { | m_internals->Iterate([&](CValidationInterface &callbacks) { | ||||
callbacks.BlockChecked(block, state); | callbacks.BlockChecked(block, state); | ||||
}); | }); | ||||
} | } | ||||
void CMainSignals::NewPoWValidBlock( | void CMainSignals::NewPoWValidBlock( | ||||
const CBlockIndex *pindex, const std::shared_ptr<const CBlock> &block) { | const CBlockIndex *pindex, const std::shared_ptr<const CBlock> &block) { | ||||
LOG_EVENT("%s: block hash=%s", __func__, block->GetHash().ToString()); | LOG_EVENT("%s: block hash=%s", __func__, block->GetHash().ToString()); | ||||
m_internals->Iterate([&](CValidationInterface &callbacks) { | m_internals->Iterate([&](CValidationInterface &callbacks) { | ||||
callbacks.NewPoWValidBlock(pindex, block); | callbacks.NewPoWValidBlock(pindex, block); | ||||
}); | }); | ||||
} | } |