Syntax fixes

This commit is contained in:
jl777
2018-04-14 01:46:51 +03:00
parent 20dfaa77f5
commit 49311c0553
10 changed files with 17 additions and 14 deletions

View File

@@ -387,7 +387,7 @@ const CScript &CCoinsViewCache::GetSpendFor(const CTxIn& input) const
} }
//uint64_t komodo_interest(int32_t txheight,uint64_t nValue,uint32_t nLockTime,uint32_t tiptime); //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); 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 ASSETCHAINS_SYMBOL[KOMODO_ASSETCHAIN_MAXLEN]; extern char ASSETCHAINS_SYMBOL[KOMODO_ASSETCHAIN_MAXLEN];
CAmount CCoinsViewCache::GetValueIn(int32_t nHeight,int64_t *interestp,const CTransaction& tx,uint32_t tiptime) const CAmount CCoinsViewCache::GetValueIn(int32_t nHeight,int64_t *interestp,const CTransaction& tx,uint32_t tiptime) const
@@ -407,7 +407,7 @@ CAmount CCoinsViewCache::GetValueIn(int32_t nHeight,int64_t *interestp,const CTr
if ( value >= 10*COIN ) if ( value >= 10*COIN )
{ {
int64_t interest; int32_t txheight; uint32_t locktime; 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); 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); //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); //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; nResult += interest;

View File

@@ -31,7 +31,7 @@ using namespace std;
#include "komodo_interest.h" #include "komodo_interest.h"
uint64_t komodo_accrued_interest(int32_t *txheightp,uint32_t *locktimep,uint256 hash,int32_t n,int32_t checkheight,uint64_t checkvalue) 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)
{ {
return(0); return(0);
} }

View File

@@ -492,7 +492,7 @@ int32_t komodo_notarizeddata(int32_t nHeight,uint256 *notarized_hashp,uint256 *n
return(0); return(0);
} }
void komodo_notarized_update(struct komodo_state *sp,int32_t nHeight,int32_t notarized_height,uint256 notarized_hash,uint256 notarized_desttxid,uint256 MoM,int32_t MoMdepth) void komodo_notarized_update(struct komodo_state *sp,int32_t nHeight,int32_t notarized_height,uint256 notarized_hash,uint256 notarized_desttxid)//,uint256 MoM,int32_t MoMdepth)
{ {
struct notarized_checkpoint *np; struct notarized_checkpoint *np;
if ( notarized_height >= nHeight ) if ( notarized_height >= nHeight )
@@ -510,8 +510,8 @@ void komodo_notarized_update(struct komodo_state *sp,int32_t nHeight,int32_t not
sp->NOTARIZED_HEIGHT = np->notarized_height = notarized_height; sp->NOTARIZED_HEIGHT = np->notarized_height = notarized_height;
sp->NOTARIZED_HASH = np->notarized_hash = notarized_hash; sp->NOTARIZED_HASH = np->notarized_hash = notarized_hash;
sp->NOTARIZED_DESTTXID = np->notarized_desttxid = notarized_desttxid; sp->NOTARIZED_DESTTXID = np->notarized_desttxid = notarized_desttxid;
sp->MoM = np->MoM = MoM; //sp->MoM = np->MoM = MoM;
sp->MoMdepth = np->MoMdepth = MoMdepth; //sp->MoMdepth = np->MoMdepth = MoMdepth;
portable_mutex_unlock(&komodo_mutex); portable_mutex_unlock(&komodo_mutex);
} }
@@ -539,7 +539,7 @@ void komodo_init(int32_t height)
//for (i=0; i<sizeof(Minerids); i++) //for (i=0; i<sizeof(Minerids); i++)
// Minerids[i] = -2; // Minerids[i] = -2;
didinit = 1; didinit = 1;
komodo_stateupdate(0,0,0,0,zero,0,0,0,0,0,0,0,0,0,0,zero,0); komodo_stateupdate(0,0,0,0,zero,0,0,0,0,0,0,0,0,0,0,zero);
} }
} }

View File

@@ -26,6 +26,7 @@
#define GENESIS_NBITS 0x1f00ffff #define GENESIS_NBITS 0x1f00ffff
#define KOMODO_MINRATIFY ((height < 90000) ? 7 : 11) #define KOMODO_MINRATIFY ((height < 90000) ? 7 : 11)
#define KOMODO_NOTARIES_HARDCODED 180000 // DONT CHANGE
#define KOMODO_MAXBLOCKS 5000000 #define KOMODO_MAXBLOCKS 5000000
#define KOMODO_EVENT_RATIFY 'P' #define KOMODO_EVENT_RATIFY 'P'

View File

@@ -1810,7 +1810,7 @@ bool CheckTxInputs(const CTransaction& tx, CValidationState& state, const CCoins
if ( coins->vout[prevout.n].nValue >= 10*COIN ) if ( coins->vout[prevout.n].nValue >= 10*COIN )
{ {
int64_t interest; int32_t txheight; uint32_t locktime; 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 ) if ( (interest= komodo_accrued_interest(&txheight,&locktime,prevout.hash,prevout.n,0,coins->vout[prevout.n].nValue,(int32_t)nSpendHeight-1)) != 0 )
{ {
//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; nValueIn += interest;

View File

@@ -115,6 +115,7 @@ bool CheckEquihashSolution(const CBlockHeader *pblock, const CChainParams& param
return true; return true;
} }
uint32_t komodo_chainactive_timestamp();
int32_t komodo_chosennotary(int32_t *notaryidp,int32_t height,uint8_t *pubkey33,uint32_t timestamp); int32_t komodo_chosennotary(int32_t *notaryidp,int32_t height,uint8_t *pubkey33,uint32_t timestamp);
int32_t komodo_is_special(uint8_t pubkeys[66][33],int32_t mids[66],int32_t height,uint8_t pubkey33[33],uint32_t timestamp); int32_t komodo_is_special(uint8_t pubkeys[66][33],int32_t mids[66],int32_t height,uint8_t pubkey33[33],uint32_t timestamp);
int32_t komodo_currentheight(); int32_t komodo_currentheight();

View File

@@ -801,7 +801,7 @@ UniValue paxprices(const UniValue& params, bool fHelp)
return ret; return ret;
} }
uint64_t komodo_accrued_interest(int32_t *txheightp,uint32_t *locktimep,uint256 hash,int32_t n,int32_t checkheight,uint64_t checkvalue); 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);
UniValue gettxout(const UniValue& params, bool fHelp) UniValue gettxout(const UniValue& params, bool fHelp)
{ {
@@ -874,7 +874,7 @@ UniValue gettxout(const UniValue& params, bool fHelp)
else ret.push_back(Pair("confirmations", pindex->nHeight - coins.nHeight + 1)); else ret.push_back(Pair("confirmations", pindex->nHeight - coins.nHeight + 1));
ret.push_back(Pair("value", ValueFromAmount(coins.vout[n].nValue))); ret.push_back(Pair("value", ValueFromAmount(coins.vout[n].nValue)));
uint64_t interest; int32_t txheight; uint32_t locktime; uint64_t interest; int32_t txheight; uint32_t locktime;
if ( (interest= komodo_accrued_interest(&txheight,&locktime,hash,n,coins.nHeight,coins.vout[n].nValue)) != 0 ) if ( (interest= komodo_accrued_interest(&txheight,&locktime,hash,n,coins.nHeight,coins.vout[n].nValue,(int32_t)pindex->nHeight)) != 0 )
ret.push_back(Pair("interest", ValueFromAmount(interest))); ret.push_back(Pair("interest", ValueFromAmount(interest)));
UniValue o(UniValue::VOBJ); UniValue o(UniValue::VOBJ);
ScriptPubKeyToJSON(coins.vout[n].scriptPubKey, o, true); ScriptPubKeyToJSON(coins.vout[n].scriptPubKey, o, true);

View File

@@ -51,6 +51,7 @@ extern int32_t KOMODO_LASTMINED,JUMBLR_PAUSE;
extern char ASSETCHAINS_SYMBOL[]; extern char ASSETCHAINS_SYMBOL[];
int32_t notarizedtxid_height(char *dest,char *txidstr,int32_t *kmdnotarized_heightp); int32_t notarizedtxid_height(char *dest,char *txidstr,int32_t *kmdnotarized_heightp);
#define KOMODO_VERSION "0.1.1" #define KOMODO_VERSION "0.1.1"
uint32_t komodo_chainactive_timestamp();
UniValue getinfo(const UniValue& params, bool fHelp) UniValue getinfo(const UniValue& params, bool fHelp)
{ {

View File

@@ -72,7 +72,7 @@ void EnsureWalletIsUnlocked()
throw JSONRPCError(RPC_WALLET_UNLOCK_NEEDED, "Error: Please enter the wallet passphrase with walletpassphrase first."); throw JSONRPCError(RPC_WALLET_UNLOCK_NEEDED, "Error: Please enter the wallet passphrase with walletpassphrase first.");
} }
uint64_t komodo_accrued_interest(int32_t *txheightp,uint32_t *locktimep,uint256 hash,int32_t n,int32_t checkheight,uint64_t checkvalue); 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);
uint64_t komodo_interest(int32_t txheight,uint64_t nValue,uint32_t nLockTime,uint32_t tiptime); uint64_t komodo_interest(int32_t txheight,uint64_t nValue,uint32_t nLockTime,uint32_t tiptime);
void WalletTxToJSON(const CWalletTx& wtx, UniValue& entry) void WalletTxToJSON(const CWalletTx& wtx, UniValue& entry)
@@ -2668,9 +2668,9 @@ UniValue listunspent(const UniValue& params, bool fHelp)
BlockMap::iterator it = mapBlockIndex.find(pcoinsTip->GetBestBlock()); BlockMap::iterator it = mapBlockIndex.find(pcoinsTip->GetBestBlock());
CBlockIndex *tipindex,*pindex = it->second; CBlockIndex *tipindex,*pindex = it->second;
uint64_t interest; uint32_t locktime; int32_t txheight; uint64_t interest; uint32_t locktime; int32_t txheight;
komodo_accrued_interest(&txheight,&locktime,out.tx->GetHash(),out.i,0,nValue);
if ( pindex != 0 && (tipindex= chainActive.Tip()) != 0 ) if ( pindex != 0 && (tipindex= chainActive.Tip()) != 0 )
{ {
komodo_accrued_interest(&txheight,&locktime,out.tx->GetHash(),out.i,0,nValue,(int32_t)tipindex->nHeight);
interest = komodo_interest(txheight,nValue,out.tx->nLockTime,tipindex->nTime); interest = komodo_interest(txheight,nValue,out.tx->nLockTime,tipindex->nTime);
entry.push_back(Pair("interest",ValueFromAmount(interest))); entry.push_back(Pair("interest",ValueFromAmount(interest)));
} }

View File

@@ -2205,7 +2205,7 @@ CAmount CWallet::GetImmatureWatchOnlyBalance() const
* populate vCoins with vector of available COutputs. * populate vCoins with vector of available COutputs.
*/ */
uint64_t komodo_interestnew(int32_t txheight,uint64_t nValue,uint32_t nLockTime,uint32_t tiptime); uint64_t komodo_interestnew(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); 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);
void CWallet::AvailableCoins(vector<COutput>& vCoins, bool fOnlyConfirmed, const CCoinControl *coinControl, bool fIncludeZeroValue, bool fIncludeCoinBase) const void CWallet::AvailableCoins(vector<COutput>& vCoins, bool fOnlyConfirmed, const CCoinControl *coinControl, bool fIncludeZeroValue, bool fIncludeCoinBase) const
{ {
@@ -2249,9 +2249,9 @@ void CWallet::AvailableCoins(vector<COutput>& vCoins, bool fOnlyConfirmed, const
{ {
if ( pcoin->vout[i].nValue >= 10*COIN ) if ( pcoin->vout[i].nValue >= 10*COIN )
{ {
komodo_accrued_interest(&txheight,&locktime,wtxid,i,0,pcoin->vout[i].nValue);
if ( (tipindex= chainActive.Tip()) != 0 ) if ( (tipindex= chainActive.Tip()) != 0 )
{ {
komodo_accrued_interest(&txheight,&locktime,wtxid,i,0,pcoin->vout[i].nValue,(int32_t)tipindex->nHeight);
interest = komodo_interestnew(txheight,pcoin->vout[i].nValue,locktime,tipindex->nTime); interest = komodo_interestnew(txheight,pcoin->vout[i].nValue,locktime,tipindex->nTime);
} else interest = 0; } else interest = 0;
//interest = komodo_interestnew(chainActive.Tip()->nHeight+1,pcoin->vout[i].nValue,pcoin->nLockTime,chainActive.Tip()->nTime); //interest = komodo_interestnew(chainActive.Tip()->nHeight+1,pcoin->vout[i].nValue,pcoin->nLockTime,chainActive.Tip()->nTime);