diff --git a/src/consensus/tx_verify.h b/src/consensus/tx_verify.h index f3a5dff3c..421f67101 100644 --- a/src/consensus/tx_verify.h +++ b/src/consensus/tx_verify.h @@ -1,104 +1,104 @@ // Copyright (c) 2018 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 #include -class Amount; +struct Amount; class CBlockIndex; class CCoinsViewCache; class Config; class CTransaction; class CValidationState; /** * Context-independent validity checks for coinbase and non-coinbase * transactions. */ bool CheckRegularTransaction(const CTransaction &tx, CValidationState &state); bool CheckCoinbase(const CTransaction &tx, CValidationState &state); namespace Consensus { /** * 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, CValidationState &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 Config &config, const CTransaction &tx, CValidationState &state, int nHeight, int64_t nLockTimeCutoff, 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 CalculateSequenceLocks(const CTransaction &tx, int flags, std::vector *prevHeights, const CBlockIndex &block); bool EvaluateSequenceLocks(const CBlockIndex &block, std::pair 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 *prevHeights, const CBlockIndex &block); /** * Count ECDSA signature operations the old-fashioned (pre-0.6) way * @return number of sigops this transaction's outputs will produce when spent * @see CTransaction::FetchInputs */ uint64_t GetSigOpCountWithoutP2SH(const CTransaction &tx, uint32_t flags); /** * Count ECDSA signature operations in pay-to-script-hash inputs. * * @param[in] mapInputs Map of previous transactions that have outputs we're * spending * @return maximum number of sigops required to validate this transaction's * inputs * @see CTransaction::FetchInputs */ uint64_t GetP2SHSigOpCount(const CTransaction &tx, const CCoinsViewCache &mapInputs, uint32_t flags); /** * Compute total signature operation of a transaction. * @param[in] tx Transaction for which we are computing the cost * @param[in] inputs Map of previous transactions that have outputs we're * spending * @param[in] flags Script verification flags * @return Total signature operation cost of tx */ uint64_t GetTransactionSigOpCount(const CTransaction &tx, const CCoinsViewCache &inputs, uint32_t flags); #endif // BITCOIN_CONSENSUS_TX_VERIFY_H diff --git a/src/core_io.h b/src/core_io.h index 732538a53..8e59d5558 100644 --- a/src/core_io.h +++ b/src/core_io.h @@ -1,38 +1,38 @@ // Copyright (c) 2009-2016 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_CORE_IO_H #define BITCOIN_CORE_IO_H #include #include -class Amount; +struct Amount; class CBlock; class CMutableTransaction; class CScript; class CTransaction; class uint256; class UniValue; // core_read.cpp CScript ParseScript(const std::string &s); std::string ScriptToAsmStr(const CScript &script, const bool fAttemptSighashDecode = false); bool DecodeHexTx(CMutableTransaction &tx, const std::string &strHexTx); bool DecodeHexBlk(CBlock &, const std::string &strHexBlk); uint256 ParseHashUV(const UniValue &v, const std::string &strName); uint256 ParseHashStr(const std::string &, const std::string &strName); std::vector ParseHexUV(const UniValue &v, const std::string &strName); // core_write.cpp UniValue ValueFromAmount(const Amount &amount); std::string FormatScript(const CScript &script); std::string EncodeHexTx(const CTransaction &tx, const int serializeFlags = 0); void ScriptPubKeyToUniv(const CScript &scriptPubKey, UniValue &out, bool fIncludeHex); void TxToUniv(const CTransaction &tx, const uint256 &hashBlock, UniValue &entry, bool include_hex = true, int serialize_flags = 0); #endif // BITCOIN_CORE_IO_H