test
This commit is contained in:
@@ -385,7 +385,7 @@ const CScript &CCoinsViewCache::GetSpendFor(const CTxIn& input) const
|
|||||||
|
|
||||||
uint32_t komodo_txtime(uint256 hash);
|
uint32_t komodo_txtime(uint256 hash);
|
||||||
|
|
||||||
CAmount CCoinsViewCache::GetValueIn(const CTransaction& tx,uint32_t blocktime) const
|
CAmount CCoinsViewCache::GetValueIn(const CTransaction& tx,uint32_t prevblocktime) const
|
||||||
{
|
{
|
||||||
uint32_t timestamp,minutes;
|
uint32_t timestamp,minutes;
|
||||||
if ( tx.IsCoinBase() != 0 )
|
if ( tx.IsCoinBase() != 0 )
|
||||||
@@ -395,9 +395,9 @@ CAmount CCoinsViewCache::GetValueIn(const CTransaction& tx,uint32_t blocktime) c
|
|||||||
{
|
{
|
||||||
value = GetOutputFor(tx.vin[i]).nValue;
|
value = GetOutputFor(tx.vin[i]).nValue;
|
||||||
nResult += value;
|
nResult += value;
|
||||||
if ( (timestamp= komodo_txtime(tx.vin[i].prevout.hash)) != 0 && timestamp < blocktime-3600*24*7 && value >= COIN )
|
if ( (timestamp= komodo_txtime(tx.vin[i].prevout.hash)) != 0 && timestamp < prevblocktime-3600*24*7 && value >= COIN )
|
||||||
{
|
{
|
||||||
minutes = (blocktime - timestamp) / 60;
|
minutes = (prevblocktime - timestamp) / 60;
|
||||||
fprintf(stderr,"GetValueIn %lld i.%d time.%u minutes.%d\n",(long long)value,i,timestamp,minutes);
|
fprintf(stderr,"GetValueIn %lld i.%d time.%u minutes.%d\n",(long long)value,i,timestamp,minutes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -510,7 +510,7 @@ public:
|
|||||||
* @param[in] tx transaction for which we are checking input total
|
* @param[in] tx transaction for which we are checking input total
|
||||||
* @return Sum of value of all inputs (scriptSigs)
|
* @return Sum of value of all inputs (scriptSigs)
|
||||||
*/
|
*/
|
||||||
CAmount GetValueIn(const CTransaction& tx,uint32_t blocktime) const;
|
CAmount GetValueIn(const CTransaction& tx,uint32_t prevblocktime) const;
|
||||||
|
|
||||||
//! Check whether all prevouts of the transaction are present in the UTXO set represented by this view
|
//! Check whether all prevouts of the transaction are present in the UTXO set represented by this view
|
||||||
bool HaveInputs(const CTransaction& tx) const;
|
bool HaveInputs(const CTransaction& tx) const;
|
||||||
|
|||||||
@@ -1042,7 +1042,6 @@ CAmount GetMinRelayFee(const CTransaction& tx, unsigned int nBytes, bool fAllowF
|
|||||||
bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransaction &tx, bool fLimitFree,
|
bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransaction &tx, bool fLimitFree,
|
||||||
bool* pfMissingInputs, bool fRejectAbsurdFee)
|
bool* pfMissingInputs, bool fRejectAbsurdFee)
|
||||||
{
|
{
|
||||||
uint32_t blocktime = (uint32_t)time(NULL);
|
|
||||||
AssertLockHeld(cs_main);
|
AssertLockHeld(cs_main);
|
||||||
if (pfMissingInputs)
|
if (pfMissingInputs)
|
||||||
*pfMissingInputs = false;
|
*pfMissingInputs = false;
|
||||||
@@ -1133,7 +1132,7 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa
|
|||||||
// Bring the best block into scope
|
// Bring the best block into scope
|
||||||
view.GetBestBlock();
|
view.GetBestBlock();
|
||||||
|
|
||||||
nValueIn = view.GetValueIn(tx,blocktime);
|
nValueIn = view.GetValueIn(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
|
// we have all inputs cached now, so switch back to dummy, so we don't need to keep lock on mempool
|
||||||
view.SetBackend(dummy);
|
view.SetBackend(dummy);
|
||||||
@@ -2154,7 +2153,7 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin
|
|||||||
return state.DoS(100, error("ConnectBlock(): too many sigops"),
|
return state.DoS(100, error("ConnectBlock(): too many sigops"),
|
||||||
REJECT_INVALID, "bad-blk-sigops");
|
REJECT_INVALID, "bad-blk-sigops");
|
||||||
|
|
||||||
nFees += view.GetValueIn(tx,pindex->nTime)-tx.GetValueOut();
|
nFees += view.GetValueIn(tx,pindex->pprev->nTime)-tx.GetValueOut();
|
||||||
|
|
||||||
std::vector<CScriptCheck> vChecks;
|
std::vector<CScriptCheck> vChecks;
|
||||||
if (!ContextualCheckInputs(tx, state, view, fScriptChecks, flags, false, chainparams.GetConsensus(), nScriptCheckThreads ? &vChecks : NULL))
|
if (!ContextualCheckInputs(tx, state, view, fScriptChecks, flags, false, chainparams.GetConsensus(), nScriptCheckThreads ? &vChecks : NULL))
|
||||||
|
|||||||
Reference in New Issue
Block a user