From 1cf000ca5d87fb4540f2a88594cf17f83a6264ef Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 5 Jun 2017 21:43:44 +0300 Subject: [PATCH] Test --- iguana/exchanges/LP_swap.c | 25 ++++++++++++------------- iguana/exchanges/LP_transaction.c | 5 +++-- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/iguana/exchanges/LP_swap.c b/iguana/exchanges/LP_swap.c index 16552ddbe..68ed6450f 100644 --- a/iguana/exchanges/LP_swap.c +++ b/iguana/exchanges/LP_swap.c @@ -409,10 +409,10 @@ int32_t LP_waitfor(int32_t pairsock,struct basilisk_swap *swap,int32_t timeout,i void *data; int32_t datalen,retval = -1; uint32_t expiration = (uint32_t)time(NULL) + timeout; while ( time(NULL) < expiration ) { - printf("start wait\n"); + //printf("start wait\n"); if ( (datalen= nn_recv(pairsock,&data,NN_MSG,0)) >= 0 ) { - printf("wait for got.%d\n",datalen); + //printf("wait for got.%d\n",datalen); retval = (*verify)(swap,data,datalen); nn_freemsg(data); return(retval); @@ -425,18 +425,17 @@ int32_t LP_waitfor(int32_t pairsock,struct basilisk_swap *swap,int32_t timeout,i int32_t LP_waitsend(char *statename,int32_t timeout,int32_t pairsock,struct basilisk_swap *swap,uint8_t *data,int32_t maxlen,int32_t (*verify)(struct basilisk_swap *swap,uint8_t *data,int32_t datalen),int32_t (*datagen)(struct basilisk_swap *swap,uint8_t *data,int32_t maxlen)) { int32_t datalen,sendlen,retval = -1; - printf("waitsend.%s\n",statename); + //printf("waitsend.%s\n",statename); if ( LP_waitfor(pairsock,swap,timeout,verify) == 0 ) { - printf("waited for %s\n",statename); + //printf("waited for %s\n",statename); if ( (datalen= (*datagen)(swap,data,maxlen)) > 0 ) { if ( (sendlen= nn_send(pairsock,data,datalen,0)) == datalen ) { - printf("sent.%d after waitfor.%s\n",sendlen,statename); + //printf("sent.%d after waitfor.%s\n",sendlen,statename); retval = 0; - } - else printf("send %s error\n",statename); + } else printf("send %s error\n",statename); } else printf("%s datagen no data\n",statename); } else printf("didnt get valid data\n"); return(retval); @@ -445,16 +444,16 @@ int32_t LP_waitsend(char *statename,int32_t timeout,int32_t pairsock,struct basi int32_t LP_sendwait(char *statename,int32_t timeout,int32_t pairsock,struct basilisk_swap *swap,uint8_t *data,int32_t maxlen,int32_t (*verify)(struct basilisk_swap *swap,uint8_t *data,int32_t datalen),int32_t (*datagen)(struct basilisk_swap *swap,uint8_t *data,int32_t maxlen)) { int32_t datalen,sendlen,retval = -1; - printf("sendwait.%s\n",statename); + //printf("sendwait.%s\n",statename); if ( (datalen= (*datagen)(swap,data,maxlen)) > 0 ) { - printf("generated %d for %s\n",datalen,statename); + //printf("generated %d for %s\n",datalen,statename); if ( (sendlen= nn_send(pairsock,data,datalen,0)) == datalen ) { - printf("sendwait.%s sent %d\n",statename,sendlen); + //printf("sendwait.%s sent %d\n",statename,sendlen); if ( LP_waitfor(pairsock,swap,timeout,verify) == 0 ) { - printf("waited! sendwait.%s sent %d\n",statename,sendlen); + //printf("waited! sendwait.%s sent %d\n",statename,sendlen); retval = 0; } else printf("didnt get %s\n",statename); } else printf("send pubkeys error\n"); @@ -512,7 +511,7 @@ uint32_t LP_swapdata_rawtxsend(int32_t pairsock,struct basilisk_swap *swap,uint3 sendbuf[sendlen++] = rawtx->I.datalen & 0xff; sendbuf[sendlen++] = (rawtx->I.datalen >> 8) & 0xff; sendbuf[sendlen++] = rawtx->I.redeemlen; - int32_t z; for (z=0; zI.datalen; z++) printf("%02x",rawtx->txbytes[z]); printf(" >>>>>>> send.%d %s\n",rawtx->I.datalen,rawtx->name); + //int32_t z; for (z=0; zI.datalen; z++) printf("%02x",rawtx->txbytes[z]); printf(" >>>>>>> send.%d %s\n",rawtx->I.datalen,rawtx->name); //printf("datalen.%d redeemlen.%d\n",rawtx->I.datalen,rawtx->I.redeemlen); memcpy(&sendbuf[sendlen],rawtx->txbytes,rawtx->I.datalen), sendlen += rawtx->I.datalen; if ( rawtx->I.redeemlen > 0 && rawtx->I.redeemlen < 0x100 ) @@ -558,7 +557,7 @@ void LP_bobloop(void *_utxo) printf("error bobscripts deposit\n"); else { - printf("depositlen.%d\n",swap->bobdeposit.I.datalen); + //printf("depositlen.%d\n",swap->bobdeposit.I.datalen); LP_swapsfp_update(&swap->I.req); if ( LP_waitfor(utxo->pair,swap,10,LP_verify_otherfee) < 0 ) printf("error waiting for alicefee\n"); diff --git a/iguana/exchanges/LP_transaction.c b/iguana/exchanges/LP_transaction.c index d0458696e..8a4428def 100644 --- a/iguana/exchanges/LP_transaction.c +++ b/iguana/exchanges/LP_transaction.c @@ -721,6 +721,7 @@ int32_t basilisk_rawtx_gen(void *ctx,char *str,uint32_t swapstarted,uint8_t *pub int32_t basilisk_rawtx_sign(char *symbol,uint8_t pubtype,uint8_t p2shtype,uint8_t isPoS,uint8_t wiftype,struct basilisk_swap *swap,struct basilisk_rawtx *dest,struct basilisk_rawtx *rawtx,bits256 privkey,bits256 *privkey2,uint8_t *userdata,int32_t userdatalen,int32_t ignore_cltverr,uint8_t *changermd160,char *vinaddr) { char *signedtx,*changeaddr = 0,_changeaddr[64]; int64_t txfee,newtxfee=0,destamount; uint32_t timestamp,locktime=0,sequenceid = 0xffffffff; int32_t iter,retval = -1; double estimatedrate; + char str2[65]; printf("%s rawtxsign.(%s/v%d)\n",dest->name,bits256_str(str2,dest->utxotxid),dest->utxovout); timestamp = swap->I.started; if ( dest == &swap->aliceclaim ) locktime = swap->bobdeposit.I.locktime + 1, sequenceid = 0; @@ -1207,8 +1208,8 @@ int32_t basilisk_bobscripts_set(struct basilisk_swap *swap,int32_t depositflag,i LP_unspents_mark(swap->bobcoin.symbol,swap->bobpayment.vins); if ( swap->I.iambob != 0 ) { - swap->bobpayment.utxovout = 0; - swap->bobpayment.utxotxid = swap->bobpayment.I.signedtxid; + swap->bobreclaim.utxovout = 0; + swap->bobreclaim.utxotxid = swap->bobpayment.I.signedtxid; basilisk_bobpayment_reclaim(swap,swap->I.callduration); } //printf("bobscripts set completed\n");