Dash Core Source Documentation (0.16.0.1)

Find detailed information regarding the Dash Core source code.

cbtx.h
Go to the documentation of this file.
1 // Copyright (c) 2017-2019 The Dash 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 DASH_CBTX_H
6 #define DASH_CBTX_H
7 
8 #include <consensus/validation.h>
10 #include <univalue.h>
11 
12 class CBlock;
13 class CBlockIndex;
14 
15 // coinbase transaction
16 class CCbTx
17 {
18 public:
19  static const uint16_t CURRENT_VERSION = 2;
20 
21 public:
23  int32_t nHeight{0};
26 
27 public:
29 
30  template <typename Stream, typename Operation>
31  inline void SerializationOp(Stream& s, Operation ser_action)
32  {
36 
37  if (nVersion >= 2) {
39  }
40  }
41 
42  std::string ToString() const;
43 
44  void ToJson(UniValue& obj) const
45  {
46  obj.clear();
47  obj.setObject();
48  obj.push_back(Pair("version", (int)nVersion));
49  obj.push_back(Pair("height", (int)nHeight));
50  obj.push_back(Pair("merkleRootMNList", merkleRootMNList.ToString()));
51  if (nVersion >= 2) {
52  obj.push_back(Pair("merkleRootQuorums", merkleRootQuorums.ToString()));
53  }
54  }
55 };
56 
57 bool CheckCbTx(const CTransaction& tx, const CBlockIndex* pindexPrev, CValidationState& state);
58 
59 bool CheckCbTxMerkleRoots(const CBlock& block, const CBlockIndex* pindex, CValidationState& state);
60 bool CalcCbTxMerkleRootMNList(const CBlock& block, const CBlockIndex* pindexPrev, uint256& merkleRootRet, CValidationState& state);
61 bool CalcCbTxMerkleRootQuorums(const CBlock& block, const CBlockIndex* pindexPrev, uint256& merkleRootRet, CValidationState& state);
62 
63 #endif //DASH_CBTX_H
void ToJson(UniValue &obj) const
Definition: cbtx.h:44
static const uint16_t CURRENT_VERSION
Definition: cbtx.h:19
bool CheckCbTx(const CTransaction &tx, const CBlockIndex *pindexPrev, CValidationState &state)
Definition: cbtx.cpp:18
#define READWRITE(obj)
Definition: serialize.h:165
bool CalcCbTxMerkleRootQuorums(const CBlock &block, const CBlockIndex *pindexPrev, uint256 &merkleRootRet, CValidationState &state)
Definition: cbtx.cpp:161
Definition: block.h:72
Definition: cbtx.h:16
bool CheckCbTxMerkleRoots(const CBlock &block, const CBlockIndex *pindex, CValidationState &state)
Definition: cbtx.cpp:52
bool push_back(const UniValue &val)
Definition: univalue.cpp:110
uint256 merkleRootMNList
Definition: cbtx.h:24
uint256 merkleRootQuorums
Definition: cbtx.h:25
std::string ToString() const
Definition: uint256.cpp:62
static std::pair< std::string, UniValue > Pair(const char *cKey, const char *cVal)
Definition: univalue.h:185
int32_t nHeight
Definition: cbtx.h:23
Capture information about block/transaction validation.
Definition: validation.h:22
256-bit opaque blob.
Definition: uint256.h:123
The block chain is a tree shaped structure starting with the genesis block at the root...
Definition: chain.h:170
bool setObject()
Definition: univalue.cpp:103
bool CalcCbTxMerkleRootMNList(const CBlock &block, const CBlockIndex *pindexPrev, uint256 &merkleRootRet, CValidationState &state)
Definition: cbtx.cpp:103
ADD_SERIALIZE_METHODS
Definition: cbtx.h:28
uint16_t nVersion
Definition: cbtx.h:22
void clear()
Definition: univalue.cpp:17
The basic transaction that is broadcasted on the network and contained in blocks. ...
Definition: transaction.h:198
void SerializationOp(Stream &s, Operation ser_action)
Definition: cbtx.h:31
std::string ToString() const
Definition: cbtx.cpp:259
Released under the MIT license