jl777 7 years ago
parent
commit
42437fbf1f
  1. 11
      iguana/exchanges/LP_commands.c
  2. 18
      iguana/exchanges/LP_prices.c

11
iguana/exchanges/LP_commands.c

@ -472,6 +472,17 @@ stop()\n\
return(LP_peers());
else if ( strcmp(method,"getcoins") == 0 )
return(jprint(LP_coinsjson(0),1));
else if ( strcmp(method,"wantnotify") == 0 )
{
bits256 pub;
pub = jbits256(argjson,"pub");
if ( bits256_cmp(pub,G.LP_mypub25519) == 0 )
{
printf("wantnotify for me!\n");
LP_notify_pubkeys(ctx,LP_mypubsock);
}
retstr = clonestr("{\"result\":\"success\"}");
}
else if ( strcmp(method,"listunspent") == 0 )
{
if ( (ptr= LP_coinsearch(jstr(argjson,"coin"))) != 0 )

18
iguana/exchanges/LP_prices.c

@ -670,6 +670,23 @@ struct LP_orderbookentry *LP_orderbookentry(char *address,char *base,char *rel,d
return(op);
}
void LP_pubkeys_query()
{
uint8_t zeroes[20]; bits256 zero; cJSON *reqjson; struct LP_pubkeyinfo *pubp=0,*tmp;
memset(zero.bytes,0,sizeof(zero));
memset(zeroes,0,sizeof(zeroes));
HASH_ITER(hh,LP_pubkeyinfos,pubp,tmp)
{
if ( memcmp(zeroes,pubp->rmd160,sizeof(pubp->rmd160)) == 0 )
{
reqjson = cJSON_CreateObject();
jaddstr(reqjson,"method","wantnotify");
jaddbits256(reqjson,"pub",pubp->pubkey);
LP_reserved_msg("","",zero,jprint(reqjson,1));
}
}
}
int32_t LP_orderbook_utxoentries(uint32_t now,int32_t polarity,char *base,char *rel,struct LP_orderbookentry *(**arrayp),int32_t num,int32_t cachednum,int32_t duration)
{
char coinaddr[64]; uint8_t zeroes[20]; struct LP_pubkeyinfo *pubp=0,*tmp; struct LP_priceinfo *basepp; struct LP_orderbookentry *op; struct LP_address *ap; struct iguana_info *basecoin; uint32_t oldest; double price; int32_t baseid,relid,n; uint64_t minsatoshis,maxsatoshis;
@ -731,6 +748,7 @@ char *LP_orderbook(char *base,char *rel,int32_t duration)
suppress_prefetch = 1;
duration = LP_ORDERBOOK_DURATION;
}
LP_pubkeys_query();
baseid = basepp->ind;
relid = relpp->ind;
now = (uint32_t)time(NULL);

Loading…
Cancel
Save