Files
thehub/testing/p2pnet/test_blockchain.h
tomFlowee cbeb6dbb0a Allow a static blocks file to start at a checkpoint
The blockchain class can effectively now be shallow,
we can have a list of blockheaders of, for instance, the last year
alone. It builds on top of a known checkpoint (hardcoded block data)
and as long as we do not access block info that is unavailable, things
just work like normal.

We throw at the request of a blockheader that is too old.
2023-10-09 18:08:10 +02:00

45 lines
1.2 KiB
C++

/*
* This file is part of the Flowee project
* Copyright (C) 2021 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 TEST_BLOCKCHAIN_H
#define TEST_BLOCKCHAIN_H
#include <common/TestFloweeBase.h>
class TestP2PBlockchain : public TestFloweeBase
{
Q_OBJECT
private slots:
void init(); // create tmp dir
void cleanup(); // remove tmp dir.
void basics();
void staticChain();
void staticChain2();
void blockHeightAtTime();
void startAtCheckpoint();
private:
void prepareStaticFile(QByteArray &bytesRead, const char *filename = nullptr);
QString m_tmpPath;
};
#endif