jl777 8 years ago
parent
commit
96e1b5c0ec
  1. 2
      basilisk/basilisk_bitcoin.c
  2. 10
      basilisk/basilisk_swap.c

2
basilisk/basilisk_bitcoin.c

@ -566,7 +566,7 @@ char *basilisk_bitcoinrawtx(struct supernet_info *myinfo,struct iguana_info *coi
jadd(valsobj,"addresses",addresses); jadd(valsobj,"addresses",addresses);
} }
//printf("use addresses.(%s)\n",jprint(addresses,0)); //printf("use addresses.(%s)\n",jprint(addresses,0));
printf("(%s) vals.(%s) change.(%s) spend.%s\n",coin->symbol,jprint(valsobj,0),changeaddr,spendscriptstr); //printf("(%s) vals.(%s) change.(%s) spend.%s\n",coin->symbol,jprint(valsobj,0),changeaddr,spendscriptstr);
if ( changeaddr == 0 || changeaddr[0] == 0 || spendscriptstr == 0 || spendscriptstr[0] == 0 ) if ( changeaddr == 0 || changeaddr[0] == 0 || spendscriptstr == 0 || spendscriptstr[0] == 0 )
return(clonestr("{\"error\":\"invalid changeaddr or spendscript or addresses\"}")); return(clonestr("{\"error\":\"invalid changeaddr or spendscript or addresses\"}"));
if ( coin != 0 ) if ( coin != 0 )

10
basilisk/basilisk_swap.c

@ -316,7 +316,7 @@ int32_t basilisk_rawtx_sign(struct supernet_info *myinfo,int32_t height,struct b
V[0].userdatalen = userdatalen; V[0].userdatalen = userdatalen;
init_hexbytes_noT(hexstr,userdata,userdatalen); init_hexbytes_noT(hexstr,userdata,userdatalen);
jaddstr(item,"userdata",hexstr); jaddstr(item,"userdata",hexstr);
jaddnum(item,"sequence",0); //jaddnum(item,"sequence",0);
#ifdef DISABLE_CHECKSIG #ifdef DISABLE_CHECKSIG
needsig = 0; needsig = 0;
#endif #endif
@ -1630,10 +1630,11 @@ void basilisk_swaploop(void *_swap)
} }
while ( retval == 0 && time(NULL) < swap->expiration ) // both sides have setup required data and paid txfee while ( retval == 0 && time(NULL) < swap->expiration ) // both sides have setup required data and paid txfee
{ {
if ( (rand() % 30) == 0 )
printf("E r%u/q%u swapstate.%x otherstate.%x\n",swap->req.requestid,swap->req.quoteid,swap->statebits,swap->otherstatebits); printf("E r%u/q%u swapstate.%x otherstate.%x\n",swap->req.requestid,swap->req.quoteid,swap->statebits,swap->otherstatebits);
if ( swap->iambob != 0 ) if ( swap->iambob != 0 )
{ {
printf("BOB\n"); //printf("BOB\n");
if ( (swap->statebits & 0x100) == 0 ) if ( (swap->statebits & 0x100) == 0 )
{ {
printf("send bobdeposit\n"); printf("send bobdeposit\n");
@ -1714,7 +1715,7 @@ void basilisk_swaploop(void *_swap)
} }
else else
{ {
printf("ALICE\n"); //printf("ALICE\n");
// [BLOCKING: depfound] Alice waits for deposit to confirm and sends altpayment // [BLOCKING: depfound] Alice waits for deposit to confirm and sends altpayment
if ( (swap->statebits & 0x200) == 0 ) if ( (swap->statebits & 0x200) == 0 )
{ {
@ -1796,8 +1797,9 @@ void basilisk_swaploop(void *_swap)
break; break;
} }
} }
if ( (rand() % 30) == 0 )
printf("finished swapstate.%x other.%x\n",swap->statebits,swap->otherstatebits); printf("finished swapstate.%x other.%x\n",swap->statebits,swap->otherstatebits);
sleep(3 + (swap->iambob == 0)); sleep(1);//3 + (swap->iambob == 0));
basilisk_sendstate(myinfo,swap,data,maxlen); basilisk_sendstate(myinfo,swap,data,maxlen);
basilisk_swapget(myinfo,swap,0x80000000,data,maxlen,basilisk_verify_otherstatebits); basilisk_swapget(myinfo,swap,0x80000000,data,maxlen,basilisk_verify_otherstatebits);
} }

Loading…
Cancel
Save