From 1156ef7e64b9a04708757f1a7542135076d85196 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sun, 16 Apr 2017 20:57:56 +0300 Subject: [PATCH] Test --- basilisk/basilisk_swap.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/basilisk/basilisk_swap.c b/basilisk/basilisk_swap.c index a9e4fbc24..d11f12786 100755 --- a/basilisk/basilisk_swap.c +++ b/basilisk/basilisk_swap.c @@ -3097,7 +3097,7 @@ char *basilisk_swap_Aspend(char *name,struct supernet_info *myinfo,char *symbol, return(signedtx); } -bits256 basilisk_swap_privbob_extract(struct supernet_info *myinfo,char *symbol,bits256 spendtxid,int32_t vini) +bits256 basilisk_swap_privbob_extract(struct supernet_info *myinfo,char *symbol,bits256 spendtxid,int32_t vini,int32_t revflag) { bits256 privkey; int32_t i,scriptlen,siglen; uint8_t script[1024]; // from Bob refund of Bob deposit memset(&privkey,0,sizeof(privkey)); @@ -3105,7 +3105,11 @@ bits256 basilisk_swap_privbob_extract(struct supernet_info *myinfo,char *symbol, { siglen = script[0]; for (i=0; i<32; i++) - privkey.bytes[31 - i] = script[siglen+2+i]; + { + if ( revflag != 0 ) + privkey.bytes[31 - i] = script[siglen+2+i]; + else privkey.bytes[i] = script[siglen+2+i]; + } char str[65]; printf("extracted privbob.(%s)\n",bits256_str(str,privkey)); } return(privkey); @@ -3119,7 +3123,7 @@ bits256 basilisk_swap_privBn_extract(struct supernet_info *myinfo,bits256 *bobre if ( bits256_nonz(bobdeposit) != 0 ) *bobrefundp = basilisk_swap_spendtxid(myinfo,bobcoin,destaddr,bobdeposit,0); if ( bits256_nonz(*bobrefundp) != 0 ) - privBn = basilisk_swap_privbob_extract(myinfo,bobcoin,*bobrefundp,0); + privBn = basilisk_swap_privbob_extract(myinfo,bobcoin,*bobrefundp,0,0); } return(privBn); } @@ -3458,7 +3462,7 @@ cJSON *basilisk_remember(struct supernet_info *myinfo,int64_t *KMDtotals,int64_t if ( txbytes[BASILISK_ALICERECLAIM] != 0 ) { txids[BASILISK_ALICERECLAIM] = basilisk_swap_sendrawtransaction(myinfo,"alicereclaim",alicecoin,txbytes[BASILISK_ALICERECLAIM]); - if ( bits256_nonz(txids[BASILISK_ALICERECLAIM]) != 0 ) // txcreate tested + if ( bits256_nonz(txids[BASILISK_ALICERECLAIM]) != 0 ) // tested { sentflags[BASILISK_ALICERECLAIM] = 1; Apaymentspent = txids[BASILISK_ALICERECLAIM]; @@ -3476,7 +3480,7 @@ cJSON *basilisk_remember(struct supernet_info *myinfo,int64_t *KMDtotals,int64_t { if ( bits256_nonz(privAm) == 0 ) { - privAm = basilisk_swap_privbob_extract(myinfo,bobcoin,txids[BASILISK_ALICESPEND],0); + privAm = basilisk_swap_privbob_extract(myinfo,bobcoin,txids[BASILISK_ALICESPEND],0,1); } if ( bits256_nonz(privAm) != 0 && bits256_nonz(privBn) != 0 ) {