forked from Bitcoin-ABC/bitcoin-abc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtx_verify.h
66 lines (55 loc) · 2.48 KB
/
tx_verify.h
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
// Copyright (c) 2018-2020 The Bitcoin developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#ifndef BITCOIN_CONSENSUS_TX_VERIFY_H
#define BITCOIN_CONSENSUS_TX_VERIFY_H
#include <cstdint>
#include <vector>
struct Amount;
class CBlockIndex;
class CCoinsViewCache;
class CTransaction;
class TxValidationState;
namespace Consensus {
struct Params;
/**
* Check whether all inputs of this transaction are valid (no double spends and
* amounts). This does not modify the UTXO set. This does not check scripts and
* sigs.
* @param[out] txfee Set to the transaction fee if successful.
* Preconditions: tx.IsCoinBase() is false.
*/
bool CheckTxInputs(const CTransaction &tx, TxValidationState &state,
const CCoinsViewCache &inputs, int nSpendHeight,
Amount &txfee);
} // namespace Consensus
/**
* Context dependent validity checks for non coinbase transactions. This
* doesn't check the validity of the transaction against the UTXO set, but
* simply characteristic that are suceptible to change over time such as feature
* activation/deactivation and CLTV.
*/
bool ContextualCheckTransaction(const Consensus::Params ¶ms,
const CTransaction &tx,
TxValidationState &state, int nHeight,
int64_t nMedianTimePast);
/**
* Calculates the block height and previous block's median time past at which
* the transaction will be considered final in the context of BIP 68.
* Also removes from the vector of input heights any entries which did not
* correspond to sequence locked inputs as they do not affect the calculation.
*/
std::pair<int, int64_t> CalculateSequenceLocks(const CTransaction &tx,
int flags,
std::vector<int> &prevHeights,
const CBlockIndex &block);
bool EvaluateSequenceLocks(const CBlockIndex &block,
std::pair<int, int64_t> lockPair);
/**
* Check if transaction is final per BIP 68 sequence numbers and can be included
* in a block. Consensus critical. Takes as input a list of heights at which
* tx's inputs (in order) confirmed.
*/
bool SequenceLocks(const CTransaction &tx, int flags,
std::vector<int> &prevHeights, const CBlockIndex &block);
#endif // BITCOIN_CONSENSUS_TX_VERIFY_H