Files
thehub/libs/api/BlockNotificationService.h
T
TomZ ccd66a49b2 Document and refactor NetworkService
The main goal of this is to make sure that network services
implementations don't reuse one bufferpool for all their remotes as that
can cause threading issues.
One bufferpool per remote is now made easy.
2019-04-09 17:24:38 +02:00

49 lines
1.6 KiB
C++

/*
* This file is part of the Flowee project
* Copyright (C) 2018-2019 Tom Zander <tomz@freedommail.ch>
*
* 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/>.
*/
#ifndef BLOCKNOTIFICATIONSERVICE_H
#define BLOCKNOTIFICATIONSERVICE_H
#include <validationinterface.h>
#include <NetworkService.h>
class BlockNotificationService : public ValidationInterface, public NetworkService
{
public:
BlockNotificationService();
~BlockNotificationService();
// the hub pushed a transaction into its mempool
void SyncAllTransactionsInBlock(const FastBlock &block, CBlockIndex *index) override;
void onIncomingMessage(Remote *con, const Message &message, const EndPoint &ep) override;
protected:
class RemoteSubscriptionInfo : public Remote {
public:
bool m_wantsNewBlockHashes = false;
};
// NetworkSubscriptionService interface
Remote *createRemote() override {
return new RemoteSubscriptionInfo();
}
private:
Streaming::BufferPool m_pool;
};
#endif