jl777 8 years ago
parent
commit
294f16c9e3
  1. 2
      iguana/exchanges/LP_include.h
  2. 2
      iguana/exchanges/LP_ordermatch.c
  3. 2
      iguana/exchanges/LP_portfolio.c
  4. 4
      iguana/exchanges/LP_signatures.c
  5. 8
      iguana/exchanges/LP_socket.c
  6. 10
      iguana/exchanges/LP_utxo.c
  7. 2
      iguana/exchanges/LP_utxos.c

2
iguana/exchanges/LP_include.h

@ -335,7 +335,7 @@ int32_t LP_mempoolscan(char *symbol,bits256 searchtxid);
int32_t LP_txheight(struct iguana_info *coin,bits256 txid); int32_t LP_txheight(struct iguana_info *coin,bits256 txid);
int32_t LP_numpeers(); int32_t LP_numpeers();
uint64_t LP_KMDvalue(struct iguana_info *coin,uint64_t balance); uint64_t LP_KMDvalue(struct iguana_info *coin,uint64_t balance);
int32_t LP_address_utxoadd(struct iguana_info *coin,char *coinaddr,bits256 txid,int32_t vout,uint64_t value,int32_t height,int32_t spendheight); int32_t LP_address_utxoadd(char *debug,struct iguana_info *coin,char *coinaddr,bits256 txid,int32_t vout,uint64_t value,int32_t height,int32_t spendheight);
void LP_smartutxos_push(struct iguana_info *coin); void LP_smartutxos_push(struct iguana_info *coin);
cJSON *LP_address_utxos(struct iguana_info *coin,char *coinaddr,int32_t electrumret); cJSON *LP_address_utxos(struct iguana_info *coin,char *coinaddr,int32_t electrumret);
cJSON *LP_gettxout(char *symbol,char *coinaddr,bits256 txid,int32_t vout); cJSON *LP_gettxout(char *symbol,char *coinaddr,bits256 txid,int32_t vout);

2
iguana/exchanges/LP_ordermatch.c

@ -576,7 +576,7 @@ int32_t LP_listunspent_both(char *symbol,char *coinaddr,int32_t fullflag)
value = LP_value_extract(item,0); value = LP_value_extract(item,0);
height = LP_txheight(coin,txid); height = LP_txheight(coin,txid);
//char str[65]; printf("LP_listunspent_both: %s/v%d ht.%d %.8f\n",bits256_str(str,txid),v,height,dstr(value)); //char str[65]; printf("LP_listunspent_both: %s/v%d ht.%d %.8f\n",bits256_str(str,txid),v,height,dstr(value));
LP_address_utxoadd(coin,coinaddr,txid,v,value,height,-1); LP_address_utxoadd("LP_listunspent_both",coin,coinaddr,txid,v,value,height,-1);
} }
} }
} }

2
iguana/exchanges/LP_portfolio.c

@ -93,7 +93,7 @@ char *LP_portfolio()
continue; continue;
if ( iter == 0 ) if ( iter == 0 )
{ {
printf("from portfolio\n"); //printf("from portfolio\n");
LP_privkey_init(-1,coin,G.LP_privkey,G.LP_mypub25519); LP_privkey_init(-1,coin,G.LP_privkey,G.LP_mypub25519);
coin->balanceA = LP_balance(&coin->valuesumA,0,coin->symbol,coin->smartaddr); coin->balanceA = LP_balance(&coin->valuesumA,0,coin->symbol,coin->smartaddr);
coin->balanceB = LP_balance(&coin->valuesumB,1,coin->symbol,coin->smartaddr); coin->balanceB = LP_balance(&coin->valuesumB,1,coin->symbol,coin->smartaddr);

4
iguana/exchanges/LP_signatures.c

@ -591,8 +591,8 @@ char *LP_uitem_recv(cJSON *argjson)
coinaddr = jstr(argjson,"coinaddr"); coinaddr = jstr(argjson,"coinaddr");
if ( (symbol= jstr(argjson,"coin")) != 0 && coinaddr != 0 ) if ( (symbol= jstr(argjson,"coin")) != 0 && coinaddr != 0 )
{ {
//char str[65]; printf("uitem %s %s %s/v%d %.8f ht.%d\n",coin,coinaddr,bits256_str(str,txid),vout,dstr(value),height); char str[65]; printf("uitem %s %s %s/v%d %.8f ht.%d\n",symbol,coinaddr,bits256_str(str,txid),vout,dstr(value),height);
LP_address_utxoadd(LP_coinfind(symbol),coinaddr,txid,vout,value,height,-1); LP_address_utxoadd("LP_uitem,recv",LP_coinfind(symbol),coinaddr,txid,vout,value,height,-1);
} }
return(clonestr("{\"result\":\"success\"}")); return(clonestr("{\"result\":\"success\"}"));
} }

8
iguana/exchanges/LP_socket.c

@ -315,7 +315,7 @@ int32_t electrum_process_array(struct iguana_info *coin,struct electrum_info *ep
else else
{ {
//printf("external unspent has no gettxout\n"); //printf("external unspent has no gettxout\n");
flag += LP_address_utxoadd(coin,coinaddr,txid,v,value,0,1); flag += LP_address_utxoadd("electrum process",coin,coinaddr,txid,v,value,0,1);
} }
} }
else else
@ -349,10 +349,10 @@ int32_t electrum_process_array(struct iguana_info *coin,struct electrum_info *ep
tx->outpoints[v].value = value; tx->outpoints[v].value = value;
} }
} }
if ( value != 0 || tx->height > 0 ) if ( tx->height > 0 )
{ {
//printf("from electrum_process_array\n"); //printf("from electrum_process_array\n");
flag += LP_address_utxoadd(coin,coinaddr,txid,v,value,tx->height,-1); flag += LP_address_utxoadd("electrum process2",coin,coinaddr,txid,v,value,tx->height,-1);
} }
//printf("v.%d numvouts.%d %.8f (%s)\n",v,tx->numvouts,dstr(tx->outpoints[jint(item,"tx_pos")].value),jprint(item,0)); //printf("v.%d numvouts.%d %.8f (%s)\n",v,tx->numvouts,dstr(tx->outpoints[jint(item,"tx_pos")].value),jprint(item,0));
} //else printf("cant find tx\n"); } //else printf("cant find tx\n");
@ -486,7 +486,7 @@ cJSON *electrum_address_gethistory(char *symbol,struct electrum_info *ep,cJSON *
printf("update %s height.%d <- %d\n",bits256_str(str,txid),tx->height,height); printf("update %s height.%d <- %d\n",bits256_str(str,txid),tx->height,height);
tx->height = height; tx->height = height;
//printf("from history\n"); //printf("from history\n");
LP_address_utxoadd(coin,addr,txid,0,0,height,-1); LP_address_utxoadd("electrum history",coin,addr,txid,0,0,height,-1);
} }
} }
} }

10
iguana/exchanges/LP_utxo.c

@ -178,7 +178,7 @@ struct LP_address_utxo *LP_address_utxofind(struct iguana_info *coin,char *coina
return(0); return(0);
} }
int32_t LP_address_utxoadd(struct iguana_info *coin,char *coinaddr,bits256 txid,int32_t vout,uint64_t value,int32_t height,int32_t spendheight) int32_t LP_address_utxoadd(char *debug,struct iguana_info *coin,char *coinaddr,bits256 txid,int32_t vout,uint64_t value,int32_t height,int32_t spendheight)
{ {
struct LP_address *ap; cJSON *txobj; struct LP_address_utxo *up,*tmp; int32_t flag,retval = 0; char str[65]; struct LP_address *ap; cJSON *txobj; struct LP_address_utxo *up,*tmp; int32_t flag,retval = 0; char str[65];
if ( coin == 0 ) if ( coin == 0 )
@ -226,7 +226,7 @@ int32_t LP_address_utxoadd(struct iguana_info *coin,char *coinaddr,bits256 txid,
portable_mutex_unlock(&coin->addrmutex); portable_mutex_unlock(&coin->addrmutex);
retval = 1; retval = 1;
if ( value == 0 ) if ( value == 0 )
printf("null? ADD UTXO >> %s %s %s/v%d ht.%d %.8f\n",coin->symbol,coinaddr,bits256_str(str,txid),vout,height,dstr(value)); printf("%s null? ADD UTXO >> %s %s %s/v%d ht.%d %.8f\n",debug,coin->symbol,coinaddr,bits256_str(str,txid),vout,height,dstr(value));
} }
} // else printf("cant get ap %s %s\n",coin->symbol,coinaddr); } // else printf("cant get ap %s %s\n",coin->symbol,coinaddr);
//printf("done %s add addr.%s ht.%d\n",coin->symbol,coinaddr,height); //printf("done %s add addr.%s ht.%d\n",coin->symbol,coinaddr,height);
@ -446,7 +446,7 @@ int32_t LP_unspents_array(struct iguana_info *coin,char *coinaddr,cJSON *array)
if ( errs == 0 ) if ( errs == 0 )
{ {
//printf("from LP_unspents_array\n"); //printf("from LP_unspents_array\n");
LP_address_utxoadd(coin,coinaddr,txid,v,val,height,-1); LP_address_utxoadd("LP_unspents_array",coin,coinaddr,txid,v,val,height,-1);
count++; count++;
} }
} }
@ -570,7 +570,7 @@ cJSON *LP_transactioninit(struct iguana_info *coin,bits256 txid,int32_t iter,cJS
tx->outpoints[i].interest = SATOSHIDEN * jdouble(vout,"interest"); tx->outpoints[i].interest = SATOSHIDEN * jdouble(vout,"interest");
LP_destaddr(tx->outpoints[i].coinaddr,vout); LP_destaddr(tx->outpoints[i].coinaddr,vout);
printf("from transaction init %s %s %s/v%d <- %.8f\n",coin->symbol,tx->outpoints[i].coinaddr,bits256_str(str,txid),i,dstr(tx->outpoints[i].value)); printf("from transaction init %s %s %s/v%d <- %.8f\n",coin->symbol,tx->outpoints[i].coinaddr,bits256_str(str,txid),i,dstr(tx->outpoints[i].value));
//LP_address_utxoadd(coin,tx->outpoints[i].coinaddr,txid,i,tx->outpoints[i].value,height,-1); LP_address_utxoadd("LP_transactioninit iter0",coin,tx->outpoints[i].coinaddr,txid,i,tx->outpoints[i].value,height,-1);
} }
//printf("numvouts.%d\n",numvouts); //printf("numvouts.%d\n",numvouts);
} }
@ -592,7 +592,7 @@ cJSON *LP_transactioninit(struct iguana_info *coin,bits256 txid,int32_t iter,cJS
tx->outpoints[spentvout].spendtxid = txid; tx->outpoints[spentvout].spendtxid = txid;
tx->outpoints[spentvout].spendvini = i; tx->outpoints[spentvout].spendvini = i;
tx->outpoints[spentvout].spendheight = height > 0 ? height : 1; tx->outpoints[spentvout].spendheight = height > 0 ? height : 1;
LP_address_utxoadd(coin,tx->outpoints[spentvout].coinaddr,spenttxid,spentvout,tx->outpoints[spentvout].value,-1,height>0?height:1); LP_address_utxoadd("LP_transactioninit iter1",coin,tx->outpoints[spentvout].coinaddr,spenttxid,spentvout,tx->outpoints[spentvout].value,-1,height>0?height:1);
if ( 0 && strcmp(coin->symbol,"REVS") == 0 ) if ( 0 && strcmp(coin->symbol,"REVS") == 0 )
printf("spend %s %s/v%d at ht.%d\n",coin->symbol,bits256_str(str,tx->txid),spentvout,height); printf("spend %s %s/v%d at ht.%d\n",coin->symbol,bits256_str(str,tx->txid),spentvout,height);
} }

2
iguana/exchanges/LP_utxos.c

@ -753,7 +753,7 @@ void LP_privkey_updates(void *ctx,int32_t pubsock,char *passphrase)
//printf("i.%d of %d\n",i,LP_numcoins); //printf("i.%d of %d\n",i,LP_numcoins);
else if ( IAMLP == 0 || coin->inactive == 0 ) else if ( IAMLP == 0 || coin->inactive == 0 )
{ {
printf("from updates\n"); printf("from updates %s\n",coin->symbol);
if ( LP_privkey_init(pubsock,coin,G.LP_privkey,G.LP_mypub25519) == 0 && (rand() % 10) == 0 ) if ( LP_privkey_init(pubsock,coin,G.LP_privkey,G.LP_mypub25519) == 0 && (rand() % 10) == 0 )
LP_postutxos(coin->symbol,coin->smartaddr); LP_postutxos(coin->symbol,coin->smartaddr);
} }

Loading…
Cancel
Save