jl777 7 years ago
parent
commit
031792e445
  1. 2
      iguana/exchanges/LP_include.h
  2. 33
      iguana/exchanges/LP_prices.c
  3. 4
      iguana/exchanges/LP_signatures.c

2
iguana/exchanges/LP_include.h

@ -282,7 +282,7 @@ struct LP_pubkeyinfo
bits256 pubkey;
double matrix[LP_MAXPRICEINFOS][LP_MAXPRICEINFOS];
uint32_t timestamp,istrusted,numerrors;
uint8_t rmd160[20],sig[76],pubsecp[33],siglen;
uint8_t rmd160[20],sig[65],pubsecp[33],siglen;
};
int32_t LP_pubkey_sigcheck(struct LP_pubkeyinfo *pubp,cJSON *item);

33
iguana/exchanges/LP_prices.c

@ -248,7 +248,7 @@ uint64_t LP_unspents_metric(struct iguana_info *coin,char *coinaddr)
cJSON *LP_pubkeyjson(struct LP_pubkeyinfo *pubp)
{
int32_t baseid,relid,i,j; char *base,hexstr[67],hexstr2[67],sigstr[256]; double price; cJSON *item,*array,*obj;
int32_t baseid,relid; char *base,hexstr[67],hexstr2[67],sigstr[256]; double price; cJSON *item,*array,*obj;
obj = cJSON_CreateObject();
array = cJSON_CreateArray();
for (baseid=0; baseid<LP_numpriceinfos; baseid++)
@ -268,31 +268,12 @@ cJSON *LP_pubkeyjson(struct LP_pubkeyinfo *pubp)
}
}
jaddbits256(obj,"pubkey",pubp->pubkey);
for (i=0; i<sizeof(pubp->rmd160); i++)
{
if ( pubp->rmd160[i] != 0 )
{
init_hexbytes_noT(hexstr,pubp->rmd160,sizeof(pubp->rmd160));
jaddstr(obj,"rmd160",hexstr);
for (j=0; j<sizeof(pubp->pubsecp); j++)
{
if ( pubp->pubsecp[j] != 0 )
{
init_hexbytes_noT(hexstr2,pubp->pubsecp,sizeof(pubp->pubsecp));
jaddstr(obj,"pubsecp",hexstr2);
if ( pubp->siglen > 0 )
{
init_hexbytes_noT(sigstr,pubp->sig,pubp->siglen);
jaddstr(obj,"sig",sigstr);
}
//printf("nonz rmd160 (%s %s)\n",hexstr,hexstr2);
//LP_pubkey_sigadd(obj,pubp->pubkey,pubp->rmd160,pubp->pubsecp);
break;
}
}
break;
}
}
init_hexbytes_noT(hexstr,pubp->rmd160,sizeof(pubp->rmd160));
jaddstr(obj,"rmd160",hexstr);
init_hexbytes_noT(hexstr2,pubp->pubsecp,sizeof(pubp->pubsecp));
jaddstr(obj,"pubsecp",hexstr2);
init_hexbytes_noT(sigstr,pubp->sig,pubp->siglen);
jaddstr(obj,"sig",sigstr);
jaddnum(obj,"timestamp",pubp->timestamp);
jadd(obj,"asks",array);
if ( pubp->istrusted != 0 )

4
iguana/exchanges/LP_signatures.c

@ -381,7 +381,7 @@ int32_t LP_pubkey_sigadd(cJSON *item,bits256 priv,bits256 pub,uint8_t *rmd160,ui
int32_t LP_pubkey_sigcheck(struct LP_pubkeyinfo *pubp,cJSON *item)
{
int32_t i,siglen,len,retval=-1; uint8_t rmd160[20],checkrmd160[20],pubsecp[33],sig[128],zeroes[20]; char *sigstr,*hexstr,*pubsecpstr;
int32_t i,len,siglen,retval=-1; uint8_t rmd160[20],checkrmd160[20],pubsecp[33],sig[65],zeroes[20]; char *sigstr,*hexstr,*pubsecpstr;
if ( (hexstr= jstr(item,"rmd160")) != 0 && strlen(hexstr) == 2*sizeof(rmd160) )
{
decode_hex(rmd160,sizeof(rmd160),hexstr);
@ -406,6 +406,8 @@ int32_t LP_pubkey_sigcheck(struct LP_pubkeyinfo *pubp,cJSON *item)
printf("%02x",pubp->rmd160[i]);
memcpy(pubp->rmd160,rmd160,sizeof(pubp->rmd160));
memcpy(pubp->pubsecp,pubsecp,sizeof(pubp->pubsecp));
memcpy(pubp->sig,sig,sizeof(pubp->sig));
pubp->siglen = siglen;
char str[65]; printf(" -> rmd160.(%s) for %s (%s) sig.%s\n",hexstr,bits256_str(str,pubp->pubkey),pubsecpstr,sigstr);
retval = 0;
pubp->timestamp = (uint32_t)time(NULL);

Loading…
Cancel
Save