test
This commit is contained in:
@@ -17,11 +17,10 @@
|
||||
#define H_KOMODO_H
|
||||
|
||||
// Todo:
|
||||
// 00. standardize interests
|
||||
// 0. optimize assetchains RT loop
|
||||
// 1. error check fiat redeem amounts
|
||||
// 2. net balance limiter
|
||||
// 3. verify: interest payment, reorgs
|
||||
// 3. verify: reorgs
|
||||
// 4. automate notarization fee payouts
|
||||
// 5. automated distribution of test REVS snapshot
|
||||
|
||||
|
||||
@@ -582,4 +582,3 @@ uint64_t komodo_accrued_interest(int32_t *txheightp,uint32_t *locktimep,uint256
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
@@ -39,6 +39,8 @@ using namespace std;
|
||||
*
|
||||
* Or alternatively, create a specific query method for the information.
|
||||
**/
|
||||
uint64_t komod_interestsum();
|
||||
|
||||
Value getinfo(const Array& params, bool fHelp)
|
||||
{
|
||||
extern uint256 NOTARIZED_HASH,NOTARIZED_DESTTXID;
|
||||
@@ -90,6 +92,7 @@ Value getinfo(const Array& params, bool fHelp)
|
||||
if (pwalletMain) {
|
||||
obj.push_back(Pair("walletversion", pwalletMain->GetVersion()));
|
||||
obj.push_back(Pair("balance", ValueFromAmount(pwalletMain->GetBalance())));
|
||||
obj.push_back(Pair("interest", ValueFromAmount(komod_interestsum())));
|
||||
}
|
||||
#endif
|
||||
obj.push_back(Pair("blocks", (int)chainActive.Height()));
|
||||
|
||||
@@ -2489,6 +2489,32 @@ Value listunspent(const Array& params, bool fHelp)
|
||||
return results;
|
||||
}
|
||||
|
||||
uint64_t komod_interestsum()
|
||||
{
|
||||
uint64_t interest,sum = 0;
|
||||
vector<COutput> vecOutputs;
|
||||
assert(pwalletMain != NULL);
|
||||
LOCK2(cs_main, pwalletMain->cs_wallet);
|
||||
pwalletMain->AvailableCoins(vecOutputs, false, NULL, true);
|
||||
BOOST_FOREACH(const COutput& out,vecOutputs)
|
||||
{
|
||||
if (out.nDepth < nMinDepth || out.nDepth > nMaxDepth)
|
||||
continue;
|
||||
CAmount nValue = out.tx->vout[out.i].nValue;
|
||||
if ( out.tx->nLockTime != 0 )
|
||||
{
|
||||
BlockMap::iterator it = mapBlockIndex.find(pcoinsTip->GetBestBlock());
|
||||
CBlockIndex *tipindex,*pindex = it->second;
|
||||
if ( pindex != 0 && (tipindex= chainActive.Tip()) != 0 )
|
||||
{
|
||||
interest = komodo_interest(pindex->nHeight,nValue,out.tx->nLockTime,tipindex->nTime);
|
||||
sum += interest;
|
||||
}
|
||||
}
|
||||
}
|
||||
return(sum);
|
||||
}
|
||||
|
||||
Value zc_sample_joinsplit(const json_spirit::Array& params, bool fHelp)
|
||||
{
|
||||
if (fHelp) {
|
||||
|
||||
Reference in New Issue
Block a user