Browse Source

Test

etomic
jl777 7 years ago
parent
commit
f72da2275c
  1. 4
      iguana/exchanges/LP_include.h
  2. 23
      iguana/exchanges/LP_socket.c

4
iguana/exchanges/LP_include.h

@ -182,9 +182,9 @@ struct iguana_info
portable_mutex_t txmutex; struct LP_transaction *transactions; struct LP_address *addresses; portable_mutex_t txmutex; struct LP_transaction *transactions; struct LP_address *addresses;
uint64_t txfee; uint64_t txfee;
int32_t longestchain,firstrefht,firstscanht,lastscanht,bussock,height; uint16_t busport; int32_t longestchain,firstrefht,firstscanht,lastscanht,bussock,height; uint16_t busport;
uint32_t counter,inactive,lastmempool,lastgetinfo,ratetime,heighttime,lastmonitor; uint32_t counter,inactive,lastmempool,lastgetinfo,ratetime,heighttime,lastmonitor,unspenttime;
uint8_t pubtype,p2shtype,isPoS,wiftype,wiftaddr,taddr,noimportprivkey_flag; uint8_t pubtype,p2shtype,isPoS,wiftype,wiftaddr,taddr,noimportprivkey_flag;
char symbol[16],smartaddr[64],userpass[1024],serverport[128]; char symbol[16],smartaddr[64],userpass[1024],serverport[128],lastunspent[64];
// portfolio // portfolio
double price_kmd,force,perc,goal,goalperc,relvolume,rate; double price_kmd,force,perc,goal,goalperc,relvolume,rate;
void *electrum; void *ctx; void *electrum; void *ctx;

23
iguana/exchanges/LP_socket.c

@ -319,7 +319,10 @@ void electrum_process_array(struct iguana_info *coin,cJSON *array)
LP_transactioninit(coin,txid,1); LP_transactioninit(coin,txid,1);
} }
if ( (tx= LP_transactionfind(coin,txid)) != 0 && tx->height <= 0 ) if ( (tx= LP_transactionfind(coin,txid)) != 0 && tx->height <= 0 )
{
tx->height = jint(item,"height"); tx->height = jint(item,"height");
char str[65]; printf(">>>>>>>>>> set %s <- height %d\n",bits256_str(str,txid),tx->height);
}
} }
} }
} }
@ -441,11 +444,16 @@ cJSON *electrum_address_getmempool(char *symbol,struct electrum_info *ep,cJSON *
cJSON *electrum_address_listunspent(char *symbol,struct electrum_info *ep,cJSON **retjsonp,char *addr) cJSON *electrum_address_listunspent(char *symbol,struct electrum_info *ep,cJSON **retjsonp,char *addr)
{ {
cJSON *retjson; struct iguana_info *coin = LP_coinfind(symbol); cJSON *retjson=0; struct iguana_info *coin = LP_coinfind(symbol);
if ( (retjson= electrum_strarg(symbol,ep,retjsonp,"blockchain.address.listunspent",addr,ELECTRUM_TIMEOUT)) != 0 ) if ( strcmp(coin->lastunspent,addr) == 0 && time(NULL) > coin->unspenttime+10 )
{ {
printf("LISTUNSPENT.(%s)\n",jprint(retjson,0)); strcpy(coin->lastunspent,addr);
electrum_process_array(coin,retjson); if ( (retjson= electrum_strarg(symbol,ep,retjsonp,"blockchain.address.listunspent",addr,ELECTRUM_TIMEOUT)) != 0 )
{
printf("LISTUNSPENT.(%s)\n",jprint(retjson,0));
electrum_process_array(coin,retjson);
}
coin->unspenttime = (uint32_t)time(NULL);
} }
return(retjson); return(retjson);
} }
@ -461,7 +469,12 @@ cJSON *electrum_sendrawtransaction(char *symbol,struct electrum_info *ep,cJSON *
cJSON *electrum_estimatefee(char *symbol,struct electrum_info *ep,cJSON **retjsonp,int32_t numblocks) { return(electrum_intarg(symbol,ep,retjsonp,"blockchain.estimatefee",numblocks,ELECTRUM_TIMEOUT)); } cJSON *electrum_estimatefee(char *symbol,struct electrum_info *ep,cJSON **retjsonp,int32_t numblocks) { return(electrum_intarg(symbol,ep,retjsonp,"blockchain.estimatefee",numblocks,ELECTRUM_TIMEOUT)); }
cJSON *electrum_getheader(char *symbol,struct electrum_info *ep,cJSON **retjsonp,int32_t n) { return(electrum_intarg(symbol,ep,retjsonp,"blockchain.block.get_header",n,ELECTRUM_TIMEOUT)); } cJSON *electrum_getheader(char *symbol,struct electrum_info *ep,cJSON **retjsonp,int32_t n) { return(electrum_intarg(symbol,ep,retjsonp,"blockchain.block.get_header",n,ELECTRUM_TIMEOUT)); }
cJSON *electrum_getchunk(char *symbol,struct electrum_info *ep,cJSON **retjsonp,int32_t n) { return(electrum_intarg(symbol,ep,retjsonp,"blockchain.block.get_chunk",n,ELECTRUM_TIMEOUT)); } cJSON *electrum_getchunk(char *symbol,struct electrum_info *ep,cJSON **retjsonp,int32_t n) { return(electrum_intarg(symbol,ep,retjsonp,"blockchain.block.get_chunk",n,ELECTRUM_TIMEOUT)); }
cJSON *electrum_transaction(char *symbol,struct electrum_info *ep,cJSON **retjsonp,bits256 txid) { return(electrum_hasharg(symbol,ep,retjsonp,"blockchain.transaction.get",txid,ELECTRUM_TIMEOUT)); }
cJSON *electrum_transaction(char *symbol,struct electrum_info *ep,cJSON **retjsonp,bits256 txid)
{
char str[65]; printf("%s TRANSACTION.(%s)\n",symbol,bits256_str(str,txid));
return(electrum_hasharg(symbol,ep,retjsonp,"blockchain.transaction.get",txid,ELECTRUM_TIMEOUT));
}
cJSON *electrum_getmerkle(char *symbol,struct electrum_info *ep,cJSON **retjsonp,bits256 txid,int32_t height) cJSON *electrum_getmerkle(char *symbol,struct electrum_info *ep,cJSON **retjsonp,bits256 txid,int32_t height)
{ {

Loading…
Cancel
Save