Browse Source

Merge pull request #705 from jl777/dev

Dev
patch-1
jl777 7 years ago
committed by GitHub
parent
commit
a07b6f0155
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      iguana/dpow/dpow_fsm.c
  2. 18
      iguana/dpow/dpow_rpc.c
  3. 2
      iguana/exchanges/coins
  4. 4
      iguana/iguana_notary.c

7
iguana/dpow/dpow_fsm.c

@ -265,7 +265,7 @@ int32_t dpow_txhasnotarization(uint64_t *signedmaskp,int32_t *nothtp,struct supe
{ {
bits256 blockhash,txid,MoM; uint32_t MoMdepth; char symbol[65];//,str[65],str2[65],str3[65]; bits256 blockhash,txid,MoM; uint32_t MoMdepth; char symbol[65];//,str[65],str2[65],str3[65];
vout = jitem(vouts,numvouts-1); vout = jitem(vouts,numvouts-1);
if ( (sobj= jobj(vout,"scriptPubKey")) != 0 && (hexstr= jstr(sobj,"hex")) != 0 && (len= is_hexstr(hexstr,0)) > 36 && len < sizeof(script) ) if ( (sobj= jobj(vout,"scriptPubKey")) != 0 && (hexstr= jstr(sobj,"hex")) != 0 && (len= is_hexstr(hexstr,0)) > 36 && len < sizeof(script)*2 )
{ {
len >>= 1; len >>= 1;
decode_hex(script,len,hexstr); decode_hex(script,len,hexstr);
@ -316,7 +316,7 @@ bits256 dpow_calcMoM(uint32_t *MoMdepthp,struct supernet_info *myinfo,struct igu
free_json(blockjson); free_json(blockjson);
if ( bits256_nonz(merkle) != 0 ) if ( bits256_nonz(merkle) != 0 )
{ {
merkles = calloc(3*maxdepth+1,sizeof(*merkles)); merkles = calloc(4*maxdepth+1,sizeof(*merkles));
merkles[MoMdepth++] = merkle; merkles[MoMdepth++] = merkle;
ht = height - MoMdepth; ht = height - MoMdepth;
while ( MoMdepth < maxdepth && ht > breakht && ht > 0 ) while ( MoMdepth < maxdepth && ht > breakht && ht > 0 )
@ -401,6 +401,7 @@ void dpow_statemachinestart(void *ptr)
{ {
kmdheight = dest->longestchain; kmdheight = dest->longestchain;
//portable_mutex_lock(&myinfo->MoM_mutex); //portable_mutex_lock(&myinfo->MoM_mutex);
if ( Notaries_port != DPOW_SOCKPORT )
MoM = dpow_calcMoM(&MoMdepth,myinfo,src,checkpoint.blockhash.height); MoM = dpow_calcMoM(&MoMdepth,myinfo,src,checkpoint.blockhash.height);
//portable_mutex_unlock(&myinfo->MoM_mutex); //portable_mutex_unlock(&myinfo->MoM_mutex);
} }
@ -637,7 +638,7 @@ void dpow_statemachinestart(void *ptr)
extralen = dpow_paxpending(extras,&bp->paxwdcrc,bp->MoM,bp->MoMdepth); extralen = dpow_paxpending(extras,&bp->paxwdcrc,bp->MoM,bp->MoMdepth);
bp->notaries[bp->myind].paxwdcrc = bp->paxwdcrc; bp->notaries[bp->myind].paxwdcrc = bp->paxwdcrc;
} }
sleep(13); sleep(30);
if ( (checkpoint.blockhash.height % 100) != 0 && dp->checkpoint.blockhash.height > checkpoint.blockhash.height ) if ( (checkpoint.blockhash.height % 100) != 0 && dp->checkpoint.blockhash.height > checkpoint.blockhash.height )
{ {
if ( bp->isratify == 0 ) if ( bp->isratify == 0 )

18
iguana/dpow/dpow_rpc.c

@ -43,7 +43,7 @@ cJSON *dpow_getinfo(struct supernet_info *myinfo,struct iguana_info *coin)
{ {
buf[0] = 0; buf[0] = 0;
retstr = bitcoind_getinfo(coin->symbol,coin->chain->serverport,coin->chain->userpass,coin->getinfostr); retstr = bitcoind_getinfo(coin->symbol,coin->chain->serverport,coin->chain->userpass,coin->getinfostr);
usleep(1000); usleep(10000);
} }
else if ( coin->FULLNODE > 0 || coin->VALIDATENODE > 0 ) else if ( coin->FULLNODE > 0 || coin->VALIDATENODE > 0 )
{ {
@ -275,7 +275,7 @@ bits256 dpow_getblockhash(struct supernet_info *myinfo,struct iguana_info *coin,
sprintf(buf,"%d",height); sprintf(buf,"%d",height);
retstr = bitcoind_passthru(coin->symbol,coin->chain->serverport,coin->chain->userpass,"getblockhash",buf); retstr = bitcoind_passthru(coin->symbol,coin->chain->serverport,coin->chain->userpass,"getblockhash",buf);
//printf("%s ht.%d -> getblockhash.(%s)\n",coin->symbol,height,retstr); //printf("%s ht.%d -> getblockhash.(%s)\n",coin->symbol,height,retstr);
usleep(1000); usleep(10000);
} }
else if ( coin->FULLNODE > 0 || coin->VALIDATENODE > 0 ) 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); retstr = bitcoind_passthru(coin->symbol,coin->chain->serverport,coin->chain->userpass,"getblock",buf);
if ( 0 && strcmp(coin->symbol,"USD") == 0 ) if ( 0 && strcmp(coin->symbol,"USD") == 0 )
printf("%s getblock.(%s)\n",coin->symbol,retstr); printf("%s getblock.(%s)\n",coin->symbol,retstr);
usleep(1000); usleep(10000);
} }
else if ( coin->FULLNODE > 0 || coin->VALIDATENODE > 0 ) 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); sprintf(buf,"\"%s\"",address);
retstr = bitcoind_passthru(coin->symbol,coin->chain->serverport,coin->chain->userpass,"validateaddress",buf); retstr = bitcoind_passthru(coin->symbol,coin->chain->serverport,coin->chain->userpass,"validateaddress",buf);
usleep(1000); usleep(10000);
} }
else if ( coin->FULLNODE > 0 || coin->VALIDATENODE > 0 ) 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 ) if ( coin->FULLNODE < 0 )
{ {
retstr = bitcoind_passthru(coin->symbol,coin->chain->serverport,coin->chain->userpass,"gettxout",buf); retstr = bitcoind_passthru(coin->symbol,coin->chain->serverport,coin->chain->userpass,"gettxout",buf);
usleep(1000); usleep(10000);
} }
else if ( coin->FULLNODE > 0 || coin->VALIDATENODE > 0 ) 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); retstr = bitcoind_passthru(coin->symbol,coin->chain->serverport,coin->chain->userpass,"decoderawtransaction",paramstr);
//printf("%s decoderawtransaction.(%s) <- (%s)\n",coin->symbol,retstr,paramstr); //printf("%s decoderawtransaction.(%s) <- (%s)\n",coin->symbol,retstr,paramstr);
free(paramstr); free(paramstr);
usleep(1000); usleep(10000);
} }
else if ( coin->FULLNODE > 0 || coin->VALIDATENODE > 0 ) 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 ) if ( (retstr= bitcoind_passthru(coin->symbol,coin->chain->serverport,coin->chain->userpass,"getrawtransaction",buf)) != 0 )
{ {
} }
usleep(1000); usleep(10000);
} }
else if ( coin->FULLNODE > 0 || coin->VALIDATENODE > 0 ) 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); retstr = bitcoind_passthru(coin->symbol,coin->chain->serverport,coin->chain->userpass,"signrawtransaction",paramstr);
//printf("%s signrawtransaction.(%s) params.(%s)\n",coin->symbol,retstr,paramstr); //printf("%s signrawtransaction.(%s) params.(%s)\n",coin->symbol,retstr,paramstr);
free(paramstr); free(paramstr);
usleep(1000); usleep(10000);
return(retstr); return(retstr);
} }
else if ( coin->FULLNODE > 0 || coin->VALIDATENODE > 0 ) 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); printf("error height %d\n",height);
break; break;
} }
usleep(1000); usleep(10000);
} }
if ( height >= currentheight ) if ( height >= currentheight )
*isrealtimep = (uint32_t)time(NULL); *isrealtimep = (uint32_t)time(NULL);

2
iguana/exchanges/coins

File diff suppressed because one or more lines are too long

4
iguana/iguana_notary.c

@ -135,9 +135,9 @@ void dpow_srcupdate(struct supernet_info *myinfo,struct dpow_info *dp,int32_t he
if ( OS_thread_create((void *)((uint64_t)&ptrs[5] + sizeof(struct dpow_checkpoint)),NULL,(void *)dpow_statemachinestart,(void *)ptrs) != 0 ) if ( OS_thread_create((void *)((uint64_t)&ptrs[5] + sizeof(struct dpow_checkpoint)),NULL,(void *)dpow_statemachinestart,(void *)ptrs) != 0 )
{ {
} }
if ( ht > 1000 ) if ( ht > 100 )
{ {
for (i=ht-1000; i>=0; i--) for (i=ht-100; i>=0; i--)
{ {
if ( (i % 100) != 0 && (bp= dp->blocks[i]) != 0 && bp->state == 0xffffffff ) if ( (i % 100) != 0 && (bp= dp->blocks[i]) != 0 && bp->state == 0xffffffff )
{ {

Loading…
Cancel
Save