From 370fb42f6f53de4b58bf87f33d4c03dd513d6660 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sun, 4 Jun 2017 18:43:15 +0300 Subject: [PATCH 1/4] Bucket print --- src/policy/fees.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/policy/fees.cpp b/src/policy/fees.cpp index 9aca615f0..a2ae19172 100644 --- a/src/policy/fees.cpp +++ b/src/policy/fees.cpp @@ -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() ) + { + printf("FindBucketIndex violation: %p != %p from val %f\n",it,bucketMap.end(),val); + } return it->second; } From 3f7c82e3af27da5ba65aecc93c9796060ab7755c Mon Sep 17 00:00:00 2001 From: jl777 Date: Sun, 4 Jun 2017 19:18:13 +0300 Subject: [PATCH 2/4] Test --- src/main.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 0fa600f01..b30c7806d 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -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; } } From 4ec48ddab7a059e82ccbdd25effab8064814f54f Mon Sep 17 00:00:00 2001 From: jl777 Date: Sun, 4 Jun 2017 19:20:53 +0300 Subject: [PATCH 3/4] Test --- src/policy/fees.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/policy/fees.cpp b/src/policy/fees.cpp index a2ae19172..17cac1ce6 100644 --- a/src/policy/fees.cpp +++ b/src/policy/fees.cpp @@ -59,7 +59,7 @@ unsigned int TxConfirmStats::FindBucketIndex(double val) //assert(it != bucketMap.end()); if ( it != bucketMap.end() ) { - printf("FindBucketIndex violation: %p != %p from val %f\n",it,bucketMap.end(),val); + fprintf(stderr,"FindBucketIndex violation: from val %f\n",val); } return it->second; } From 5d2f557e4412ba37581ca5c397d1f3c767ef7483 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sun, 4 Jun 2017 19:39:48 +0300 Subject: [PATCH 4/4] Disable mining unclaimed interest --- src/coins.cpp | 5 +++-- src/miner.cpp | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/coins.cpp b/src/coins.cpp index c97ba0790..9ac4358cd 100644 --- a/src/coins.cpp +++ b/src/coins.cpp @@ -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 ) { diff --git a/src/miner.cpp b/src/miner.cpp index 3de85e5cf..8cee2e5d0 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -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)