This commit is contained in:
jl777
2016-10-23 19:38:51 -03:00
parent 6998860925
commit 586e33b172

View File

@@ -48,13 +48,15 @@ uint64_t komodo_interest(int32_t txheight,uint64_t nValue,uint32_t nLockTime,uin
int32_t minutes; uint64_t numerator,denominator,interest = 0; int32_t minutes; uint64_t numerator,denominator,interest = 0;
if ( komodo_moneysupply(txheight) < MAX_MONEY && nLockTime >= LOCKTIME_THRESHOLD && tiptime != 0 && nLockTime < tiptime && nValue >= COIN ) if ( komodo_moneysupply(txheight) < MAX_MONEY && nLockTime >= LOCKTIME_THRESHOLD && tiptime != 0 && nLockTime < tiptime && nValue >= COIN )
{ {
minutes = (tiptime - nLockTime) / 60; if ( (minutes= (tiptime - nLockTime) / 60) > 60 )
numerator = (nValue * KOMODO_INTEREST); {
denominator = (((uint64_t)365 * 24 * 60) / minutes); numerator = (nValue * KOMODO_INTEREST);
if ( denominator == 0 ) denominator = (((uint64_t)365 * 24 * 60) / minutes);
denominator = 1; // max KOMODO_INTEREST per transfer, do it at least annually! if ( denominator == 0 )
interest = (numerator / denominator) / COIN; denominator = 1; // max KOMODO_INTEREST per transfer, do it at least annually!
fprintf(stderr,"komodo_interest %lld %.8f nLockTime.%u tiptime.%u minutes.%d interest %lld %.8f (%llu / %llu)\n",(long long)nValue,dstr(nValue),nLockTime,tiptime,minutes,(long long)interest,dstr(interest),(long long)numerator,(long long)denominator); interest = (numerator / denominator) / COIN;
fprintf(stderr,"komodo_interest %lld %.8f nLockTime.%u tiptime.%u minutes.%d interest %lld %.8f (%llu / %llu)\n",(long long)nValue,dstr(nValue),nLockTime,tiptime,minutes,(long long)interest,dstr(interest),(long long)numerator,(long long)denominator);
}
} }
return(interest); return(interest);
} }