This commit is contained in:
jl777
2016-10-21 19:09:24 -03:00
parent 8ad9f27fdd
commit 355ca56547
6 changed files with 18 additions and 14 deletions

View File

@@ -1097,7 +1097,7 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa
{
CCoinsView dummy;
CCoinsViewCache view(&dummy);
int64_t interest;
CAmount nValueIn = 0;
{
LOCK(pool.cs);
@@ -1132,7 +1132,7 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa
// Bring the best block into scope
view.GetBestBlock();
nValueIn = view.GetValueIn(tx,chainActive.Tip()->nTime);
nValueIn = view.GetValueIn(&interest,tx,chainActive.Tip()->nTime);
// we have all inputs cached now, so switch back to dummy, so we don't need to keep lock on mempool
view.SetBackend(dummy);
@@ -2100,6 +2100,7 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin
int64_t nTimeStart = GetTimeMicros();
CAmount nFees = 0;
int nInputs = 0;
int64_t interest,sum = 0;
unsigned int nSigOps = 0;
CDiskTxPos pos(pindex->GetBlockPos(), GetSizeOfCompactSize(block.vtx.size()));
std::vector<std::pair<uint256, CDiskTxPos> > vPos;
@@ -2153,14 +2154,14 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin
return state.DoS(100, error("ConnectBlock(): too many sigops"),
REJECT_INVALID, "bad-blk-sigops");
nFees += view.GetValueIn(tx,chainActive.Tip()->nTime)-tx.GetValueOut();
nFees += view.GetValueIn(&interest,tx,chainActive.Tip()->nTime) - tx.GetValueOut();
sum += interest;
std::vector<CScriptCheck> vChecks;
if (!ContextualCheckInputs(tx, state, view, fScriptChecks, flags, false, chainparams.GetConsensus(), nScriptCheckThreads ? &vChecks : NULL))
return false;
control.Add(vChecks);
}
komodo_accrued_interest(pindex->nHeight,sum);
CTxUndo undoDummy;
if (i > 0) {
blockundo.vtxundo.push_back(CTxUndo());