Browse Source

Test

etomic
jl777 7 years ago
parent
commit
ee0596108c
  1. 16
      iguana/exchanges/LP_instantdex.c
  2. 6
      iguana/exchanges/LP_nativeDEX.c
  3. 5
      iguana/exchanges/LP_privkey.c

16
iguana/exchanges/LP_instantdex.c

@ -71,17 +71,16 @@ void LP_instantdex_deposituniq(FILE *fp,bits256 txid)
} else fseek(fp,n * sizeof(txid),SEEK_SET); } else fseek(fp,n * sizeof(txid),SEEK_SET);
} }
void LP_instantdex_filescreate() void LP_instantdex_filescreate(char *coinaddr)
{ {
char fname[512]; FILE *fp; char coinaddr[64]; bits256 txid; int32_t i,n; cJSON *array,*newarray,*txobj; char fname[512]; FILE *fp; bits256 txid; int32_t i,n; cJSON *array,*newarray,*txobj;
sprintf(fname,"%s/deposits",GLOBAL_DBDIR), OS_compatible_path(fname); sprintf(fname,"%s/deposits.%s",GLOBAL_DBDIR,coinaddr), OS_compatible_path(fname);
if ( (fp= fopen(fname,"rb")) != 0 ) if ( (fp= fopen(fname,"rb")) != 0 )
{ {
array = cJSON_CreateArray(); array = cJSON_CreateArray();
newarray = cJSON_CreateArray(); newarray = cJSON_CreateArray();
fseek(fp,0,SEEK_END); fseek(fp,0,SEEK_END);
n = (int32_t)(ftell(fp) / sizeof(txid)); n = (int32_t)(ftell(fp) / sizeof(txid));
bitcoin_address(coinaddr,0,60,G.LP_myrmd160,20);
for (i=0; i<n; i++) for (i=0; i<n; i++)
{ {
fseek(fp,sizeof(txid) * i,SEEK_SET); fseek(fp,sizeof(txid) * i,SEEK_SET);
@ -100,17 +99,16 @@ void LP_instantdex_filescreate()
} }
} }
void LP_instantdex_depositadd(bits256 txid) void LP_instantdex_depositadd(char *coinaddr,bits256 txid)
{ {
static FILE *depositsfp; static FILE *depositsfp;
char fname[512],coinaddr[64]; bits256 prevtxid; cJSON *array,*txobj; int32_t i,n,iter; char fname[512]; bits256 prevtxid; cJSON *array,*txobj; int32_t i,n,iter;
if ( depositsfp == 0 ) if ( depositsfp == 0 )
{ {
sprintf(fname,"%s/deposits",GLOBAL_DBDIR), OS_compatible_path(fname); sprintf(fname,"%s/deposits.%s",GLOBAL_DBDIR,coinaddr), OS_compatible_path(fname);
if ( (depositsfp= fopen(fname,"rb+")) == 0 ) if ( (depositsfp= fopen(fname,"rb+")) == 0 )
{ {
depositsfp = fopen(fname,"wb+"); depositsfp = fopen(fname,"wb+");
bitcoin_address(coinaddr,0,60,G.LP_myrmd160,20);
for (iter=0; iter<2; iter++) for (iter=0; iter<2; iter++)
{ {
if ( (array= LP_instantdex_txids(iter)) != 0 ) if ( (array= LP_instantdex_txids(iter)) != 0 )
@ -140,7 +138,7 @@ void LP_instantdex_depositadd(bits256 txid)
LP_instantdex_deposituniq(depositsfp,txid); LP_instantdex_deposituniq(depositsfp,txid);
fflush(depositsfp); fflush(depositsfp);
} }
LP_instantdex_filescreate(); LP_instantdex_filescreate(coinaddr);
} }
int32_t LP_deposit_addr(char *p2shaddr,uint8_t *script,uint8_t taddr,uint8_t p2shtype,uint32_t timestamp,uint8_t *pubsecp33) int32_t LP_deposit_addr(char *p2shaddr,uint8_t *script,uint8_t taddr,uint8_t p2shtype,uint32_t timestamp,uint8_t *pubsecp33)

6
iguana/exchanges/LP_nativeDEX.c

@ -695,7 +695,7 @@ int32_t LP_mainloop_iter(void *ctx,char *myipaddr,struct LP_peerinfo *mypeer,int
void LP_initcoins(void *ctx,int32_t pubsock,cJSON *coins) void LP_initcoins(void *ctx,int32_t pubsock,cJSON *coins)
{ {
int32_t i,n,notarized; bits256 zero; cJSON *item; char *symbol; struct iguana_info *coin; int32_t i,n,notarized; cJSON *item; char *symbol; struct iguana_info *coin;
for (i=0; i<sizeof(activecoins)/sizeof(*activecoins); i++) for (i=0; i<sizeof(activecoins)/sizeof(*activecoins); i++)
{ {
printf("%s ",activecoins[i]); printf("%s ",activecoins[i]);
@ -712,11 +712,7 @@ void LP_initcoins(void *ctx,int32_t pubsock,cJSON *coins)
{ {
LP_unspents_load(coin->symbol,coin->smartaddr); LP_unspents_load(coin->symbol,coin->smartaddr);
if ( strcmp(coin->symbol,"KMD") == 0 ) if ( strcmp(coin->symbol,"KMD") == 0 )
{
LP_importaddress("KMD",BOTS_BONDADDRESS); LP_importaddress("KMD",BOTS_BONDADDRESS);
memset(zero.bytes,0,sizeof(zero));
LP_instantdex_depositadd(zero);
}
} }
if ( coin->txfee == 0 && strcmp(coin->symbol,"BTC") != 0 ) if ( coin->txfee == 0 && strcmp(coin->symbol,"BTC") != 0 )
coin->txfee = LP_MIN_TXFEE; coin->txfee = LP_MIN_TXFEE;

5
iguana/exchanges/LP_privkey.c

@ -307,7 +307,7 @@ void LP_privkey_updates(void *ctx,int32_t pubsock,char *passphrase)
int32_t LP_passphrase_init(char *passphrase,char *gui) int32_t LP_passphrase_init(char *passphrase,char *gui)
{ {
static void *ctx; int32_t counter; //iambob,; struct LP_utxoinfo *utxo,*tmp; static void *ctx; char coinaddr[64]; bits256 zero; int32_t counter; //iambob,; struct LP_utxoinfo *utxo,*tmp;
if ( ctx == 0 ) if ( ctx == 0 )
ctx = bitcoin_ctx(); ctx = bitcoin_ctx();
if ( G.LP_pendingswaps != 0 ) if ( G.LP_pendingswaps != 0 )
@ -348,6 +348,9 @@ int32_t LP_passphrase_init(char *passphrase,char *gui)
safecopy(G.gui,gui,sizeof(G.gui)); safecopy(G.gui,gui,sizeof(G.gui));
G.USERPASS_COUNTER = counter; G.USERPASS_COUNTER = counter;
G.initializing = 0; G.initializing = 0;
bitcoin_address(coinaddr,0,60,G.LP_myrmd160,20);
memset(zero.bytes,0,sizeof(zero));
LP_instantdex_depositadd(coinaddr,zero);
return(0); return(0);
} }

Loading…
Cancel
Save