Files

52 lines
1.4 KiB
C++
Raw Permalink Normal View History

2019-03-30 14:26:00 +01:00
/*
* This file is part of the Flowee project
2021-06-20 22:44:44 +02:00
* Copyright (C) 2019 Tom Zander <tom@flowee.org>
2019-03-30 14:26:00 +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/>.
*/
#ifndef TXINDEXER_H
#define TXINDEXER_H
2019-06-26 21:39:07 +02:00
#include <QThread>
2019-03-30 14:26:00 +01:00
#include <UnspentOutputDatabase.h>
2019-06-26 21:39:07 +02:00
class Indexer;
class TxIndexer: public QThread
2019-03-30 14:26:00 +01:00
{
2019-06-26 21:39:07 +02:00
Q_OBJECT
2019-03-30 14:26:00 +01:00
public:
2025-02-08 19:05:26 +01:00
TxIndexer(boost::asio::io_context &context, const boost::filesystem::path &basedir, Indexer *datasource);
2019-03-30 14:26:00 +01:00
int blockheight() const;
uint256 blockId() const;
void blockFinished(int blockheight, const uint256 &blockId);
void insert(const uint256 &txid, int blockHeight, int offsetInBlock);
2019-04-01 11:21:28 +02:00
struct TxData {
int blockHeight = -1;
int offsetInBlock = 0;
};
TxData find(const uint256 &txid) const;
2019-06-26 21:39:07 +02:00
void run() override;
2019-03-30 14:26:00 +01:00
private:
UnspentOutputDatabase m_txdb;
2019-06-26 21:39:07 +02:00
Indexer *m_dataSource;
2019-03-30 14:26:00 +01:00
};
#endif