|
@ -494,7 +494,7 @@ struct basilisk_rawtx *LP_swapdata_rawtx(struct basilisk_swap *swap,uint8_t *dat |
|
|
|
|
|
|
|
|
int32_t LP_rawtx_spendscript(struct basilisk_swap *swap,int32_t height,struct basilisk_rawtx *rawtx,int32_t v,uint8_t *recvbuf,int32_t recvlen,int32_t suppress_pubkeys) |
|
|
int32_t LP_rawtx_spendscript(struct basilisk_swap *swap,int32_t height,struct basilisk_rawtx *rawtx,int32_t v,uint8_t *recvbuf,int32_t recvlen,int32_t suppress_pubkeys) |
|
|
{ |
|
|
{ |
|
|
bits256 otherhash,myhash,txid; int32_t i,offset=0,datalen=0,retval=-1,hexlen,n; uint8_t *data; cJSON *txobj,*skey,*vouts,*vout; char *hexstr,redeemaddr[64]; uint32_t quoteid,msgbits; |
|
|
bits256 otherhash,myhash,txid; int32_t i,offset=0,datalen=0,retval=-1,hexlen,n; uint8_t *data; cJSON *txobj,*skey,*vouts,*vout; char *hexstr,redeemaddr[64],checkaddr[64]; uint32_t quoteid,msgbits; |
|
|
for (i=0; i<32; i++) |
|
|
for (i=0; i<32; i++) |
|
|
otherhash.bytes[i] = recvbuf[offset++]; |
|
|
otherhash.bytes[i] = recvbuf[offset++]; |
|
|
for (i=0; i<32; i++) |
|
|
for (i=0; i<32; i++) |
|
@ -517,6 +517,12 @@ int32_t LP_rawtx_spendscript(struct basilisk_swap *swap,int32_t height,struct ba |
|
|
printf("%02x",rawtx->redeemscript[i]); |
|
|
printf("%02x",rawtx->redeemscript[i]); |
|
|
bitcoin_address(redeemaddr,rawtx->coin->p2shtype,rawtx->redeemscript,rawtx->I.redeemlen); |
|
|
bitcoin_address(redeemaddr,rawtx->coin->p2shtype,rawtx->redeemscript,rawtx->I.redeemlen); |
|
|
printf(" received redeemscript.(%s)\n",redeemaddr); |
|
|
printf(" received redeemscript.(%s)\n",redeemaddr); |
|
|
|
|
|
LP_swap_coinaddr(swap,rawtx->coin,checkaddr,data,datalen); |
|
|
|
|
|
if ( strcmp(redeemaddr,checkaddr) != 0 ) |
|
|
|
|
|
{ |
|
|
|
|
|
printf("REDEEMADDR MISMATCH??? %s != %s\n",redeemaddr,checkaddr); |
|
|
|
|
|
return(-1); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
//printf("recvlen.%d datalen.%d redeemlen.%d\n",recvlen,datalen,rawtx->redeemlen);
|
|
|
//printf("recvlen.%d datalen.%d redeemlen.%d\n",recvlen,datalen,rawtx->redeemlen);
|
|
|
if ( rawtx->I.datalen == 0 ) |
|
|
if ( rawtx->I.datalen == 0 ) |
|
@ -558,9 +564,7 @@ int32_t LP_rawtx_spendscript(struct basilisk_swap *swap,int32_t height,struct ba |
|
|
bitcoin_address(rawtx->p2shaddr,rawtx->coin->p2shtype,rawtx->spendscript,hexlen); |
|
|
bitcoin_address(rawtx->p2shaddr,rawtx->coin->p2shtype,rawtx->spendscript,hexlen); |
|
|
//if ( swap != 0 )
|
|
|
//if ( swap != 0 )
|
|
|
// basilisk_txlog(swap->myinfoptr,swap,rawtx,-1); // bobdeposit, bobpayment or alicepayment
|
|
|
// basilisk_txlog(swap->myinfoptr,swap,rawtx,-1); // bobdeposit, bobpayment or alicepayment
|
|
|
if ( strcmp(redeemaddr,rawtx->p2shaddr) == 0 ) |
|
|
|
|
|
retval = 0; |
|
|
retval = 0; |
|
|
else printf("mismatched redeemscript %s != %s\n",redeemaddr,rawtx->p2shaddr); |
|
|
|
|
|
} |
|
|
} |
|
|
} else printf("%s ERROR.(%s)\n",rawtx->name,jprint(txobj,0)); |
|
|
} else printf("%s ERROR.(%s)\n",rawtx->name,jprint(txobj,0)); |
|
|
} |
|
|
} |
|
@ -634,6 +638,9 @@ void LP_bobloop(void *_utxo) |
|
|
printf("error bobscripts deposit\n"); |
|
|
printf("error bobscripts deposit\n"); |
|
|
else |
|
|
else |
|
|
{ |
|
|
{ |
|
|
|
|
|
swap->bobrefund.utxovout = 0; |
|
|
|
|
|
swap->bobrefund.utxotxid = swap->bobdeposit.I.signedtxid; |
|
|
|
|
|
basilisk_bobdeposit_refund(swap,swap->I.putduration); |
|
|
//printf("depositlen.%d\n",swap->bobdeposit.I.datalen);
|
|
|
//printf("depositlen.%d\n",swap->bobdeposit.I.datalen);
|
|
|
LP_swapsfp_update(&swap->I.req); |
|
|
LP_swapsfp_update(&swap->I.req); |
|
|
if ( LP_waitfor(utxo->pair,swap,10,LP_verify_otherfee) < 0 ) |
|
|
if ( LP_waitfor(utxo->pair,swap,10,LP_verify_otherfee) < 0 ) |
|
@ -648,6 +655,9 @@ void LP_bobloop(void *_utxo) |
|
|
printf("error sending bobpayment\n"); |
|
|
printf("error sending bobpayment\n"); |
|
|
else |
|
|
else |
|
|
{ |
|
|
{ |
|
|
|
|
|
swap->bobreclaim.utxovout = 0; |
|
|
|
|
|
swap->bobreclaim.utxotxid = swap->bobpayment.I.signedtxid; |
|
|
|
|
|
basilisk_bobpayment_reclaim(swap,swap->I.callduration); |
|
|
printf("looping on swaplist\n"); |
|
|
printf("looping on swaplist\n"); |
|
|
while ( 1 ) |
|
|
while ( 1 ) |
|
|
{ |
|
|
{ |
|
|