From a130c5cb667e867de58659d28e653fa41a3a2f38 Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 15 Nov 2016 07:47:14 -0300 Subject: [PATCH] test --- src/coins.cpp | 2 +- src/coins.h | 4 ++-- src/komodo.h | 1 + src/pow.cpp | 4 ++-- src/rpcblockchain.cpp | 1 + src/rpcrawtransaction.cpp | 17 +++++++++++++++++ 6 files changed, 24 insertions(+), 5 deletions(-) diff --git a/src/coins.cpp b/src/coins.cpp index d7208cce8..46e4f55b4 100644 --- a/src/coins.cpp +++ b/src/coins.cpp @@ -408,8 +408,8 @@ CAmount CCoinsViewCache::GetValueIn(int32_t nHeight,int64_t *interestp,const CTr } nResult += interest; } -#endif (*interestp) += interest; +#endif } nResult += tx.GetJoinSplitValueIn(); diff --git a/src/coins.h b/src/coins.h index 7d5bc8168..34e3a89d7 100644 --- a/src/coins.h +++ b/src/coins.h @@ -87,14 +87,14 @@ public: //! version of the CTransaction; accesses to this value should probably check for nHeight as well, //! as new tx version will probably only be introduced at certain heights int nVersion; - uint32_t nLockTime; + //uint32_t nLockTime; void FromTx(const CTransaction &tx, int nHeightIn) { fCoinBase = tx.IsCoinBase(); vout = tx.vout; nHeight = nHeightIn; nVersion = tx.nVersion; - nLockTime = tx.nLockTime; + //nLockTime = tx.nLockTime; ClearUnspendable(); } diff --git a/src/komodo.h b/src/komodo.h index 5a6cded90..ccc94bb36 100644 --- a/src/komodo.h +++ b/src/komodo.h @@ -17,6 +17,7 @@ #define H_KOMODO_H // Todo: +// 00. standardize interests // 0. optimize assetchains RT loop // 1. error check fiat redeem amounts // 2. net balance limiter diff --git a/src/pow.cpp b/src/pow.cpp index befb665bd..69789f5fa 100644 --- a/src/pow.cpp +++ b/src/pow.cpp @@ -155,8 +155,8 @@ bool CheckProofOfWork(int32_t height,uint8_t *pubkey33,uint256 hash, unsigned in } if (fNegative || bnTarget == 0 || fOverflow || bnTarget > UintToArith256(params.powLimit)) return error("CheckProofOfWork(): nBits below minimum work"); - if ( height > 70000 ) - bnTarget /= 64; + //if ( height > 70000 ) + // bnTarget /= 64; // Check proof of work matches claimed amount if ( UintToArith256(hash) > bnTarget ) { diff --git a/src/rpcblockchain.cpp b/src/rpcblockchain.cpp index 7373d51c9..a08866fa5 100644 --- a/src/rpcblockchain.cpp +++ b/src/rpcblockchain.cpp @@ -577,6 +577,7 @@ Value gettxout(const Array& params, bool fHelp) CBlockIndex *pblockindex = chainActive[coins.nHeight]; uint64_t interest; uint32_t timestamp=0; + if ( pblockindex != 0 ) timestamp = pblockindex->nTime; // this is approx, but cant figure out how to get tx here interest = komodo_interest(coins.nHeight,coins.vout[n].nValue,timestamp,pindex->nTime); diff --git a/src/rpcrawtransaction.cpp b/src/rpcrawtransaction.cpp index c27f8213c..72887d0f4 100644 --- a/src/rpcrawtransaction.cpp +++ b/src/rpcrawtransaction.cpp @@ -251,6 +251,23 @@ Value getrawtransaction(const Array& params, bool fHelp) return result; } +uint32_t komodo_interest_args(int32_t *prevblockheightp,int32_t *prevblocktimep,uint64_t *valuep,uint256 hash,int32_t n) +{ + //interest = komodo_interest(pindex->nHeight,txout.nValue,tx.nLockTime,pindex->nTime); + LOCK(cs_main); + CTransaction tx; + uint256 hashBlock; + if ( !GetTransaction(hash,tx,hashBlock,true) ) + return(0); + uint32_t locktime = 0; + if ( n < tx.vout.size() ) + { + locktime = tx.nLockTime; + //TxToJSON(tx,hashBlock,result); + } + return(locktime); +} + Value gettxoutproof(const Array& params, bool fHelp) { if (fHelp || (params.size() != 1 && params.size() != 2))