Merge pull request #436 from jl777/dev

Dev
This commit is contained in:
jl777
2017-06-04 19:44:22 +03:00
committed by GitHub
4 changed files with 11 additions and 7 deletions

View File

@@ -391,7 +391,8 @@ extern char ASSETCHAINS_SYMBOL[16];
CAmount CCoinsViewCache::GetValueIn(int32_t nHeight,int64_t *interestp,const CTransaction& tx,uint32_t tiptime) const
{
*interestp = 0;
if ( interestp != 0 )
*interestp = 0;
if ( tx.IsCoinBase() != 0 )
return 0;
CAmount value,nResult = 0;
@@ -400,7 +401,7 @@ CAmount CCoinsViewCache::GetValueIn(int32_t nHeight,int64_t *interestp,const CTr
value = GetOutputFor(tx.vin[i]).nValue;
nResult += value;
#ifdef KOMODO_ENABLE_INTEREST
if ( ASSETCHAINS_SYMBOL[0] == 0 && nHeight >= 60000 )
if ( interestp != 0 && ASSETCHAINS_SYMBOL[0] == 0 && nHeight >= 60000 )
{
if ( value >= 10*COIN )
{

View File

@@ -1803,15 +1803,14 @@ bool CheckTxInputs(const CTransaction& tx, CValidationState& state, const CCoins
// Check for negative or overflow input values
nValueIn += coins->vout[prevout.n].nValue;
#ifdef KOMODO_ENABLE_INTEREST
if ( ASSETCHAINS_SYMBOL[0] == 0 && chainActive.Tip() != 0 && chainActive.Tip()->nHeight >= 60000 )
if ( ASSETCHAINS_SYMBOL[0] == 0 && chainActive.Tip() != 0 && chainActive.Tip()->nHeight >= 60000 && chainActive.Tip()->nHeight < 350000 )
{
if ( coins->vout[prevout.n].nValue >= 10*COIN )
{
int64_t interest; int32_t txheight; uint32_t locktime;
if ( (interest= komodo_accrued_interest(&txheight,&locktime,prevout.hash,prevout.n,0,coins->vout[prevout.n].nValue)) != 0 )
{
//printf("checkResult %.8f += val %.8f interest %.8f ht.%d lock.%u tip.%u\n",(double)nValueIn/COIN,(double)coins->vout[prevout.n].nValue/COIN,(double)interest/COIN,txheight,locktime,chainActive.Tip()->nTime);
//fprintf(stderr,"checkResult %.8f += val %.8f interest %.8f ht.%d lock.%u tip.%u\n",(double)nValueIn/COIN,(double)coins->vout[prevout.n].nValue/COIN,(double)interest/COIN,txheight,locktime,chainActive.Tip()->nTime);
fprintf(stderr,"checkResult %.8f += val %.8f interest %.8f ht.%d lock.%u tip.%u\n",(double)nValueIn/COIN,(double)coins->vout[prevout.n].nValue/COIN,(double)interest/COIN,txheight,locktime,chainActive.Tip()->nTime);
nValueIn += interest;
}
}

View File

@@ -335,7 +335,7 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn)
if (!view.HaveInputs(tx))
continue;
CAmount nTxFees = view.GetValueIn(chainActive.Tip()->nHeight,&interest,tx,chainActive.Tip()->nTime)-tx.GetValueOut();
CAmount nTxFees = view.GetValueIn(chainActive.Tip()->nHeight,0,tx,chainActive.Tip()->nTime)-tx.GetValueOut();
nTxSigOps += GetP2SHSigOpCount(tx, view);
if (nBlockSigOps + nTxSigOps >= MAX_BLOCK_SIGOPS)

View File

@@ -56,7 +56,11 @@ void TxConfirmStats::ClearCurrent(unsigned int nBlockHeight)
unsigned int TxConfirmStats::FindBucketIndex(double val)
{
auto it = bucketMap.lower_bound(val);
assert(it != bucketMap.end());
//assert(it != bucketMap.end());
if ( it != bucketMap.end() )
{
fprintf(stderr,"FindBucketIndex violation: from val %f\n",val);
}
return it->second;
}