Browse Source

Test

etomic
jl777 7 years ago
parent
commit
5d9a8148e3
  1. 7
      iguana/exchanges/LP_ordermatch.c
  2. 12
      iguana/exchanges/LP_transaction.c

7
iguana/exchanges/LP_ordermatch.c

@ -844,7 +844,7 @@ int32_t LP_tradecommand(void *ctx,char *myipaddr,int32_t pubsock,cJSON *argjson,
if ( bits256_nonz(Q.txid2) != 0 ) if ( bits256_nonz(Q.txid2) != 0 )
LP_utxos_remove(Q.txid2,Q.vout2); LP_utxos_remove(Q.txid2,Q.vout2);
else recalc = 1; else recalc = 1;
printf("price %.8f qprice %.8f\n",price,qprice); //printf("price %.8f qprice %.8f\n",price,qprice);
if ( recalc == 0 ) if ( recalc == 0 )
{ {
value = LP_txvalue(tmp,Q.srccoin,Q.txid,Q.vout); value = LP_txvalue(tmp,Q.srccoin,Q.txid,Q.vout);
@ -941,14 +941,15 @@ int32_t LP_tradecommand(void *ctx,char *myipaddr,int32_t pubsock,cJSON *argjson,
jaddstr(retjson,"method","reserved"); jaddstr(retjson,"method","reserved");
msg = jprint(retjson,0); msg = jprint(retjson,0);
butxo->T.lasttime = (uint32_t)time(NULL); butxo->T.lasttime = (uint32_t)time(NULL);
printf("return after queued RESERVED: set swappending.%u accept qprice %.8f, min %.8f\n(%s)\n",butxo->T.swappending,qprice,ask,msg); //printf("return after queued RESERVED: set swappending.%u accept qprice %.8f, min %.8f\n(%s)\n",butxo->T.swappending,qprice,ask,msg);
// LP_addsig // LP_addsig
//msg2 = clonestr(msg); //msg2 = clonestr(msg);
LP_reserved_msg(1,Q.srccoin,Q.destcoin,butxo->S.otherpubkey,clonestr(msg)); LP_reserved_msg(1,Q.srccoin,Q.destcoin,butxo->S.otherpubkey,clonestr(msg));
sleep(1); sleep(1);
bits256 zero; bits256 zero;
memset(zero.bytes,0,sizeof(zero)); memset(zero.bytes,0,sizeof(zero));
LP_reserved_msg(1,Q.srccoin,Q.destcoin,zero,msg); //LP_reserved_msg(1,Q.srccoin,Q.destcoin,zero,msg);
LP_reserved_msg(0,Q.srccoin,Q.destcoin,zero,msg);
//LP_broadcast_message(LP_mypubsock,Q.srccoin,Q.destcoin,Q.desthash,jprint(retjson,0)); //LP_broadcast_message(LP_mypubsock,Q.srccoin,Q.destcoin,Q.desthash,jprint(retjson,0));
free_json(retjson); free_json(retjson);
return(retval); return(retval);

12
iguana/exchanges/LP_transaction.c

@ -907,12 +907,12 @@ int32_t LP_vins_select(void *ctx,struct iguana_info *coin,int64_t *totalp,int64_
if ( bits256_nonz(utxotxid) != 0 && numpre == 0 ) if ( bits256_nonz(utxotxid) != 0 && numpre == 0 )
{ {
up = LP_address_utxofind(coin,coin->smartaddr,utxotxid,utxovout); up = LP_address_utxofind(coin,coin->smartaddr,utxotxid,utxovout);
printf("have utxotxid but wasnt found up.%p\n",up); //printf("have utxotxid but wasnt found up.%p\n",up);
if ( up == 0 ) if ( up == 0 )
{ {
value = LP_txvalue(0,coin->symbol,utxotxid,utxovout); value = LP_txvalue(0,coin->symbol,utxotxid,utxovout);
LP_address_utxoadd("withdraw",coin,coin->smartaddr,utxotxid,utxovout,value,1,-1); LP_address_utxoadd("withdraw",coin,coin->smartaddr,utxotxid,utxovout,value,1,-1);
printf("added after not finding\n"); //printf("added after not finding\n");
} }
if ( (up= LP_address_utxofind(coin,coin->smartaddr,utxotxid,utxovout)) != 0 ) if ( (up= LP_address_utxofind(coin,coin->smartaddr,utxotxid,utxovout)) != 0 )
preselected[numpre++] = up; preselected[numpre++] = up;
@ -978,7 +978,7 @@ int32_t LP_vins_select(void *ctx,struct iguana_info *coin,int64_t *totalp,int64_
char str[65]; printf("%s/%d %.8f interest %.8f -> sum %.8f\n",bits256_str(str,up->U.txid),up->U.vout,dstr(up->U.value),dstr(interest),dstr(interestsum)); char str[65]; printf("%s/%d %.8f interest %.8f -> sum %.8f\n",bits256_str(str,up->U.txid),up->U.vout,dstr(up->U.value),dstr(interest),dstr(interestsum));
} }
} }
printf("numunspents.%d vini.%d value %.8f, total %.8f remains %.8f interest %.8f sum %.8f %s/v%d\n",numunspents,n,dstr(up->U.value),dstr(total),dstr(remains),dstr(interest),dstr(interestsum),bits256_str(str,up->U.txid),up->U.vout); //printf("numunspents.%d vini.%d value %.8f, total %.8f remains %.8f interest %.8f sum %.8f %s/v%d\n",numunspents,n,dstr(up->U.value),dstr(total),dstr(remains),dstr(interest),dstr(interestsum),bits256_str(str,up->U.txid),up->U.vout);
vp = &V[n++]; vp = &V[n++];
vp->N = vp->M = 1; vp->N = vp->M = 1;
vp->signers[0].privkey = privkey; vp->signers[0].privkey = privkey;
@ -1088,9 +1088,9 @@ char *LP_createrawtransaction(cJSON **txobjp,int32_t *numvinsp,struct iguana_inf
return(0); return(0);
} }
} }
char str[65]; //char str[65];
for (i=0; i<numutxos; i++) //for (i=0; i<numutxos; i++)
printf("utxo.%d %s/v%d %.8f\n",i,bits256_str(str,utxos[i]->U.txid),utxos[i]->U.vout,dstr(utxos[i]->U.value)); // printf("utxo.%d %s/v%d %.8f\n",i,bits256_str(str,utxos[i]->U.txid),utxos[i]->U.vout,dstr(utxos[i]->U.value));
ignore_cltverr = 0; ignore_cltverr = 0;
suppress_pubkeys = 1; suppress_pubkeys = 1;

Loading…
Cancel
Save