Remove Komodo interest code and various other improvements

This commit is contained in:
Duke Leto
2020-12-15 13:14:54 -05:00
parent 87370e1da8
commit c2eec1f7a7
81 changed files with 322 additions and 2911 deletions

View File

@@ -2,7 +2,6 @@
// Copyright (c) 2016-2020 The Hush developers
// Distributed under the GPLv3 software license, see the accompanying
// file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
/******************************************************************************
* Copyright © 2014-2019 The SuperNET Developers. *
* *
@@ -17,7 +16,6 @@
* Removal or modification of this copyright notice is prohibited. *
* *
******************************************************************************/
#include "coins.h"
#include "memusage.h"
#include "random.h"
@@ -26,7 +24,6 @@
#include "hush_defs.h"
#include "importcoin.h"
#include <assert.h>
/**
* calculate number of bytes for the bitmask, and its number of non-zero bytes
* each bit in the bitmask represents the availability of one output, but the
@@ -536,8 +533,6 @@ const CTxOut &CCoinsViewCache::GetOutputFor(const CTxIn& input) const
return coins->vout[input.prevout.n];
}
//uint64_t komodo_interest(int32_t txheight,uint64_t nValue,uint32_t nLockTime,uint32_t tiptime);
uint64_t komodo_accrued_interest(int32_t *txheightp,uint32_t *locktimep,uint256 hash,int32_t n,int32_t checkheight,uint64_t checkvalue,int32_t tipheight);
extern char SMART_CHAIN_SYMBOL[HUSH_SMART_CHAIN_MAXLEN];
const CScript &CCoinsViewCache::GetSpendFor(const CCoins *coins, const CTxIn& input)
@@ -570,20 +565,6 @@ CAmount CCoinsViewCache::GetValueIn(int32_t nHeight,int64_t *interestp,const CTr
}
value = GetOutputFor(tx.vin[i]).nValue;
nResult += value;
#ifdef KOMODO_ENABLE_INTEREST
if ( SMART_CHAIN_SYMBOL[0] == 0 && nHeight >= 60000 )
{
if ( value >= 10*COIN )
{
int64_t interest; int32_t txheight; uint32_t locktime;
interest = komodo_accrued_interest(&txheight,&locktime,tx.vin[i].prevout.hash,tx.vin[i].prevout.n,0,value,(int32_t)nHeight);
//printf("nResult %.8f += val %.8f interest %.8f ht.%d lock.%u tip.%u\n",(double)nResult/COIN,(double)value/COIN,(double)interest/COIN,txheight,locktime,tiptime);
//fprintf(stderr,"nResult %.8f += val %.8f interest %.8f ht.%d lock.%u tip.%u\n",(double)nResult/COIN,(double)value/COIN,(double)interest/COIN,txheight,locktime,tiptime);
nResult += interest;
(*interestp) += interest;
}
}
#endif
}
nResult += tx.GetShieldedValueIn();