test
This commit is contained in:
@@ -406,16 +406,21 @@ uint32_t komodo_txtime(uint256 hash)
|
|||||||
return(tx.nLockTime);
|
return(tx.nLockTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
CAmount CCoinsViewCache::GetValueIn(const CTransaction& tx) const
|
CAmount CCoinsViewCache::GetValueIn(const CTransaction& tx,uint32_t blocktime) const
|
||||||
{
|
{
|
||||||
if (tx.IsCoinBase())
|
uint32_t timestamp,minutes;
|
||||||
|
if ( tx.IsCoinBase() != 0 )
|
||||||
return 0;
|
return 0;
|
||||||
|
CAmount value,nResult = 0;
|
||||||
CAmount nResult = 0;
|
|
||||||
for (unsigned int i = 0; i < tx.vin.size(); i++)
|
for (unsigned int i = 0; i < tx.vin.size(); i++)
|
||||||
{
|
{
|
||||||
//fprintf(stderr,"GetValueIn i.%d time.%u\n",i,komodo_txtime(tx.vin[i].prevout.hash));
|
value = GetOutputFor(tx.vin[i]).nValue;
|
||||||
nResult += GetOutputFor(tx.vin[i]).nValue;
|
nResult += value;
|
||||||
|
if ( (timestamp= komodo_txtime(tx.vin[i].prevout.hash)) != 0 && timestamp < blocktime-3600*24*7 && value >= COIN )
|
||||||
|
{
|
||||||
|
minutes = (blocktime - timestamp) / 60;
|
||||||
|
fprintf(stderr,"GetValueIn %lld i.%d time.%u minutes.%d\n",(long long)value,i,timestamp,minutes);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
nResult += tx.GetJoinSplitValueIn();
|
nResult += tx.GetJoinSplitValueIn();
|
||||||
|
|
||||||
|
|||||||
@@ -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) const;
|
CAmount GetValueIn(const CTransaction& tx,uint32_t blocktime) 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;
|
||||||
|
|||||||
@@ -2153,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)-tx.GetValueOut();
|
nFees += view.GetValueIn(tx,pindex->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))
|
||||||
|
|||||||
@@ -275,7 +275,7 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn)
|
|||||||
if (!view.HaveInputs(tx))
|
if (!view.HaveInputs(tx))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
CAmount nTxFees = view.GetValueIn(tx)-tx.GetValueOut();
|
CAmount nTxFees = view.GetValueIn(tx,pblock->nTime)-tx.GetValueOut();
|
||||||
|
|
||||||
nTxSigOps += GetP2SHSigOpCount(tx, view);
|
nTxSigOps += GetP2SHSigOpCount(tx, view);
|
||||||
if (nBlockSigOps + nTxSigOps >= MAX_BLOCK_SIGOPS)
|
if (nBlockSigOps + nTxSigOps >= MAX_BLOCK_SIGOPS)
|
||||||
|
|||||||
Reference in New Issue
Block a user