Browse Source

Merge pull request #446 from jl777/spvdex

Spvdex
etomic
jl777 7 years ago
committed by GitHub
parent
commit
15eb45cebc
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      iguana/exchanges/LP_commands.c
  2. 1
      iguana/exchanges/LP_include.h
  3. 2
      iguana/exchanges/LP_rpc.c
  4. 8
      iguana/exchanges/LP_socket.c
  5. 12
      iguana/exchanges/LP_utxo.c

4
iguana/exchanges/LP_commands.c

@ -557,7 +557,9 @@ bot_resume(botid)\n\
//printf("network invoked\n");
LP_privkey_init(-1,ptr,G.LP_privkey,G.LP_mypub25519);
//LP_smartutxos_push(ptr);
return(jprint(LP_address_utxos(ptr,coinaddr,1),1));
if ( ptr->electrum != 0 )
return(LP_unspents_filestr(coin,ptr->smartaddr));
else return(jprint(LP_address_utxos(ptr,coinaddr,1),1));
}
else
{

1
iguana/exchanges/LP_include.h

@ -425,6 +425,7 @@ cJSON *LP_gettxout(char *symbol,char *coinaddr,bits256 txid,int32_t vout);
void LP_postutxos(char *symbol,char *coinaddr);
int32_t LP_listunspent_both(char *symbol,char *coinaddr,int32_t fullflag);
uint16_t LP_randpeer(char *destip);
char *LP_unspents_filestr(char *symbol,char *addr);
cJSON *bitcoin_data2json(uint8_t taddr,uint8_t pubtype,uint8_t p2shtype,uint8_t isPoS,int32_t height,bits256 *txidp,struct iguana_msgtx *msgtx,uint8_t *extraspace,int32_t extralen,uint8_t *serialized,int32_t len,cJSON *vins,int32_t suppress_pubkeys,int32_t zcash);
//int32_t LP_butxo_findeither(bits256 txid,int32_t vout);
cJSON *LP_listunspent(char *symbol,char *coinaddr);

2
iguana/exchanges/LP_rpc.c

@ -694,7 +694,7 @@ cJSON *LP_listunspent(char *symbol,char *coinaddr)
sprintf(buf,"[%d, 99999999, [\"%s\"]]",numconfs,coinaddr);
return(bitcoin_json(coin,"listunspent",buf));
} else return(LP_address_utxos(coin,coinaddr,0));
} else return(electrum_address_listunspent(symbol,coin->electrum,&retjson,coinaddr,1));
} else return(electrum_address_listunspent(symbol,coin->electrum,&retjson,coinaddr,2));
}
int32_t LP_listunspent_issue(char *symbol,char *coinaddr,int32_t fullflag)

8
iguana/exchanges/LP_socket.c

@ -622,7 +622,13 @@ cJSON *electrum_address_listunspent(char *symbol,struct electrum_info *ep,cJSON
}
}
if ( retjson == 0 )
retjson = LP_address_utxos(coin,addr,1);
{
if ( strcmp(addr,coin->smartaddr) == 0 && (retstr= LP_unspents_filestr(symbol,coin->smartaddr)) != 0 )
{
retjson = LP_address_utxos(coin,addr,1);
free(retstr);
} else retjson = LP_address_utxos(coin,addr,1);
}
return(retjson);
}

12
iguana/exchanges/LP_utxo.c

@ -1087,13 +1087,19 @@ void LP_unspents_cache(char *symbol,char *addr,char *arraystr,int32_t updatedfla
}
}
char *LP_unspents_filestr(char *symbol,char *addr)
{
char fname[1024]; long fsize;
sprintf(fname,"%s/UNSPENTS/%s_%s",GLOBAL_DBDIR,symbol,addr), OS_portable_path(fname);
return(OS_filestr(&fsize,fname));
}
uint64_t LP_unspents_load(char *symbol,char *addr)
{
char fname[1024],*arraystr; uint64_t balance = 0; int32_t i,n; long fsize; struct iguana_info *coin; cJSON *retjson,*item;
char *arraystr; uint64_t balance = 0; int32_t i,n; cJSON *retjson,*item; struct iguana_info *coin;
if ( (coin= LP_coinfind(symbol)) != 0 )
{
sprintf(fname,"%s/UNSPENTS/%s_%s",GLOBAL_DBDIR,symbol,addr), OS_portable_path(fname);
if ( (arraystr= OS_filestr(&fsize,fname)) != 0 )
if ( (arraystr= LP_unspents_filestr(symbol,addr)) != 0 )
{
if ( (retjson= cJSON_Parse(arraystr)) != 0 )
{

Loading…
Cancel
Save