Browse Source

Test

etomic
jl777 8 years ago
parent
commit
97cfbabb11
  1. 2
      iguana/exchanges/LP_commands.c
  2. 2
      iguana/exchanges/LP_rpc.c
  3. 2
      iguana/exchanges/LP_transaction.c
  4. 4
      iguana/exchanges/LP_utxos.c

2
iguana/exchanges/LP_commands.c

@ -80,7 +80,6 @@ int32_t LP_command(struct LP_peerinfo *mypeer,int32_t pubsock,cJSON *argjson,uin
price *= (1. + profitmargin);
if ( LP_quoteinfoinit(&Q,utxo,rel,price) < 0 )
return(-1);
//printf("GETTXOUT: txid.(%s)\ntxid2.(%s)\n",jprint(LP_gettxout(Q.srccoin,Q.txid,Q.vout),1),jprint(LP_gettxout(Q.srccoin,Q.txid2,Q.vout2),1));
if ( LP_iseligible(Q.srccoin,Q.txid,Q.vout,Q.satoshis,Q.txid2,Q.vout2) == 0 )
{
printf("not eligible\n");
@ -123,7 +122,6 @@ int32_t LP_command(struct LP_peerinfo *mypeer,int32_t pubsock,cJSON *argjson,uin
privkey = LP_privkey(utxo->coinaddr);
if ( bits256_nonz(utxo->mypub) == 0 )
utxo->mypub = LP_pubkey(privkey);
//printf("GETTXOUT: txid.(%s)\ntxid2.(%s)\n",jprint(LP_gettxout(Q.srccoin,Q.txid,Q.vout),1),jprint(LP_gettxout(Q.srccoin,Q.txid2,Q.vout2),1));
if ( LP_iseligible(Q.srccoin,Q.txid,Q.vout,Q.satoshis,Q.txid2,Q.vout2) == 0 )
{
printf("not eligible\n");

2
iguana/exchanges/LP_rpc.c

@ -71,7 +71,7 @@ cJSON *bitcoin_json(struct iguana_info *coin,char *method,char *params)
retjson = cJSON_Parse(retstr);
free(retstr);
}
usleep(1000);
//usleep(1000);
//printf("dpow_gettxout.(%s)\n",retstr);
}
return(retjson);

2
iguana/exchanges/LP_transaction.c

@ -120,7 +120,7 @@ uint64_t LP_txvalue(char *symbol,bits256 txid,int32_t vout)
value += SATOSHIDEN * interest;
}
}
// char str[65]; printf("%.8f <- %s.(%s) txobj.(%s)\n",dstr(value),symbol,bits256_str(str,txid),jprint(txobj,0));
char str[65]; printf("%.8f <- %s.(%s) txobj.(%s)\n",dstr(value),symbol,bits256_str(str,txid),jprint(txobj,0));
free_json(txobj);
}
return(value);

4
iguana/exchanges/LP_utxos.c

@ -131,7 +131,7 @@ char *LP_spentcheck(cJSON *argjson)
bits256 txid,checktxid; int32_t vout,checkvout; struct LP_utxoinfo *utxo;
txid = jbits256(argjson,"txid");
vout = jint(argjson,"vout");
if ( (utxo= LP_utxofind(txid,vout)) != 0 )
if ( (utxo= LP_utxofind(txid,vout)) != 0 && utxo->spentflag == 0 )
{
if ( jobj(argjson,"check") == 0 )
checktxid = txid, checkvout = vout;
@ -142,6 +142,8 @@ char *LP_spentcheck(cJSON *argjson)
}
if ( LP_txvalue(utxo->coin,checktxid,checkvout) == 0 )
{
if ( LP_mypeer != 0 && LP_mypeer->numutxos > 0 )
LP_mypeer->numutxos--;
utxo->spentflag = (uint32_t)time(NULL);
//printf("indeed txid was spent\n");
return(clonestr("{\"result\":\"marked as spent\"}"));

Loading…
Cancel
Save