From e519959088d22e49d7cac43e0858a8e840bf2a5e Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 28 Sep 2016 16:16:00 -0300 Subject: [PATCH] test --- basilisk/basilisk.h | 2 +- basilisk/basilisk_swap.c | 21 +++++++++++++++------ 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/basilisk/basilisk.h b/basilisk/basilisk.h index 04291042a..ecb3e10b3 100755 --- a/basilisk/basilisk.h +++ b/basilisk/basilisk.h @@ -34,7 +34,7 @@ #define BASILISK_HDROFFSET ((int32_t)(sizeof(bits256)+sizeof(struct iguana_msghdr)+sizeof(uint32_t))) #define INSTANTDEX_DECKSIZE 1000 -#define INSTANTDEX_LOCKTIME (3600*2 + 300*2) +#define INSTANTDEX_LOCKTIME 300 //(3600*2 + 300*2) #define INSTANTDEX_INSURANCEDIV 777 #define INSTANTDEX_PUBKEY "03bc2c7ba671bae4a6fc835244c9762b41647b9827d4780a89a949b984a8ddcc06" #define INSTANTDEX_RMD160 "ca1e04745e8ca0c60d8c5881531d51bec470743f" diff --git a/basilisk/basilisk_swap.c b/basilisk/basilisk_swap.c index b5f383b6c..e5f6ea925 100755 --- a/basilisk/basilisk_swap.c +++ b/basilisk/basilisk_swap.c @@ -147,9 +147,9 @@ int32_t basilisk_bobscript(uint8_t *rmd160,uint8_t *redeemscript,int32_t *redeem secret160 = swap->secretAm; secret256 = swap->secretAm256; } - for (i=0; i<32; i++) - printf("%02x",secret256[i]); - printf(" <- secret256 depositflag.%d\n",depositflag); + //for (i=0; i<32; i++) + // printf("%02x",secret256[i]); + //printf(" <- secret256 depositflag.%d\n",depositflag); if ( bits256_nonz(cltvpub) == 0 || bits256_nonz(destpub) == 0 ) return(-1); for (i=0; i<20; i++) @@ -475,12 +475,15 @@ int32_t basilisk_swapuserdata(struct basilisk_swap *swap,uint8_t *userdata,bits2 int32_t basilisk_verify_bobdeposit(struct supernet_info *myinfo,void *ptr,uint8_t *data,int32_t datalen) { - uint8_t userdata[512]; int32_t retval,len = 0; static bits256 zero; struct basilisk_swap *swap = ptr; + uint8_t userdata[512]; int32_t i,retval,len = 0; static bits256 zero; struct basilisk_swap *swap = ptr; if ( basilisk_rawtx_spendscript(myinfo,swap,swap->bobcoin->blocks.hwmchain.height,&swap->bobdeposit,0,data,datalen,0) == 0 ) { len = basilisk_swapuserdata(swap,userdata,zero,1,swap->myprivs[0],swap->bobdeposit.redeemscript,swap->bobdeposit.redeemlen); if ( (retval= basilisk_rawtx_sign(myinfo,swap->bobcoin->blocks.hwmchain.height,swap,&swap->aliceclaim,&swap->bobdeposit,swap->myprivs[0],0,userdata,len,1)) == 0 ) { + for (i=0; ialiceclaim.datalen; i++) + printf("%02x",swap->aliceclaim.txbytes[i]); + printf(" <- aliceclaim\n"); basilisk_txlog(myinfo,swap,&swap->aliceclaim,INSTANTDEX_LOCKTIME*2); return(retval); } @@ -513,11 +516,14 @@ int32_t basilisk_bobdeposit_refund(struct supernet_info *myinfo,struct basilisk_ int32_t basilisk_bobpayment_reclaim(struct supernet_info *myinfo,struct basilisk_swap *swap,int32_t delay) { - uint8_t userdata[512]; int32_t retval,len = 0; static bits256 zero; + uint8_t userdata[512]; int32_t i,retval,len = 0; static bits256 zero; printf("basilisk_bobpayment_reclaim\n"); len = basilisk_swapuserdata(swap,userdata,zero,1,swap->myprivs[1],swap->bobpayment.redeemscript,swap->bobpayment.redeemlen); if ( (retval= basilisk_rawtx_sign(myinfo,swap->bobcoin->blocks.hwmchain.height,swap,&swap->bobreclaim,&swap->bobpayment,swap->myprivs[1],0,userdata,len,1)) == 0 ) { + for (i=0; ibobreclaim.datalen; i++) + printf("%02x",swap->bobreclaim.txbytes[i]); + printf(" <- bobreclaim\n"); basilisk_txlog(myinfo,swap,&swap->bobreclaim,delay); return(retval); } @@ -547,11 +553,14 @@ int32_t basilisk_verify_bobpaid(struct supernet_info *myinfo,void *ptr,uint8_t * int32_t basilisk_alicepayment_spend(struct supernet_info *myinfo,struct basilisk_swap *swap,struct basilisk_rawtx *dest) { - int32_t retval; + int32_t i,retval; //printf("alicepayment_spend\n"); swap->alicepayment.spendlen = basilisk_alicescript(swap->alicepayment.redeemscript,&swap->alicepayment.redeemlen,swap->alicepayment.spendscript,0,swap->alicepayment.destaddr,swap->alicecoin->chain->p2shtype,swap->pubAm,swap->pubBn); if ( (retval= basilisk_rawtx_sign(myinfo,swap->alicecoin->blocks.hwmchain.height,swap,dest,&swap->alicepayment,swap->privAm,&swap->privBn,0,0,1)) == 0 ) { + for (i=0; idatalen; i++) + printf("%02x",dest->txbytes[i]); + printf(" <- msigspend\n\n"); basilisk_txlog(myinfo,swap,dest,0); // bobspend or alicereclaim return(retval); }