Browse Source

test

etomic
jl777 8 years ago
parent
commit
07460b831d
  1. 2
      iguana/dPoW.h
  2. 4
      iguana/dpow/dpow_network.c
  3. 43
      iguana/dpow/dpow_rpc.c
  4. 2
      iguana/iguana777.c
  5. 2
      iguana/m_notary

2
iguana/dPoW.h

@ -157,7 +157,7 @@ bits256 dpow_getblockhash(struct supernet_info *myinfo,struct iguana_info *coin,
bits256 dpow_getbestblockhash(struct supernet_info *myinfo,struct iguana_info *coin); bits256 dpow_getbestblockhash(struct supernet_info *myinfo,struct iguana_info *coin);
char *dpow_sendrawtransaction(struct supernet_info *myinfo,struct iguana_info *coin,char *signedtx); char *dpow_sendrawtransaction(struct supernet_info *myinfo,struct iguana_info *coin,char *signedtx);
cJSON *dpow_gettxout(struct supernet_info *myinfo,struct iguana_info *coin,bits256 txid,int32_t vout); cJSON *dpow_gettxout(struct supernet_info *myinfo,struct iguana_info *coin,bits256 txid,int32_t vout);
char *dpow_importaddress(struct supernet_info *myinfo,struct iguana_info *coin,char *address,int32_t forceflag); char *dpow_importaddress(struct supernet_info *myinfo,struct iguana_info *coin,char *address);
char *dpow_validateaddress(struct supernet_info *myinfo,struct iguana_info *coin,char *address); char *dpow_validateaddress(struct supernet_info *myinfo,struct iguana_info *coin,char *address);
cJSON *dpow_listunspent(struct supernet_info *myinfo,struct iguana_info *coin,char *coinaddr); cJSON *dpow_listunspent(struct supernet_info *myinfo,struct iguana_info *coin,char *coinaddr);
cJSON *dpow_listtransactions(struct supernet_info *myinfo,struct iguana_info *coin,char *coinaddr,int32_t count,int32_t skip); cJSON *dpow_listtransactions(struct supernet_info *myinfo,struct iguana_info *coin,char *coinaddr,int32_t count,int32_t skip);

4
iguana/dpow/dpow_network.c

@ -270,7 +270,7 @@ char *dex_response(int32_t *broadcastflagp,struct supernet_info *myinfo,struct d
} }
else if ( dexreq.func == 'A' ) else if ( dexreq.func == 'A' )
{ {
retstr = dpow_importaddress(myinfo,coin,(char *)&dexp->packet[datalen],0); retstr = dpow_importaddress(myinfo,coin,(char *)&dexp->packet[datalen]);
if ( retstr == 0 ) if ( retstr == 0 )
{ {
*broadcastflagp = 1; *broadcastflagp = 1;
@ -935,6 +935,8 @@ void dpow_ratify_update(struct supernet_info *myinfo,struct dpow_info *dp,struct
{ {
if ( ((1LL << i) & matchesmask) != 0 ) if ( ((1LL << i) & matchesmask) != 0 )
{ {
if ( bp->notaries[i].pendingcrcs[bp->state < 1000] == 0 )
continue;
if ( numcrcs == 0 ) if ( numcrcs == 0 )
numcrcs++, crcval = bp->notaries[i].pendingcrcs[bp->state < 1000]; numcrcs++, crcval = bp->notaries[i].pendingcrcs[bp->state < 1000];
else if ( numcrcs > 0 && crcval == bp->notaries[i].pendingcrcs[bp->state < 1000] ) else if ( numcrcs > 0 && crcval == bp->notaries[i].pendingcrcs[bp->state < 1000] )

43
iguana/dpow/dpow_rpc.c

@ -434,9 +434,22 @@ char *dpow_alladdresses(struct supernet_info *myinfo,struct iguana_info *coin)
return(retstr); return(retstr);
} }
char *dpow_importaddress(struct supernet_info *myinfo,struct iguana_info *coin,char *address,int32_t forceflag) char *dpow_importaddress(struct supernet_info *myinfo,struct iguana_info *coin,char *address)
{ {
char buf[1024],*retstr,*alladdresses,*outstr,fname[1024]; cJSON *alljson; int32_t i,n; FILE *fp; char buf[1024],*retstr,*alladdresses,*outstr,fname[1024]; cJSON *alljson,*validatejson; int32_t i,n,doneflag = 0; FILE *fp;
if ( (retstr= dpow_validateaddress(myinfo,coin,address)) != 0 )
{
if ( (validatejson= cJSON_Parse(retstr)) != 0 )
{
if ( is_cJSON_True(jobj(validatejson,"iswatchonly")) != 0 || is_cJSON_True(jobj(validatejson,"ismine")) != 0 )
doneflag = 1;
free_json(validatejson);
}
free(retstr);
retstr = 0;
}
if ( doneflag != 0 )
return(0); // success
if ( coin->FULLNODE < 0 ) if ( coin->FULLNODE < 0 )
{ {
sprintf(buf,"[\"%s\", \"%s\", false]",address,address); sprintf(buf,"[\"%s\", \"%s\", false]",address,address);
@ -448,27 +461,21 @@ char *dpow_importaddress(struct supernet_info *myinfo,struct iguana_info *coin,c
{ {
if ( is_cJSON_Array(alljson) != 0 && (n= cJSON_GetArraySize(alljson)) > 0 ) if ( is_cJSON_Array(alljson) != 0 && (n= cJSON_GetArraySize(alljson)) > 0 )
{ {
if ( forceflag == 0 ) for (i=0; i<n; i++)
{ if ( strcmp(address,jstri(alljson,i)) == 0 )
for (i=0; i<n; i++) break;
if ( strcmp(address,jstri(alljson,i)) == 0 )
break;
} else i = n = 0;
if ( i == n ) if ( i == n )
{ {
jaddistr(alljson,address); jaddistr(alljson,address);
if ( forceflag == 0 ) outstr = jprint(alljson,0);
sprintf(fname,"%s/alladdresses.%s",GLOBAL_CONFSDIR,coin->symbol), OS_compatible_path(fname);
if ( (fp= fopen(fname,"wb")) != 0 )
{ {
outstr = jprint(alljson,0); fwrite(outstr,1,strlen(outstr)+1,fp);
sprintf(fname,"%s/alladdresses.%s",GLOBAL_CONFSDIR,coin->symbol), OS_compatible_path(fname); fclose(fp);
if ( (fp= fopen(fname,"wb")) != 0 ) printf("importaddress.(%s) -> alladdresses.%s\n",address,coin->symbol);
{
fwrite(outstr,1,strlen(outstr)+1,fp);
fclose(fp);
printf("importaddress.(%s) -> alladdresses.%s\n",address,coin->symbol);
}
free(outstr);
} }
free(outstr);
} }
} }
free_json(alljson); free_json(alljson);

2
iguana/iguana777.c

@ -904,7 +904,7 @@ void iguana_coinloop(void *arg)
if ( is_cJSON_Array(alljson) != 0 && (n= cJSON_GetArraySize(alljson)) > 0 ) if ( is_cJSON_Array(alljson) != 0 && (n= cJSON_GetArraySize(alljson)) > 0 )
{ {
for (i=0; i<n; i++) for (i=0; i<n; i++)
if ( (retstr= dpow_importaddress(myinfo,coin,jstri(alljson,i),i<n-1)) != 0 ) if ( (retstr= dpow_importaddress(myinfo,coin,jstri(alljson,i))) != 0 )
free(retstr); free(retstr);
} }
free_json(alljson); free_json(alljson);

2
iguana/m_notary

@ -35,7 +35,7 @@ coins/crypto_7776
coins/pangea_7776 coins/pangea_7776
coins/mgw_7776 coins/mgw_7776
coins/mvp_7776 coins/mvp_7776
curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"passthru\",\"method\":\"paxfiats\"}" curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"passthru\",\"method\":\"paxfiats\",\"timeout\":60000}"
#curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"addnotary\",\"ipaddr\":\"$myip\"}" #curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"addnotary\",\"ipaddr\":\"$myip\"}"
curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"KMD\",\"pubkey\":\"$pubkey\"}" curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"KMD\",\"pubkey\":\"$pubkey\"}"

Loading…
Cancel
Save