Consensus: Refactor: Separate Consensus::CheckTxInputs and GetSpendHeight in CheckInputs

Zcash:
- Replaces some of the refactoring performed in #1017
- Exposed Consensus::CheckTxInputs for testing
This commit is contained in:
Jorge Timón
2015-04-24 16:45:16 +02:00
committed by Jack Grigg
parent fbbd3cc638
commit e079f010bf
3 changed files with 41 additions and 45 deletions

View File

@@ -332,10 +332,6 @@ bool ContextualCheckInputs(const CTransaction& tx, CValidationState &state, cons
unsigned int flags, bool cacheStore, const Consensus::Params& consensusParams,
std::vector<CScriptCheck> *pvChecks = NULL);
bool NonContextualCheckInputs(const CTransaction& tx, CValidationState &state, const CCoinsViewCache &view, bool fScriptChecks,
unsigned int flags, bool cacheStore, const Consensus::Params& consensusParams,
std::vector<CScriptCheck> *pvChecks = NULL);
/** Apply the effects of this transaction on the UTXO set represented by view */
void UpdateCoins(const CTransaction& tx, CValidationState &state, CCoinsViewCache &inputs, int nHeight);
@@ -520,4 +516,15 @@ extern CCoinsViewCache *pcoinsTip;
/** Global variable that points to the active block tree (protected by cs_main) */
extern CBlockTreeDB *pblocktree;
/**
* Return the spend height, which is one more than the inputs.GetBestBlock().
* While checking, GetBestBlock() refers to the parent block. (protected by cs_main)
* This is also true for mempool checks.
*/
int GetSpendHeight(const CCoinsViewCache& inputs);
namespace Consensus {
bool CheckTxInputs(const CTransaction& tx, CValidationState& state, const CCoinsViewCache& inputs, int nSpendHeight, const Consensus::Params& consensusParams);
}
#endif // BITCOIN_MAIN_H