Files
thehub/libs/interfaces/validationinterface.cpp
T

92 lines
2.8 KiB
C++
Raw Permalink Normal View History

2018-02-15 18:06:38 +01:00
/*
* This file is part of the Flowee project
* Copyright (C) 2009-2010 Satoshi Nakamoto
* Copyright (C) 2009-2014 The Bitcoin Core developers
2019-09-02 23:33:33 +02:00
* Copyright (C) 2017-2019 Tom Zander <tomz@freedommail.ch>
2018-02-15 18:06:38 +01:00
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "validationinterface.h"
ValidationInterfaceBroadcaster &ValidationNotifier() {
static ValidationInterfaceBroadcaster s_instance;
return s_instance;
}
2018-02-17 01:47:23 +01:00
void ValidationInterfaceBroadcaster::SyncTransaction(const CTransaction &tx)
2018-02-15 18:06:38 +01:00
{
2018-02-17 01:47:23 +01:00
for (auto i : m_listeners) i->SyncTransaction(tx);
2018-02-15 18:06:38 +01:00
}
2018-02-17 01:47:23 +01:00
void ValidationInterfaceBroadcaster::SyncTx(const Tx &tx)
2018-02-15 18:06:38 +01:00
{
2018-02-17 01:47:23 +01:00
for (auto i : m_listeners) i->SyncTx(tx);
2018-02-15 18:06:38 +01:00
}
void ValidationInterfaceBroadcaster::SyncAllTransactionsInBlock(const CBlock *pblock)
{
for (auto i : m_listeners) i->SyncAllTransactionsInBlock(pblock);
}
void ValidationInterfaceBroadcaster::SyncAllTransactionsInBlock(const FastBlock &block, CBlockIndex *index)
2018-02-15 18:06:38 +01:00
{
for (auto i : m_listeners) i->SyncAllTransactionsInBlock(block, index);
2018-02-15 18:06:38 +01:00
}
void ValidationInterfaceBroadcaster::SetBestChain(const CBlockLocator &locator)
{
for (auto i : m_listeners) i->SetBestChain(locator);
}
void ValidationInterfaceBroadcaster::UpdatedTransaction(const uint256 &hash)
{
for (auto i : m_listeners) i->UpdatedTransaction(hash);
}
void ValidationInterfaceBroadcaster::Inventory(const uint256 &hash)
{
for (auto i : m_listeners) i->Inventory(hash);
}
void ValidationInterfaceBroadcaster::ResendWalletTransactions(int64_t nBestBlockTime)
{
for (auto i : m_listeners) i->ResendWalletTransactions(nBestBlockTime);
}
2018-03-25 13:55:48 +02:00
void ValidationInterfaceBroadcaster::DoubleSpendFound(const Tx &first, const Tx &duplicate)
{
for (auto i : m_listeners) i->DoubleSpendFound(first, duplicate);
}
2019-09-02 23:33:33 +02:00
void ValidationInterfaceBroadcaster::DoubleSpendFound(const Tx &txInMempool, const DoubleSpendProof &proof)
{
for (auto i : m_listeners) i->DoubleSpendFound(txInMempool, proof);
}
2018-02-15 18:06:38 +01:00
void ValidationInterfaceBroadcaster::addListener(ValidationInterface *impl)
{
m_listeners.push_back(impl);
}
void ValidationInterfaceBroadcaster::removeListener(ValidationInterface *impl)
{
m_listeners.remove(impl);
}
void ValidationInterfaceBroadcaster::removeAll()
{
m_listeners.clear();
}