PIVX Core  5.6.99
P2P Digital Currency
stakeinput.h
Go to the documentation of this file.
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 
17 {
18 protected:
19  const CBlockIndex* pindexFrom = nullptr;
20 
21 public:
22  CStakeInput(const CBlockIndex* _pindexFrom) : pindexFrom(_pindexFrom) {}
23  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 class CPivStake : public CStakeInput
33 {
34 private:
37 
38 public:
39  CPivStake(const CTxOut& _from, const COutPoint& _outPointFrom, const CBlockIndex* _pindexFrom) :
40  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  bool IsZPIV() const override { return false; }
50 };
51 
52 
53 #endif // PIVX_STAKEINPUT_H
int64_t CAmount
Amount in PIV (Can be negative)
Definition: amount.h:13
The block chain is a tree shaped structure starting with the genesis block at the root,...
Definition: chain.h:139
A virtual base class for key stores.
Definition: keystore.h:23
An outpoint - a combination of a transaction hash and an index n into its vout.
Definition: transaction.h:72
const CBlockIndex * GetIndexFrom() const override
Definition: stakeinput.cpp:91
bool GetTxOutFrom(CTxOut &out) const override
Definition: stakeinput.cpp:66
CAmount GetValue() const override
Definition: stakeinput.cpp:77
const CTxOut outputFrom
Definition: stakeinput.h:35
const COutPoint outpointFrom
Definition: stakeinput.h:36
CDataStream GetUniqueness() const override
Definition: stakeinput.cpp:82
static CPivStake * NewPivStake(const CTxIn &txin, int nHeight, uint32_t nTime)
Definition: stakeinput.cpp:22
CTxIn GetTxIn() const
Definition: stakeinput.cpp:72
CPivStake(const CTxOut &_from, const COutPoint &_outPointFrom, const CBlockIndex *_pindexFrom)
Definition: stakeinput.h:39
bool IsZPIV() const override
Definition: stakeinput.h:49
virtual ~CStakeInput()
Definition: stakeinput.h:23
virtual bool GetTxOutFrom(CTxOut &out) const =0
virtual CAmount GetValue() const =0
virtual const CBlockIndex * GetIndexFrom() const =0
virtual bool IsZPIV() const =0
const CBlockIndex * pindexFrom
Definition: stakeinput.h:19
CStakeInput(const CBlockIndex *_pindexFrom)
Definition: stakeinput.h:22
virtual CDataStream GetUniqueness() const =0
An input of a transaction.
Definition: transaction.h:94
An output of a transaction.
Definition: transaction.h:137
A CWallet is an extension of a keystore, which also maintains a set of transactions and balances,...
Definition: wallet.h:577
A transaction with a bunch of additional info that only the owner cares about.
Definition: wallet.h:325