forked from DiviProject/Divi
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathBlockTransactionChecker.h
More file actions
78 lines (69 loc) · 2.28 KB
/
BlockTransactionChecker.h
File metadata and controls
78 lines (69 loc) · 2.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#ifndef BLOCK_TRANSACTION_CHECKER_H
#define BLOCK_TRANSACTION_CHECKER_H
#include <addressindex.h>
#include <vector>
#include <uint256.h>
#include <BlockUndo.h>
#include <ForkActivation.h>
#include <TransactionInputChecker.h>
#include <IndexDatabaseUpdates.h>
class BlockMap;
class CBlockIndex;
class CBlock;
class CValidationState;
class CCoinsViewCache;
class CBlockRewards;
class TransactionUtxoHasher;
class TransactionLocationRecorder
{
private:
CDiskTxPos nextBlockTxOnDiskLocation_;
size_t numberOfTransactions_;
bool txLocationDataSizeHasBeenPreallocated_;
public:
TransactionLocationRecorder(
const CBlockIndex* pindex,
const CBlock& block);
void RecordTxLocationData(
const CTransaction& tx,
std::vector<TxIndexEntry>& txLocationData);
};
class BlockTransactionChecker
{
private:
CBlockUndo blockundo_;
const CBlock& block_;
const ActivationState activation_;
const TransactionUtxoHasher& utxoHasher_;
CValidationState& state_;
CBlockIndex* pindex_;
CCoinsViewCache& view_;
TransactionInputChecker txInputChecker_;
TransactionLocationRecorder txLocationRecorder_;
public:
/** Checks if the transaction is a valid coinstake after the staking vault
* fork (which adds extra rules, like paying back at least the expected
* staking reward to the same script that the staking input came from).
* Note that the extra conditions only apply to actual stake inputs that
* are vault scripts; if the tx is a coinstake but the input is not a vault,
* then the fucntion just returns true without further checks. */
static bool CheckCoinstakeForVaults(
const CTransaction& tx,
const CBlockRewards& expectedRewards,
const CCoinsViewCache& view);
BlockTransactionChecker(
const CBlock& block,
const TransactionUtxoHasher& utxoHasher,
CValidationState& state,
CBlockIndex* pindex,
CCoinsViewCache& view,
const BlockMap& blockIndexMap,
const int blocksToSkipChecksFor);
bool Check(
const CBlockRewards& nExpectedMint,
bool fJustCheck,
IndexDatabaseUpdates& indexDatabaseUpdates);
bool WaitForScriptsToBeChecked();
CBlockUndo& getBlockUndoData();
};
#endif// BLOCK_TRANSACTION_CHECKER_H