|
|
@ -765,7 +765,7 @@ int32_t LP_orderbook_utxoentries(uint32_t now,int32_t polarity,char *base,char * |
|
|
|
|
|
|
|
char *LP_orderbook(char *base,char *rel,int32_t duration) |
|
|
|
{ |
|
|
|
uint32_t now,i; uint64_t depth; struct LP_priceinfo *basepp=0,*relpp=0; struct LP_orderbookentry **bids = 0,**asks = 0; cJSON *retjson,*tmpjson,*array; struct iguana_info *basecoin,*relcoin; int32_t n,numbids=0,numasks=0,cachenumbids,cachenumasks,baseid,relid,suppress_prefetch=0; |
|
|
|
uint32_t now,i; uint64_t depth; struct LP_priceinfo *basepp=0,*relpp=0; struct LP_orderbookentry **bids = 0,**asks = 0; cJSON *retjson,*array; struct iguana_info *basecoin,*relcoin; int32_t n,numbids=0,numasks=0,cachenumbids,cachenumasks,baseid,relid,suppress_prefetch=0; |
|
|
|
basecoin = LP_coinfind(base); |
|
|
|
relcoin = LP_coinfind(rel); |
|
|
|
if ( basecoin == 0 || relcoin == 0 ) |
|
|
@ -813,15 +813,17 @@ char *LP_orderbook(char *base,char *rel,int32_t duration) |
|
|
|
for (i=n=0; i<numbids; i++) |
|
|
|
{ |
|
|
|
jaddi(array,LP_orderbookjson(rel,bids[i])); |
|
|
|
if ( suppress_prefetch == 0 && n < 7 && bids[i]->numutxos < 3 ) |
|
|
|
if ( suppress_prefetch == 0 && n < 3 && bids[i]->numutxos == 0 ) |
|
|
|
{ |
|
|
|
//printf("bid ping %s %s\n",rel,bids[i]->coinaddr);
|
|
|
|
LP_address(relcoin,bids[i]->coinaddr); |
|
|
|
if ( relcoin->electrum == 0 ) |
|
|
|
{ |
|
|
|
LP_listunspent_issue(rel,bids[i]->coinaddr,0); |
|
|
|
else if ( (tmpjson= LP_listunspent(rel,bids[i]->coinaddr)) != 0 ) |
|
|
|
free_json(tmpjson); |
|
|
|
LP_listunspent_query(rel,bids[i]->coinaddr); |
|
|
|
//else if ( (tmpjson= LP_listunspent(rel,bids[i]->coinaddr)) != 0 )
|
|
|
|
// free_json(tmpjson);
|
|
|
|
LP_listunspent_query(rel,bids[i]->coinaddr); |
|
|
|
} |
|
|
|
n++; |
|
|
|
} |
|
|
|
free(bids[i]); |
|
|
@ -835,15 +837,17 @@ char *LP_orderbook(char *base,char *rel,int32_t duration) |
|
|
|
for (i=n=0; i<numasks; i++) |
|
|
|
{ |
|
|
|
jaddi(array,LP_orderbookjson(base,asks[i])); |
|
|
|
if ( suppress_prefetch == 0 && n < 7 && asks[i]->numutxos < 3 ) |
|
|
|
if ( suppress_prefetch == 0 && n < 3 && asks[i]->numutxos == 0 ) |
|
|
|
{ |
|
|
|
//printf("ask ping %s %s\n",base,asks[i]->coinaddr);
|
|
|
|
LP_address(basecoin,asks[i]->coinaddr); |
|
|
|
if ( basecoin->electrum == 0 ) |
|
|
|
{ |
|
|
|
LP_listunspent_issue(base,asks[i]->coinaddr,0); |
|
|
|
else if ( (tmpjson= LP_listunspent(base,asks[i]->coinaddr)) != 0 ) |
|
|
|
free_json(tmpjson); |
|
|
|
LP_listunspent_query(base,asks[i]->coinaddr); |
|
|
|
//else if ( (tmpjson= LP_listunspent(base,asks[i]->coinaddr)) != 0 )
|
|
|
|
// free_json(tmpjson);
|
|
|
|
LP_listunspent_query(base,asks[i]->coinaddr); |
|
|
|
} |
|
|
|
n++; |
|
|
|
} |
|
|
|
free(asks[i]); |
|
|
|