mirror of
https://github.com/kvazar-network/kevacoin.git
synced 2025-01-17 18:40:09 +00:00
Merge #8346: Mempool: Use Consensus::CheckTxInputs direclty over main::CheckInputs
a6cc299 Mempool: Use Consensus::CheckTxInputs direclty over main::CheckInputs (Jorge Timón)
This commit is contained in:
commit
f798b891bc
13
src/main.h
13
src/main.h
@ -352,9 +352,22 @@ bool CheckInputs(const CTransaction& tx, CValidationState &state, const CCoinsVi
|
|||||||
/** Apply the effects of this transaction on the UTXO set represented by view */
|
/** Apply the effects of this transaction on the UTXO set represented by view */
|
||||||
void UpdateCoins(const CTransaction& tx, CCoinsViewCache& inputs, int nHeight);
|
void UpdateCoins(const CTransaction& tx, CCoinsViewCache& inputs, int nHeight);
|
||||||
|
|
||||||
|
/** Transaction validation functions */
|
||||||
|
|
||||||
/** Context-independent validity checks */
|
/** Context-independent validity checks */
|
||||||
bool CheckTransaction(const CTransaction& tx, CValidationState& state);
|
bool CheckTransaction(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.
|
||||||
|
* Preconditions: tx.IsCoinBase() is false.
|
||||||
|
*/
|
||||||
|
bool CheckTxInputs(const CTransaction& tx, CValidationState& state, const CCoinsViewCache& inputs, int nSpendHeight);
|
||||||
|
|
||||||
|
} // namespace Consensus
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if transaction is final and can be included in a block with the
|
* Check if transaction is final and can be included in a block with the
|
||||||
* specified height and time. Consensus critical.
|
* specified height and time. Consensus critical.
|
||||||
|
@ -657,6 +657,7 @@ void CTxMemPool::check(const CCoinsViewCache *pcoins) const
|
|||||||
uint64_t innerUsage = 0;
|
uint64_t innerUsage = 0;
|
||||||
|
|
||||||
CCoinsViewCache mempoolDuplicate(const_cast<CCoinsViewCache*>(pcoins));
|
CCoinsViewCache mempoolDuplicate(const_cast<CCoinsViewCache*>(pcoins));
|
||||||
|
const int64_t nSpendHeight = GetSpendHeight(mempoolDuplicate);
|
||||||
|
|
||||||
LOCK(cs);
|
LOCK(cs);
|
||||||
list<const CTxMemPoolEntry*> waitingOnDependants;
|
list<const CTxMemPoolEntry*> waitingOnDependants;
|
||||||
@ -737,7 +738,9 @@ void CTxMemPool::check(const CCoinsViewCache *pcoins) const
|
|||||||
waitingOnDependants.push_back(&(*it));
|
waitingOnDependants.push_back(&(*it));
|
||||||
else {
|
else {
|
||||||
CValidationState state;
|
CValidationState state;
|
||||||
assert(CheckInputs(tx, state, mempoolDuplicate, false, 0, false, NULL));
|
bool fCheckResult = tx.IsCoinBase() ||
|
||||||
|
Consensus::CheckTxInputs(tx, state, mempoolDuplicate, nSpendHeight);
|
||||||
|
assert(fCheckResult);
|
||||||
UpdateCoins(tx, mempoolDuplicate, 1000000);
|
UpdateCoins(tx, mempoolDuplicate, 1000000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -751,7 +754,9 @@ void CTxMemPool::check(const CCoinsViewCache *pcoins) const
|
|||||||
stepsSinceLastRemove++;
|
stepsSinceLastRemove++;
|
||||||
assert(stepsSinceLastRemove < waitingOnDependants.size());
|
assert(stepsSinceLastRemove < waitingOnDependants.size());
|
||||||
} else {
|
} else {
|
||||||
assert(CheckInputs(entry->GetTx(), state, mempoolDuplicate, false, 0, false, NULL));
|
bool fCheckResult = entry->GetTx().IsCoinBase() ||
|
||||||
|
Consensus::CheckTxInputs(entry->GetTx(), state, mempoolDuplicate, nSpendHeight);
|
||||||
|
assert(fCheckResult);
|
||||||
UpdateCoins(entry->GetTx(), mempoolDuplicate, 1000000);
|
UpdateCoins(entry->GetTx(), mempoolDuplicate, 1000000);
|
||||||
stepsSinceLastRemove = 0;
|
stepsSinceLastRemove = 0;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user