Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
0094f50062
  1. 6
      iguana/exchanges/bitcoin.c
  2. 6
      iguana/iguana_instantdex.c
  3. 8
      iguana/iguana_unspents.c

6
iguana/exchanges/bitcoin.c

@ -202,7 +202,7 @@ struct bitcoin_unspent *iguana_unspentsget(struct supernet_info *myinfo,struct i
sprintf(params,"%.0f, 99999999",minconfirms);
if ( (retstr= bitcoind_passthru(coin->symbol,coin->chain->serverport,coin->chain->userpass,"listunspent",params)) != 0 )
{
//printf("sss unspents.(%s)\n",retstr);
printf("sss unspents.(%s)\n",retstr);
if ( (utxo= cJSON_Parse(retstr)) != 0 )
{
n = 0;
@ -212,7 +212,7 @@ struct bitcoin_unspent *iguana_unspentsget(struct supernet_info *myinfo,struct i
for (i=0; i<*numunspentsp; i++)
{
value = bitcoin_parseunspent(coin,&unspents[n],minconfirms,account,jitem(utxo,i));
//printf("i.%d n.%d value %.8f\n",i,n,dstr(value));
printf("i.%d n.%d value %.8f\n",i,n,dstr(value));
if ( value != 0 )
{
total += value;
@ -220,7 +220,7 @@ struct bitcoin_unspent *iguana_unspentsget(struct supernet_info *myinfo,struct i
}
}
}
//printf("numunspents.%d -> %d total %.8f\n",*numunspentsp,n,dstr(total));
printf("numunspents.%d -> %d total %.8f\n",*numunspentsp,n,dstr(total));
*numunspentsp = n;
free_json(utxo);
} else printf("error parsing.(%s)\n",retstr);

6
iguana/iguana_instantdex.c

@ -1143,14 +1143,14 @@ char *instantdex_parse(struct supernet_info *myinfo,struct instantdex_msghdr *ms
}
A.offer = *offer;
A.orderid = orderhash.txid;
printf("got.(%s) for %llu offer64.%llu\n",cmdstr,(long long)A.orderid,(long long)A.offer.offer64);
printf("got.(%s) for %llu offer64.%llu serdatalen.%d\n",cmdstr,(long long)A.orderid,(long long)A.offer.offer64,serdatalen);
if ( (A.offer.minperc= jdouble(argjson,"p")) < INSTANTDEX_MINPERC )
A.offer.minperc = INSTANTDEX_MINPERC;
else if ( A.offer.minperc > 100 )
A.offer.minperc = 100;
if ( strcmp(cmdstr,"BTCoffer") == 0 ) // incoming
{
printf("BTCoffer state exchange.%p\n",exchange);
printf("BTCoffer state exchange.%p serdatalen.%d\n",exchange,serdatalen);
if ( (ap= instantdex_acceptable(myinfo,exchange,&A,A.offer.minperc)) != 0 )
{
if ( (retstr= instantdex_gotoffer(myinfo,exchange,ap,&A,msg,argjson,remoteaddr,signerbits,serdata,serdatalen)) != 0 ) // adds to statemachine if no error
@ -1231,7 +1231,7 @@ char *InstantDEX_hexmsg(struct supernet_info *myinfo,struct category_info *cat,v
newlen -= olen;
//newlen -= ((long)msg->serialized - (long)msg);
serdata = &serdata[olen];
//printf("received orderhash.%llu olen.%d slen.%d newlen.%d\n",(long long)orderhash.txid,olen,slen,newlen);
printf("received orderhash.%llu olen.%d slen.%d newlen.%d\n",(long long)orderhash.txid,olen,slen,newlen);
} else olen = 0;
if ( newlen <= 0 )
serdata = 0, newlen = 0;

8
iguana/iguana_unspents.c

@ -270,13 +270,13 @@ int32_t iguana_pkhasharray(struct supernet_info *myinfo,struct iguana_info *coin
}
else
{
printf("pkhash balance.[%d] from m.%d check %.8f vs %.8f spent %.8f [%.8f]\n",i,m,dstr(netbalance),dstr(deposits),dstr(spent),dstr(deposits)-dstr(spent));
//printf("pkhash balance.[%d] from m.%d check %.8f vs %.8f spent %.8f [%.8f]\n",i,m,dstr(netbalance),dstr(deposits),dstr(spent),dstr(deposits)-dstr(spent));
total += netbalance;
n++;
}
maxunspents -= m;
numunspents += m;
printf("%d: balance %.8f, lastunspent.%u m.%d num.%d max.%d\n",i,dstr(total),lastunspentind,m,numunspents,maxunspents);
//printf("%d: balance %.8f, lastunspent.%u m.%d num.%d max.%d\n",i,dstr(total),lastunspentind,m,numunspents,maxunspents);
}
}
if ( numunspentsp != 0 )
@ -307,12 +307,12 @@ int64_t iguana_unspents(struct supernet_info *myinfo,struct iguana_info *coin,cJ
bitcoin_address(coinaddr,addrtypes[i],&rmdarray[i * 20],20);
*numunspentsp = 0;
iguana_pkhasharray(myinfo,coin,array,minconf,maxconf,&total,P,coin->bundlescount,&rmdarray[i * 20],coinaddr,&pubkeys[33*i],lastheight,&unspents[numunspents],numunspentsp,maxunspents);
printf("iguana_unspents: i.%d of %d: %s %.8f numunspents.%d\n",i,numrmds,coinaddr,dstr(total),*numunspentsp);
//printf("iguana_unspents: i.%d of %d: %s %.8f numunspents.%d\n",i,numrmds,coinaddr,dstr(total),*numunspentsp);
maxunspents -= *numunspentsp;
numunspents += *numunspentsp;
sum += total;
}
printf("sum %.8f\n",dstr(sum));
//printf("sum %.8f\n",dstr(sum));
free(P);
}
*numunspentsp = numunspents;

Loading…
Cancel
Save