streamline

This commit is contained in:
jl777
2018-04-25 15:04:16 +03:00
parent cdf589a2fd
commit 265660f7cb
3 changed files with 12 additions and 10 deletions

View File

@@ -113,11 +113,11 @@ extern uint8_t NOTARY_PUBKEY33[33],ASSETCHAINS_OVERRIDE_PUBKEY33[33];
uint32_t Mining_start,Mining_height; uint32_t Mining_start,Mining_height;
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_pax_opreturn(int32_t height,uint8_t *opret,int32_t maxsize); int32_t komodo_pax_opreturn(int32_t height,uint8_t *opret,int32_t maxsize);
uint64_t komodo_paxtotal(); //uint64_t komodo_paxtotal();
int32_t komodo_baseid(char *origbase); int32_t komodo_baseid(char *origbase);
int32_t komodo_is_issuer(); int32_t komodo_is_issuer();
int32_t komodo_gateway_deposits(CMutableTransaction *txNew,char *symbol,int32_t tokomodo); int32_t komodo_gateway_deposits(CMutableTransaction *txNew,char *symbol,int32_t tokomodo);
int32_t komodo_isrealtime(int32_t *kmdheightp); //int32_t komodo_isrealtime(int32_t *kmdheightp);
int32_t komodo_validate_interest(const CTransaction &tx,int32_t txheight,uint32_t nTime,int32_t dispflag); int32_t komodo_validate_interest(const CTransaction &tx,int32_t txheight,uint32_t nTime,int32_t dispflag);
uint64_t komodo_commission(const CBlock *block); uint64_t komodo_commission(const CBlock *block);
int32_t komodo_staked(CMutableTransaction &txNew,uint32_t nBits,uint32_t *blocktimep,uint32_t *txtimep,uint256 *utxotxidp,int32_t *utxovoutp,uint64_t *utxovaluep,uint8_t *utxosig); int32_t komodo_staked(CMutableTransaction &txNew,uint32_t nBits,uint32_t *blocktimep,uint32_t *txtimep,uint256 *utxotxidp,int32_t *utxovoutp,uint64_t *utxovaluep,uint8_t *utxosig);
@@ -133,7 +133,7 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn)
return NULL; return NULL;
} }
CBlock *pblock = &pblocktemplate->block; // pointer for convenience CBlock *pblock = &pblocktemplate->block; // pointer for convenience
if ( ASSETCHAINS_SYMBOL[0] != 0 && komodo_baseid(ASSETCHAINS_SYMBOL) >= 0 && chainActive.Tip()->nHeight >= ASSETCHAINS_MINHEIGHT ) /*if ( ASSETCHAINS_SYMBOL[0] != 0 && komodo_baseid(ASSETCHAINS_SYMBOL) >= 0 && chainActive.Tip()->nHeight >= ASSETCHAINS_MINHEIGHT )
{ {
isrealtime = komodo_isrealtime(&kmdheight); isrealtime = komodo_isrealtime(&kmdheight);
deposits = komodo_paxtotal(); deposits = komodo_paxtotal();
@@ -154,7 +154,7 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn)
KOMODO_ON_DEMAND = 0; KOMODO_ON_DEMAND = 0;
if ( 0 && deposits != 0 ) if ( 0 && deposits != 0 )
printf("miner KOMODO_DEPOSIT %llu pblock->nHeight %d mempool.GetTotalTxSize(%d)\n",(long long)komodo_paxtotal(),(int32_t)chainActive.Tip()->nHeight,(int32_t)mempool.GetTotalTxSize()); printf("miner KOMODO_DEPOSIT %llu pblock->nHeight %d mempool.GetTotalTxSize(%d)\n",(long long)komodo_paxtotal(),(int32_t)chainActive.Tip()->nHeight,(int32_t)mempool.GetTotalTxSize());
} }*/
// -regtest only: allow overriding block.nVersion with // -regtest only: allow overriding block.nVersion with
// -blockversion=N to test forking scenarios // -blockversion=N to test forking scenarios
if (Params().MineBlocksOnDemand()) if (Params().MineBlocksOnDemand())

View File

@@ -88,13 +88,13 @@ UniValue getinfo(const UniValue& params, bool fHelp)
+ HelpExampleCli("getinfo", "") + HelpExampleCli("getinfo", "")
+ HelpExampleRpc("getinfo", "") + HelpExampleRpc("getinfo", "")
); );
fprintf(stderr,"before LOCK cs_main\n"); //fprintf(stderr,"before LOCK cs_main\n");
#ifdef ENABLE_WALLET #ifdef ENABLE_WALLET
LOCK2(cs_main, pwalletMain ? &pwalletMain->cs_wallet : NULL); LOCK2(cs_main, pwalletMain ? &pwalletMain->cs_wallet : NULL);
#else #else
LOCK(cs_main); LOCK(cs_main);
#endif #endif
fprintf(stderr,"after LOCK cs_main\n"); //fprintf(stderr,"after LOCK cs_main\n");
proxyType proxy; proxyType proxy;
GetProxy(NET_IPV4, proxy); GetProxy(NET_IPV4, proxy);
@@ -125,7 +125,7 @@ UniValue getinfo(const UniValue& params, bool fHelp)
obj.push_back(Pair("blocks", (int)chainActive.Height())); obj.push_back(Pair("blocks", (int)chainActive.Height()));
if ( (longestchain= komodo_longestchain()) != 0 && chainActive.Height() > longestchain ) if ( (longestchain= komodo_longestchain()) != 0 && chainActive.Height() > longestchain )
longestchain = chainActive.Height(); longestchain = chainActive.Height();
fprintf(stderr,"after longestchain\n"); //fprintf(stderr,"after longestchain\n");
obj.push_back(Pair("longestchain", longestchain)); obj.push_back(Pair("longestchain", longestchain));
obj.push_back(Pair("timeoffset", GetTimeOffset())); obj.push_back(Pair("timeoffset", GetTimeOffset()));
if ( chainActive.Tip() != 0 ) if ( chainActive.Tip() != 0 )

View File

@@ -169,9 +169,11 @@ int32_t KOMODO_LONGESTCHAIN;
int32_t komodo_longestchain() int32_t komodo_longestchain()
{ {
int32_t ht,n=0,num=0,maxheight=0,height = 0; int32_t ht,n=0,num=0,maxheight=0,height = 0;
LOCK(cs_main); {
vector<CNodeStats> vstats; LOCK(cs_main);
CopyNodeStats(vstats); vector<CNodeStats> vstats;
CopyNodeStats(vstats);
}
BOOST_FOREACH(const CNodeStats& stats, vstats) BOOST_FOREACH(const CNodeStats& stats, vstats)
{ {
//fprintf(stderr,"komodo_longestchain iter.%d\n",n); //fprintf(stderr,"komodo_longestchain iter.%d\n",n);