Browse Source

Test

etomic
jl777 8 years ago
parent
commit
1156ef7e64
  1. 12
      basilisk/basilisk_swap.c

12
basilisk/basilisk_swap.c

@ -3097,7 +3097,7 @@ char *basilisk_swap_Aspend(char *name,struct supernet_info *myinfo,char *symbol,
return(signedtx); 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 bits256 privkey; int32_t i,scriptlen,siglen; uint8_t script[1024]; // from Bob refund of Bob deposit
memset(&privkey,0,sizeof(privkey)); memset(&privkey,0,sizeof(privkey));
@ -3105,7 +3105,11 @@ bits256 basilisk_swap_privbob_extract(struct supernet_info *myinfo,char *symbol,
{ {
siglen = script[0]; siglen = script[0];
for (i=0; i<32; i++) for (i=0; i<32; i++)
{
if ( revflag != 0 )
privkey.bytes[31 - i] = script[siglen+2+i]; 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)); char str[65]; printf("extracted privbob.(%s)\n",bits256_str(str,privkey));
} }
return(privkey); return(privkey);
@ -3119,7 +3123,7 @@ bits256 basilisk_swap_privBn_extract(struct supernet_info *myinfo,bits256 *bobre
if ( bits256_nonz(bobdeposit) != 0 ) if ( bits256_nonz(bobdeposit) != 0 )
*bobrefundp = basilisk_swap_spendtxid(myinfo,bobcoin,destaddr,bobdeposit,0); *bobrefundp = basilisk_swap_spendtxid(myinfo,bobcoin,destaddr,bobdeposit,0);
if ( bits256_nonz(*bobrefundp) != 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); return(privBn);
} }
@ -3458,7 +3462,7 @@ cJSON *basilisk_remember(struct supernet_info *myinfo,int64_t *KMDtotals,int64_t
if ( txbytes[BASILISK_ALICERECLAIM] != 0 ) if ( txbytes[BASILISK_ALICERECLAIM] != 0 )
{ {
txids[BASILISK_ALICERECLAIM] = basilisk_swap_sendrawtransaction(myinfo,"alicereclaim",alicecoin,txbytes[BASILISK_ALICERECLAIM]); 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; sentflags[BASILISK_ALICERECLAIM] = 1;
Apaymentspent = txids[BASILISK_ALICERECLAIM]; 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 ) 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 ) if ( bits256_nonz(privAm) != 0 && bits256_nonz(privBn) != 0 )
{ {

Loading…
Cancel
Save