jl777 7 years ago
parent
commit
914f8cada2
  1. 6
      iguana/dpow/dpow_fsm.c
  2. 16
      iguana/dpow/dpow_rpc.c
  3. 2
      iguana/iguana777.h
  4. 1
      iguana/main.c

6
iguana/dpow/dpow_fsm.c

@ -243,7 +243,7 @@ int32_t dpow_hasnotarization(int32_t *nothtp,struct supernet_info *myinfo,struct
bits256 dpow_calcMoM(uint32_t *MoMdepthp,struct supernet_info *myinfo,struct iguana_info *coin,int32_t height)
{
bits256 MoM,blockhash,merkle,*merkles; cJSON *blockjson; int32_t breakht=0,notht=0,ht,maxdepth = 65536,MoMdepth = 0;
bits256 MoM,blockhash,merkle,*merkles; cJSON *blockjson; int32_t breakht=0,notht=0,ht,maxdepth = 20000,MoMdepth = 0;
memset(MoM.bytes,0,sizeof(MoM));
blockhash = dpow_getblockhash(myinfo,coin,height);
printf("start MoM calc %s height.%d\n",coin->symbol,height);
@ -258,7 +258,7 @@ bits256 dpow_calcMoM(uint32_t *MoMdepthp,struct supernet_info *myinfo,struct igu
ht = height - MoMdepth;
while ( MoMdepth < maxdepth && ht >= breakht && ht > 0 )
{
fprintf(stderr,"%s.%d ",coin->symbol,ht);
//fprintf(stderr,"%s.%d ",coin->symbol,ht);
blockhash = dpow_getblockhash(myinfo,coin,ht);
if ( (blockjson= dpow_getblock(myinfo,coin,blockhash)) != 0 )
{
@ -337,7 +337,9 @@ void dpow_statemachinestart(void *ptr)
else if ( strcmp(dest->symbol,"KMD") == 0 )
{
kmdheight = dest->longestchain;
portable_mutex_lock(&myinfo->MoM_mutex);
MoM = dpow_calcMoM(&MoMdepth,myinfo,src,checkpoint.blockhash.height);
portable_mutex_unlock(&myinfo->MoM_mutex);
}
if ( (bp= dp->blocks[checkpoint.blockhash.height]) == 0 )
{

16
iguana/dpow/dpow_rpc.c

@ -43,7 +43,7 @@ cJSON *dpow_getinfo(struct supernet_info *myinfo,struct iguana_info *coin)
{
buf[0] = 0;
retstr = bitcoind_getinfo(coin->symbol,coin->chain->serverport,coin->chain->userpass,coin->getinfostr);
usleep(10000);
usleep(1000);
}
else if ( coin->FULLNODE > 0 || coin->VALIDATENODE > 0 )
{
@ -304,7 +304,7 @@ cJSON *dpow_getblock(struct supernet_info *myinfo,struct iguana_info *coin,bits2
retstr = bitcoind_passthru(coin->symbol,coin->chain->serverport,coin->chain->userpass,"getblock",buf);
if ( 0 && strcmp(coin->symbol,"USD") == 0 )
printf("%s getblock.(%s)\n",coin->symbol,retstr);
usleep(10000);
usleep(1000);
}
else if ( coin->FULLNODE > 0 || coin->VALIDATENODE > 0 )
{
@ -329,7 +329,7 @@ char *dpow_validateaddress(struct supernet_info *myinfo,struct iguana_info *coin
{
sprintf(buf,"\"%s\"",address);
retstr = bitcoind_passthru(coin->symbol,coin->chain->serverport,coin->chain->userpass,"validateaddress",buf);
usleep(10000);
usleep(1000);
}
else if ( coin->FULLNODE > 0 || coin->VALIDATENODE > 0 )
{
@ -349,7 +349,7 @@ cJSON *dpow_gettxout(struct supernet_info *myinfo,struct iguana_info *coin,bits2
if ( coin->FULLNODE < 0 )
{
retstr = bitcoind_passthru(coin->symbol,coin->chain->serverport,coin->chain->userpass,"gettxout",buf);
usleep(10000);
usleep(1000);
}
else if ( coin->FULLNODE > 0 || coin->VALIDATENODE > 0 )
{
@ -380,7 +380,7 @@ char *dpow_decoderawtransaction(struct supernet_info *myinfo,struct iguana_info
retstr = bitcoind_passthru(coin->symbol,coin->chain->serverport,coin->chain->userpass,"decoderawtransaction",paramstr);
//printf("%s decoderawtransaction.(%s) <- (%s)\n",coin->symbol,retstr,paramstr);
free(paramstr);
usleep(10000);
usleep(1000);
}
else if ( coin->FULLNODE > 0 || coin->VALIDATENODE > 0 )
{
@ -402,7 +402,7 @@ cJSON *dpow_gettransaction(struct supernet_info *myinfo,struct iguana_info *coin
if ( (retstr= bitcoind_passthru(coin->symbol,coin->chain->serverport,coin->chain->userpass,"getrawtransaction",buf)) != 0 )
{
}
usleep(10000);
usleep(1000);
}
else if ( coin->FULLNODE > 0 || coin->VALIDATENODE > 0 )
{
@ -509,7 +509,7 @@ char *dpow_signrawtransaction(struct supernet_info *myinfo,struct iguana_info *c
retstr = bitcoind_passthru(coin->symbol,coin->chain->serverport,coin->chain->userpass,"signrawtransaction",paramstr);
//printf("%s signrawtransaction.(%s) params.(%s)\n",coin->symbol,retstr,paramstr);
free(paramstr);
usleep(10000);
usleep(1000);
return(retstr);
}
else if ( coin->FULLNODE > 0 || coin->VALIDATENODE > 0 )
@ -1298,7 +1298,7 @@ int32_t dpow_issuer_iteration(struct dpow_info *dp,struct iguana_info *coin,int3
printf("error height %d\n",height);
break;
}
usleep(10000);
usleep(1000);
}
if ( height >= currentheight )
*isrealtimep = (uint32_t)time(NULL);

2
iguana/iguana777.h

@ -159,7 +159,7 @@ struct supernet_info
struct exchange_info *tradingexchanges[SUPERNET_MAXEXCHANGES]; int32_t numexchanges;
struct iguana_waccount *wallet;
struct iguana_info *allcoins; int32_t allcoins_being_added,allcoins_numvirts;
portable_mutex_t bu_mutex,allcoins_mutex,gecko_mutex,basilisk_mutex,DEX_mutex,DEX_reqmutex,DEX_swapmutex,smart_mutex;
portable_mutex_t bu_mutex,allcoins_mutex,gecko_mutex,basilisk_mutex,DEX_mutex,DEX_reqmutex,DEX_swapmutex,smart_mutex,MoM_mutex;
struct queueitem *DEX_quotes; cJSON *Cunspents,*Cspends;
struct basilisk_swap *swaps[256]; int32_t numswaps;
struct basilisk_message *messagetable; portable_mutex_t messagemutex; queue_t msgQ,p2pQ;

1
iguana/main.c

@ -2245,6 +2245,7 @@ void iguana_main(void *arg)
strcpy(myinfo->rpcsymbol,"BTCD");
iguana_urlinit(myinfo,ismainnet,usessl);
portable_mutex_init(&myinfo->pending_mutex);
portable_mutex_init(&myinfo->MoM_mutex);
portable_mutex_init(&myinfo->dpowmutex);
portable_mutex_init(&myinfo->notarymutex);
portable_mutex_init(&myinfo->psockmutex);

Loading…
Cancel
Save