Browse Source

Test

etomic
jl777 7 years ago
parent
commit
954b6b0987
  1. 2
      iguana/exchanges/LP_bitcoin.c
  2. 23
      iguana/exchanges/LP_stats.c

2
iguana/exchanges/LP_bitcoin.c

@ -2031,7 +2031,7 @@ int32_t bitcoin_addr2rmd160(uint8_t taddr,uint8_t *addrtypep,uint8_t rmd160[20],
} }
for (i=0; i<len; i++) for (i=0; i<len; i++)
printf("%02x ",buf[i]); printf("%02x ",buf[i]);
char str[65]; printf("\ntaddr.%02x checkhash.(%s) len.%d mismatch %02x %02x %02x %02x vs %02x %02x %02x %02x (%s)\n",taddr,coinaddr,len,buf[len-1]&0xff,buf[len-2]&0xff,buf[len-3]&0xff,buf[len-4]&0xff,hash.bytes[31],hash.bytes[30],hash.bytes[29],hash.bytes[28],bits256_str(str,hash)); char str[65]; printf("\naddrtype.%d taddr.%02x checkhash.(%s) len.%d mismatch %02x %02x %02x %02x vs %02x %02x %02x %02x (%s)\n",*addrtypep,taddr,coinaddr,len,buf[len-1]&0xff,buf[len-2]&0xff,buf[len-3]&0xff,buf[len-4]&0xff,hash.bytes[31],hash.bytes[30],hash.bytes[29],hash.bytes[28],bits256_str(str,hash));
} }
} }
return(0); return(0);

23
iguana/exchanges/LP_stats.c

@ -133,7 +133,7 @@ void LP_swapstats_update(struct LP_swapstats *sp,struct LP_quoteinfo *qp,cJSON *
int32_t LP_statslog_parsequote(char *method,cJSON *lineobj) int32_t LP_statslog_parsequote(char *method,cJSON *lineobj)
{ {
static uint32_t unexpected; static uint32_t unexpected;
struct LP_swapstats *sp; double qprice; uint32_t timestamp; int32_t i,numtrades[LP_MAXPRICEINFOS],methodind,destvout,feevout,duplicate=0; char *gui,*base,*rel,line[1024]; uint64_t aliceid,txfee,satoshis,destsatoshis; bits256 desttxid,feetxid; struct LP_quoteinfo Q; uint64_t basevols[LP_MAXPRICEINFOS],relvols[LP_MAXPRICEINFOS]; struct LP_swapstats *sp,*tmp; double qprice; uint32_t requestid,quoteid,timestamp; int32_t i,flag,numtrades[LP_MAXPRICEINFOS],methodind,destvout,feevout,duplicate=0; char *gui,*base,*rel,line[1024]; uint64_t aliceid,txfee,satoshis,destsatoshis; bits256 desttxid,feetxid; struct LP_quoteinfo Q; uint64_t basevols[LP_MAXPRICEINFOS],relvols[LP_MAXPRICEINFOS];
memset(numtrades,0,sizeof(numtrades)); memset(numtrades,0,sizeof(numtrades));
memset(basevols,0,sizeof(basevols)); memset(basevols,0,sizeof(basevols));
memset(relvols,0,sizeof(relvols)); memset(relvols,0,sizeof(relvols));
@ -146,12 +146,31 @@ int32_t LP_statslog_parsequote(char *method,cJSON *lineobj)
} }
if ( strcmp(method,"tradestatus") == 0 ) if ( strcmp(method,"tradestatus") == 0 )
{ {
flag = 0;
aliceid = j64bits(lineobj,"aliceid"); aliceid = j64bits(lineobj,"aliceid");
requestid = juint(lineobj,"requestid");
quoteid = juint(lineobj,"quoteid");
if ( (sp= LP_swapstats_find(aliceid)) != 0 ) if ( (sp= LP_swapstats_find(aliceid)) != 0 )
{
flag = 1;
sp->methodind = methodind;
LP_swapstats_update(sp,&Q,lineobj);
}
else
{
HASH_ITER(hh,LP_swapstats,sp,tmp)
{
if ( sp->Q.R.requestid == requestid && sp->Q.R.quoteid == quoteid )
{ {
sp->methodind = methodind; sp->methodind = methodind;
LP_swapstats_update(sp,&Q,lineobj); LP_swapstats_update(sp,&Q,lineobj);
} else printf("unexpected.%d tradestatus.(%s)\n",unexpected++,jprint(lineobj,0)); flag = 1;
break;
}
}
}
if ( flag == 0 )
printf("unexpected.%d tradestatus.(%s)\n",unexpected++,jprint(lineobj,0));
return(0); return(0);
} }
if ( LP_quoteparse(&Q,lineobj) < 0 ) if ( LP_quoteparse(&Q,lineobj) < 0 )

Loading…
Cancel
Save