|
|
@ -1948,12 +1948,14 @@ void basilisk_sendmostprivs(struct supernet_info *myinfo,struct basilisk_swap *s |
|
|
|
int32_t basilisk_swapiteration(struct supernet_info *myinfo,struct basilisk_swap *swap,uint8_t *data,int32_t maxlen) |
|
|
|
{ |
|
|
|
int32_t j,datalen,retval = 0; |
|
|
|
if ( swap->I.iambob != 0 ) |
|
|
|
swap->I.statebits |= 0x80; |
|
|
|
while ( ((swap->I.otherstatebits & 0x80) == 0 || (swap->I.statebits & 0x80) == 0) && retval == 0 && time(NULL) < swap->I.expiration ) |
|
|
|
{ |
|
|
|
if ( swap->connected == 0 ) |
|
|
|
basilisk_psockinit(myinfo,swap,swap->I.iambob != 0); |
|
|
|
printf("D r%u/q%u swapstate.%x otherstate.%x\n",swap->I.req.requestid,swap->I.req.quoteid,swap->I.statebits,swap->I.otherstatebits); |
|
|
|
if ( (swap->I.statebits & 0x80) == 0 ) // wait for fee
|
|
|
|
printf("D r%u/q%u swapstate.%x otherstate.%x remaining %d\n",swap->I.req.requestid,swap->I.req.quoteid,swap->I.statebits,swap->I.otherstatebits,(int32_t)(swap->I.expiration-time(NULL))); |
|
|
|
if ( swap->I.iambob != 0 && (swap->I.statebits & 0x80) == 0 ) // wait for fee
|
|
|
|
{ |
|
|
|
if ( basilisk_swapget(myinfo,swap,0x80,data,maxlen,basilisk_verify_otherfee) == 0 ) |
|
|
|
{ |
|
|
@ -2384,7 +2386,6 @@ void basilisk_swaploop(void *_swap) |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
printf("generate fee\n"); |
|
|
|
if ( basilisk_rawtx_gen("myfee",myinfo,swap->I.started,swap->persistent_pubkey33,swap->I.iambob,1,&swap->myfee,0,swap->myfee.spendscript,swap->myfee.I.spendlen,swap->myfee.coin->chain->txfee,1,0) == 0 ) |
|
|
|
{ |
|
|
@ -2406,6 +2407,7 @@ void basilisk_swaploop(void *_swap) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if ( (swap->I.statebits & 0x40) == 0 ) |
|
|
|
{ |
|
|
|
printf("couldnt send fee\n"); |
|
|
@ -2418,7 +2420,7 @@ void basilisk_swaploop(void *_swap) |
|
|
|
printf("ALICE's error %d %d %d\n",swap->myfee.I.datalen,swap->alicepayment.I.datalen,swap->alicepayment.I.datalen); |
|
|
|
retval = -7; |
|
|
|
} |
|
|
|
else if ( swap->I.iambob != 0 && (swap->myfee.I.datalen == 0 || swap->bobdeposit.I.datalen == 0) ) //swap->bobpayment.I.datalen == 0
|
|
|
|
else if ( swap->I.iambob != 0 && swap->bobdeposit.I.datalen == 0 ) //swap->bobpayment.I.datalen == 0
|
|
|
|
{ |
|
|
|
printf("BOB's error %d %d %d\n",swap->myfee.I.datalen,swap->bobpayment.I.datalen,swap->bobdeposit.I.datalen); |
|
|
|
retval = -7; |
|
|
|