jl777 7 years ago
parent
commit
fee9b4cf9d
  1. 6
      crypto777/bitcoind_RPC.c
  2. 5
      iguana/dpow/dpow_fsm.c
  3. 21
      iguana/iguana_wallet.c

6
crypto777/bitcoind_RPC.c

@ -73,8 +73,8 @@ char *post_process_bitcoind_RPC(char *debugstr,char *command,char *rpcstr,char *
long i,j,len; long i,j,len;
char *retstr = 0; char *retstr = 0;
cJSON *json,*result,*error; cJSON *json,*result,*error;
#ifdef FROM_MARKETMAKER #ifndef FROM_MARKETMAKER
//usleep(1000); usleep(1000);
#endif #endif
//printf("<<<<<<<<<<< bitcoind_RPC: %s post_process_bitcoind_RPC.%s.[%s]\n",debugstr,command,rpcstr); //printf("<<<<<<<<<<< bitcoind_RPC: %s post_process_bitcoind_RPC.%s.[%s]\n",debugstr,command,rpcstr);
if ( command == 0 || rpcstr == 0 || rpcstr[0] == 0 ) if ( command == 0 || rpcstr == 0 || rpcstr[0] == 0 )
@ -163,7 +163,7 @@ char *bitcoind_RPC(char **retstrp,char *debugstr,char *url,char *userpass,char *
else specialcase = 0; else specialcase = 0;
if ( url[0] == 0 ) if ( url[0] == 0 )
strcpy(url,"http://127.0.0.1:7776"); strcpy(url,"http://127.0.0.1:7776");
//if ( specialcase != 0 && (0) ) if ( specialcase != 0 && (0) )
printf("<<<<<<<<<<< bitcoind_RPC: userpass.(%s) url.(%s) command.(%s) params.(%s)\n",userpass,url,command,params); printf("<<<<<<<<<<< bitcoind_RPC: userpass.(%s) url.(%s) command.(%s) params.(%s)\n",userpass,url,command,params);
try_again: try_again:
if ( retstrp != 0 ) if ( retstrp != 0 )

5
iguana/dpow/dpow_fsm.c

@ -309,7 +309,7 @@ bits256 dpow_calcMoM(uint32_t *MoMdepthp,struct supernet_info *myinfo,struct igu
bits256 MoM,blockhash,merkle,*merkles; cJSON *blockjson; uint64_t signedmask; int32_t breakht=0,notht=0,ht,maxdepth = 1440,MoMdepth = 0; bits256 MoM,blockhash,merkle,*merkles; cJSON *blockjson; uint64_t signedmask; int32_t breakht=0,notht=0,ht,maxdepth = 1440,MoMdepth = 0;
memset(MoM.bytes,0,sizeof(MoM)); memset(MoM.bytes,0,sizeof(MoM));
blockhash = dpow_getblockhash(myinfo,coin,height); blockhash = dpow_getblockhash(myinfo,coin,height);
//printf("start MoM calc %s height.%d\n",coin->symbol,height); printf("start MoM calc %s height.%d\n",coin->symbol,height);
if ( (blockjson= dpow_getblock(myinfo,coin,blockhash)) != 0 ) if ( (blockjson= dpow_getblock(myinfo,coin,blockhash)) != 0 )
{ {
merkle = jbits256(blockjson,"merkleroot"); merkle = jbits256(blockjson,"merkleroot");
@ -349,6 +349,7 @@ bits256 dpow_calcMoM(uint32_t *MoMdepthp,struct supernet_info *myinfo,struct igu
break; break;
} }
ht = height - MoMdepth; ht = height - MoMdepth;
usleep(10000);
} }
if ( MoMdepth > 0 ) if ( MoMdepth > 0 )
{ {
@ -364,7 +365,7 @@ bits256 dpow_calcMoM(uint32_t *MoMdepthp,struct supernet_info *myinfo,struct igu
} else printf("%s.ht%d null merkles\n",coin->symbol,height); } else printf("%s.ht%d null merkles\n",coin->symbol,height);
} else printf("%s.ht%d null block\n",coin->symbol,height); } else printf("%s.ht%d null block\n",coin->symbol,height);
*MoMdepthp = MoMdepth; *MoMdepthp = MoMdepth;
//printf("done MoM calc %s height.%d MoMdepth.%d\n",coin->symbol,height,MoMdepth); printf("done MoM calc %s height.%d MoMdepth.%d\n",coin->symbol,height,MoMdepth);
return(MoM); return(MoM);
} }

21
iguana/iguana_wallet.c

@ -1342,7 +1342,7 @@ ZERO_ARGS(bitcoinrpc,walletlock)
TWOSTRINGS_AND_INT(bitcoinrpc,walletpassphrase,password,permanentfile,timeout) TWOSTRINGS_AND_INT(bitcoinrpc,walletpassphrase,password,permanentfile,timeout)
{ {
char *retstr; char *retstr,*tmpstr; cJSON *retjson;
if ( remoteaddr != 0 ) if ( remoteaddr != 0 )
return(clonestr("{\"error\":\"no remote\"}")); return(clonestr("{\"error\":\"no remote\"}"));
if ( timeout <= 0 ) if ( timeout <= 0 )
@ -1368,9 +1368,22 @@ TWOSTRINGS_AND_INT(bitcoinrpc,walletpassphrase,password,permanentfile,timeout)
bitcoin_address(coin->changeaddr,coin->chain->pubtype,myinfo->persistent_pubkey33,33); bitcoin_address(coin->changeaddr,coin->chain->pubtype,myinfo->persistent_pubkey33,33);
if ( coin->FULLNODE < 0 ) if ( coin->FULLNODE < 0 )
{ {
char wifstr[64]; char wifstr[64]; int32_t destvalid = 0; cJSON *ismine;
bitcoin_priv2wif(wifstr,myinfo->persistent_priv,coin->chain->wiftype); if ( (tmpstr= dpow_validateaddress(myinfo,coin,coin->changeaddr)) != 0 )
jumblr_importprivkey(myinfo,coin,wifstr); {
retjson = cJSON_Parse(tmpstr);
if ( (ismine= jobj(json,"ismine")) != 0 && is_cJSON_True(ismine) != 0 )
destvalid = 1;
else destvalid = 0;
free(tmpstr);
free(retjson);
tmpstr = 0;
}
if ( destvalid == 0 )
{
bitcoin_priv2wif(wifstr,myinfo->persistent_priv,coin->chain->wiftype);
jumblr_importprivkey(myinfo,coin,wifstr);
}
} }
} }
if ( bits256_nonz(myinfo->persistent_priv) != 0 ) if ( bits256_nonz(myinfo->persistent_priv) != 0 )

Loading…
Cancel
Save