Files
thehub/hub/server/UnspentOutputData.h
2026-05-14 23:31:17 +02:00

42 lines
1.5 KiB
C++

/*
* This file is part of the Flowee project
* Copyright (C) 2018-2026 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 UNSPENTOUTPUTDATA_H
#define UNSPENTOUTPUTDATA_H
#include <utxo/UnspentOutputDatabase.h>
#include <utils/primitives/Tx.h>
class UnspentOutputData : public Tx::Output {
public:
// this is a more expensive 'constructor', it does loading the block from disk.
static UnspentOutputData fromUtxoDB(const UnspentOutput &utxoUnspentOutput);
explicit UnspentOutputData(const Streaming::ConstBuffer &rawOutputScript, int64_t v)
: Tx::Output(rawOutputScript, v) {}
explicit UnspentOutputData(const Tx::Output &other) : Tx::Output(other) {}
bool isValid() const {
return outputValue >= 0;
}
int blockHeight = 0;
int prevTxVersion = -1; // only set in the fromUtxoDB() method
bool isCoinbase = false;
};
#endif