Files
thehub/indexer/TxIndexer.h
tomFlowee bb7275466b Stop using deprecated asio io_service
This ports the io-service to the source compatible io-context
class, with the most work going to the WorkerThreads which owns
that one.
2025-02-08 19:05:26 +01:00

52 lines
1.4 KiB
C++

/*
* This file is part of the Flowee project
* Copyright (C) 2019 Tom Zander <tom@flowee.org>
*
* 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 TXINDEXER_H
#define TXINDEXER_H
#include <QThread>
#include <UnspentOutputDatabase.h>
class Indexer;
class TxIndexer: public QThread
{
Q_OBJECT
public:
TxIndexer(boost::asio::io_context &context, const boost::filesystem::path &basedir, Indexer *datasource);
int blockheight() const;
uint256 blockId() const;
void blockFinished(int blockheight, const uint256 &blockId);
void insert(const uint256 &txid, int blockHeight, int offsetInBlock);
struct TxData {
int blockHeight = -1;
int offsetInBlock = 0;
};
TxData find(const uint256 &txid) const;
void run() override;
private:
UnspentOutputDatabase m_txdb;
Indexer *m_dataSource;
};
#endif