Line data Source code
1 : // Copyright (c) 2017-2022 The PIVX Core developers 2 : // Distributed under the MIT software license, see the accompanying 3 : // file COPYING or http://www.opensource.org/licenses/mit-license.php. 4 : 5 : #ifndef PIVX_STAKEINPUT_H 6 : #define PIVX_STAKEINPUT_H 7 : 8 : #include "chain.h" 9 : #include "streams.h" 10 : #include "uint256.h" 11 : 12 : class CKeyStore; 13 : class CWallet; 14 : class CWalletTx; 15 : 16 : class CStakeInput 17 : { 18 : protected: 19 : const CBlockIndex* pindexFrom = nullptr; 20 : 21 : public: 22 19533 : CStakeInput(const CBlockIndex* _pindexFrom) : pindexFrom(_pindexFrom) {} 23 12769 : virtual ~CStakeInput(){}; 24 : virtual const CBlockIndex* GetIndexFrom() const = 0; 25 : virtual bool GetTxOutFrom(CTxOut& out) const = 0; 26 : virtual CAmount GetValue() const = 0; 27 : virtual bool IsZPIV() const = 0; 28 : virtual CDataStream GetUniqueness() const = 0; 29 : }; 30 : 31 : 32 13231 : class CPivStake : public CStakeInput 33 : { 34 : private: 35 : const CTxOut outputFrom; 36 : const COutPoint outpointFrom; 37 : 38 : public: 39 19533 : CPivStake(const CTxOut& _from, const COutPoint& _outPointFrom, const CBlockIndex* _pindexFrom) : 40 19533 : CStakeInput(_pindexFrom), outputFrom(_from), outpointFrom(_outPointFrom) {} 41 : 42 : static CPivStake* NewPivStake(const CTxIn& txin, int nHeight, uint32_t nTime); 43 : 44 : const CBlockIndex* GetIndexFrom() const override; 45 : bool GetTxOutFrom(CTxOut& out) const override; 46 : CAmount GetValue() const override; 47 : CDataStream GetUniqueness() const override; 48 : CTxIn GetTxIn() const; 49 6964 : bool IsZPIV() const override { return false; } 50 : }; 51 : 52 : 53 : #endif // PIVX_STAKEINPUT_H