Dash Core Source Documentation (0.16.0.1)

Find detailed information regarding the Dash Core source code.

specialtx.h
Go to the documentation of this file.
1 // Copyright (c) 2018-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_SPECIALTX_H
6 #define DASH_SPECIALTX_H
7 
9 #include <streams.h>
10 #include <version.h>
11 
12 class CBlock;
13 class CBlockIndex;
14 class CValidationState;
15 
16 bool CheckSpecialTx(const CTransaction& tx, const CBlockIndex* pindexPrev, CValidationState& state);
17 bool ProcessSpecialTxsInBlock(const CBlock& block, const CBlockIndex* pindex, CValidationState& state, bool fJustCheck, bool fCheckCbTxMerleRoots);
18 bool UndoSpecialTxsInBlock(const CBlock& block, const CBlockIndex* pindex);
19 
20 template <typename T>
21 inline bool GetTxPayload(const std::vector<unsigned char>& payload, T& obj)
22 {
24  try {
25  ds >> obj;
26  } catch (std::exception& e) {
27  return false;
28  }
29  return ds.empty();
30 }
31 template <typename T>
32 inline bool GetTxPayload(const CMutableTransaction& tx, T& obj)
33 {
34  return GetTxPayload(tx.vExtraPayload, obj);
35 }
36 template <typename T>
37 inline bool GetTxPayload(const CTransaction& tx, T& obj)
38 {
39  return GetTxPayload(tx.vExtraPayload, obj);
40 }
41 
42 template <typename T>
43 void SetTxPayload(CMutableTransaction& tx, const T& payload)
44 {
46  ds << payload;
47  tx.vExtraPayload.assign(ds.begin(), ds.end());
48 }
49 
51 
52 #endif //DASH_SPECIALTX_H
bool GetTxPayload(const std::vector< unsigned char > &payload, T &obj)
Definition: specialtx.h:21
Definition: block.h:72
Double ended buffer combining vector and stream-like interfaces.
Definition: streams.h:103
bool empty() const
Definition: streams.h:195
bool ProcessSpecialTxsInBlock(const CBlock &block, const CBlockIndex *pindex, CValidationState &state, bool fJustCheck, bool fCheckCbTxMerleRoots)
Definition: specialtx.cpp:94
std::vector< uint8_t > vExtraPayload
Definition: transaction.h:298
Capture information about block/transaction validation.
Definition: validation.h:22
bool UndoSpecialTxsInBlock(const CBlock &block, const CBlockIndex *pindex)
Definition: specialtx.cpp:150
256-bit opaque blob.
Definition: uint256.h:123
const_iterator end() const
Definition: streams.h:192
const_iterator begin() const
Definition: streams.h:190
The block chain is a tree shaped structure starting with the genesis block at the root...
Definition: chain.h:170
static const int PROTOCOL_VERSION
network protocol versioning
Definition: version.h:14
const std::vector< uint8_t > vExtraPayload
Definition: transaction.h:220
uint256 CalcTxInputsHash(const CTransaction &tx)
Definition: specialtx.cpp:174
A mutable version of CTransaction.
Definition: transaction.h:291
The basic transaction that is broadcasted on the network and contained in blocks. ...
Definition: transaction.h:198
void SetTxPayload(CMutableTransaction &tx, const T &payload)
Definition: specialtx.h:43
bool CheckSpecialTx(const CTransaction &tx, const CBlockIndex *pindexPrev, CValidationState &state)
Definition: specialtx.cpp:20
Released under the MIT license