Browse Source

Test

etomic
jl777 8 years ago
parent
commit
b60446894a
  1. 11
      basilisk/basilisk.c

11
basilisk/basilisk.c

@ -39,7 +39,7 @@ cJSON *basilisk_utxosweep(struct supernet_info *myinfo,char *symbol,int64_t *sat
coin = iguana_coinfind(symbol); coin = iguana_coinfind(symbol);
if ( (retstr= dex_listunspent(myinfo,coin,0,0,symbol,coinaddr)) != 0 ) if ( (retstr= dex_listunspent(myinfo,coin,0,0,symbol,coinaddr)) != 0 )
{ {
printf("(%s)\n",retstr); //printf("(%s)\n",retstr);
if ( (array= cJSON_Parse(retstr)) != 0 ) if ( (array= cJSON_Parse(retstr)) != 0 )
{ {
n = cJSON_GetArraySize(array); n = cJSON_GetArraySize(array);
@ -51,23 +51,28 @@ cJSON *basilisk_utxosweep(struct supernet_info *myinfo,char *symbol,int64_t *sat
fprintf(stderr,"%.8f ",dstr(value)); fprintf(stderr,"%.8f ",dstr(value));
if ( value <= limit ) if ( value <= limit )
{ {
fprintf(stderr,"< ");
if ( utxos == 0 ) if ( utxos == 0 )
utxos = cJSON_CreateArray(); utxos = cJSON_CreateArray();
jaddi(utxos,jduplicate(item)); jaddi(utxos,jduplicate(item));
} }
else if ( value > biggest ) else if ( value > biggest )
{ {
fprintf(stderr,"biggest! ");
if ( biggestitem != 0 ) if ( biggestitem != 0 )
free_json(biggestitem); free_json(biggestitem);
biggestitem = jduplicate(item); biggestitem = jduplicate(item);
*satoshis = biggest = value; *satoshis = biggest = value;
} } else fprintf(stderr,"> ");
} }
} }
free_json(array); free_json(array);
if ( biggestitem != 0 ) if ( utxos == 0 && biggestitem != 0 )
{
printf("add biggest.(%s)\n",jprint(biggestitem,0));
jaddi(utxos,biggestitem); jaddi(utxos,biggestitem);
} }
}
free(retstr); free(retstr);
} }
return(utxos); return(utxos);

Loading…
Cancel
Save