test
This commit is contained in:
@@ -1179,7 +1179,7 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa
|
|||||||
view.GetBestBlock();
|
view.GetBestBlock();
|
||||||
|
|
||||||
nValueIn = view.GetValueIn(chainActive.Tip()->nHeight,&interest,tx,chainActive.Tip()->nTime);
|
nValueIn = view.GetValueIn(chainActive.Tip()->nHeight,&interest,tx,chainActive.Tip()->nTime);
|
||||||
if ( interest != 0 )
|
if ( 0 && interest != 0 )
|
||||||
fprintf(stderr,"add interest %.8f\n",(double)interest/COIN);
|
fprintf(stderr,"add interest %.8f\n",(double)interest/COIN);
|
||||||
// we have all inputs cached now, so switch back to dummy, so we don't need to keep lock on mempool
|
// we have all inputs cached now, so switch back to dummy, so we don't need to keep lock on mempool
|
||||||
view.SetBackend(dummy);
|
view.SetBackend(dummy);
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ using namespace std;
|
|||||||
* Or alternatively, create a specific query method for the information.
|
* Or alternatively, create a specific query method for the information.
|
||||||
**/
|
**/
|
||||||
uint64_t komodo_interestsum();
|
uint64_t komodo_interestsum();
|
||||||
|
int32_t komodo_longestchain();
|
||||||
int32_t komodo_notarized_height(uint256 *hashp,uint256 *txidp);
|
int32_t komodo_notarized_height(uint256 *hashp,uint256 *txidp);
|
||||||
|
|
||||||
Value getinfo(const Array& params, bool fHelp)
|
Value getinfo(const Array& params, bool fHelp)
|
||||||
@@ -98,6 +99,7 @@ Value getinfo(const Array& params, bool fHelp)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
obj.push_back(Pair("blocks", (int)chainActive.Height()));
|
obj.push_back(Pair("blocks", (int)chainActive.Height()));
|
||||||
|
obj.push_back(Pair("longestchain", komodo_longestchain()));
|
||||||
obj.push_back(Pair("timeoffset", GetTimeOffset()));
|
obj.push_back(Pair("timeoffset", GetTimeOffset()));
|
||||||
if ( chainActive.Tip() != 0 )
|
if ( chainActive.Tip() != 0 )
|
||||||
obj.push_back(Pair("tiptime", (int)chainActive.Tip()->nTime));
|
obj.push_back(Pair("tiptime", (int)chainActive.Tip()->nTime));
|
||||||
|
|||||||
@@ -165,6 +165,36 @@ Value getpeerinfo(const Array& params, bool fHelp)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int32_t komodo_longestchain()
|
||||||
|
{
|
||||||
|
int32_t ht,n=0,num=0,maxheight=0,height = 0;
|
||||||
|
LOCK(cs_main);
|
||||||
|
vector<CNodeStats> vstats;
|
||||||
|
CopyNodeStats(vstats);
|
||||||
|
BOOST_FOREACH(const CNodeStats& stats, vstats)
|
||||||
|
{
|
||||||
|
CNodeStateStats statestats;
|
||||||
|
bool fStateStats = GetNodeStateStats(stats.nodeid,statestats);
|
||||||
|
ht = 0;
|
||||||
|
if ( stats.nStartingHeight > ht )
|
||||||
|
ht = stats.nStartingHeight;
|
||||||
|
if ( stats.nSyncHeight > ht )
|
||||||
|
ht = stats.nSyncHeight;
|
||||||
|
if ( stats.nCommonHeight > ht )
|
||||||
|
ht = stats.nCommonHeight;
|
||||||
|
if ( maxheight == 0 || ht > maxheight*1.01 )
|
||||||
|
maxheight = ht, num = 1;
|
||||||
|
else if ( ht > maxheight*0.99 )
|
||||||
|
num++;
|
||||||
|
n++;
|
||||||
|
if ( ht > height )
|
||||||
|
height = ht;
|
||||||
|
}
|
||||||
|
if ( num > (n >> 1) )
|
||||||
|
return(height);
|
||||||
|
else return(0);
|
||||||
|
}
|
||||||
|
|
||||||
Value addnode(const Array& params, bool fHelp)
|
Value addnode(const Array& params, bool fHelp)
|
||||||
{
|
{
|
||||||
string strCommand;
|
string strCommand;
|
||||||
|
|||||||
Reference in New Issue
Block a user