Browse Source

Test

patch-3
jl777 7 years ago
parent
commit
c8f658875b
  1. 1
      iguana/exchanges/LP_bitcoin.c
  2. 16
      iguana/exchanges/LP_remember.c
  3. 4
      iguana/exchanges/LP_transaction.c

1
iguana/exchanges/LP_bitcoin.c

@ -1913,7 +1913,6 @@ int32_t bitcoin_p2shspend(uint8_t *script,int32_t n,uint8_t rmd160[20])
int32_t bitcoin_secret160verify(uint8_t *script,int32_t n,uint8_t secret160[20]) int32_t bitcoin_secret160verify(uint8_t *script,int32_t n,uint8_t secret160[20])
{ {
script[n++] = IGUANA_OP_SIZE; // add SIZE 32 EQUALVERIFY script[n++] = IGUANA_OP_SIZE; // add SIZE 32 EQUALVERIFY
script[n++] = IGUANA_OP_PUSHDATA1;
script[n++] = 1; script[n++] = 1;
script[n++] = 32; script[n++] = 32;
script[n++] = SCRIPT_OP_EQUALVERIFY; script[n++] = SCRIPT_OP_EQUALVERIFY;

16
iguana/exchanges/LP_remember.c

@ -1200,11 +1200,6 @@ cJSON *basilisk_remember(int64_t *KMDtotals,int64_t *BTCtotals,uint32_t requesti
memset(rev.bytes,0,sizeof(rev)); memset(rev.bytes,0,sizeof(rev));
for (j=0; j<32; j++) for (j=0; j<32; j++)
rev.bytes[j] = rswap.privAm.bytes[31 - j]; rev.bytes[j] = rswap.privAm.bytes[31 - j];
//revcalc_rmd160_sha256(secretAm,rev);//privAm);
//vcalc_sha256(0,secretAm256,rev.bytes,sizeof(rev));
//if ( rswap.Predeemlen != 0 )
// redeemlen = rswap.Predeemlen, memcpy(redeemscript,rswap.Predeemscript,rswap.Predeemlen);
//else
redeemlen = basilisk_swap_bobredeemscript(0,&secretstart,redeemscript,rswap.plocktime,rswap.pubA0,rswap.pubB0,rswap.pubB1,rev,rswap.privBn,rswap.secretAm,rswap.secretAm256,rswap.secretBn,rswap.secretBn256); redeemlen = basilisk_swap_bobredeemscript(0,&secretstart,redeemscript,rswap.plocktime,rswap.pubA0,rswap.pubB0,rswap.pubB1,rev,rswap.privBn,rswap.secretAm,rswap.secretAm256,rswap.secretBn,rswap.secretBn256);
if ( rswap.Predeemlen != 0 ) if ( rswap.Predeemlen != 0 )
{ {
@ -1213,17 +1208,14 @@ cJSON *basilisk_remember(int64_t *KMDtotals,int64_t *BTCtotals,uint32_t requesti
else printf("Predeem matches\n"); else printf("Predeem matches\n");
} else printf("%p Predeemscript missing\n",rswap.Predeemscript); } else printf("%p Predeemscript missing\n",rswap.Predeemscript);
len = basilisk_swapuserdata(userdata,rev,0,rswap.myprivs[0],redeemscript,redeemlen); len = basilisk_swapuserdata(userdata,rev,0,rswap.myprivs[0],redeemscript,redeemlen);
if ( 0 )
{ {
char privaddr[64]; uint8_t privpub33[33],secretAm[20]; uint8_t secretAm[20];
revcalc_rmd160_sha256(secretAm,rev); calc_rmd160_sha256(secretAm,rswap.privAm.bytes,sizeof(rswap.privAm));
for (j=0; j<20; j++) for (j=0; j<20; j++)
printf("%02x",secretAm[j]); printf("%02x",secretAm[j]);
bitcoin_pubkey33(ctx,privpub33,rswap.myprivs[0]); printf(" secretAm, privAm %s alicespend len.%d redeemlen.%d\n",bits256_str(str,rswap.privAm),len,redeemlen);
bitcoin_address(rswap.bobcoin,privaddr,0,60,privpub33,33);
printf(" alicespend len.%d redeemlen.%d priv0addr.(%s) priv0.(%s)\n",len,redeemlen,privaddr,bits256_str(str,rswap.myprivs[0]));
} }
for (j=0; j<32; j++)
rev.bytes[j] = rswap.myprivs[0].bytes[31 - j];
if ( (rswap.txbytes[BASILISK_ALICESPEND]= basilisk_swap_bobtxspend(&signedtxid,rswap.Btxfee,"alicespend",rswap.bobcoin,bob->wiftaddr,bob->taddr,bob->pubtype,bob->p2shtype,bob->isPoS,bob->wiftype,ctx,rswap.myprivs[0],0,redeemscript,redeemlen,userdata,len,rswap.txids[BASILISK_BOBPAYMENT],0,0,rswap.pubkey33,1,rswap.expiration,&rswap.values[BASILISK_ALICESPEND],0,0,rswap.bobpaymentaddr,1,bob->zcash)) != 0 ) if ( (rswap.txbytes[BASILISK_ALICESPEND]= basilisk_swap_bobtxspend(&signedtxid,rswap.Btxfee,"alicespend",rswap.bobcoin,bob->wiftaddr,bob->taddr,bob->pubtype,bob->p2shtype,bob->isPoS,bob->wiftype,ctx,rswap.myprivs[0],0,redeemscript,redeemlen,userdata,len,rswap.txids[BASILISK_BOBPAYMENT],0,0,rswap.pubkey33,1,rswap.expiration,&rswap.values[BASILISK_ALICESPEND],0,0,rswap.bobpaymentaddr,1,bob->zcash)) != 0 )
{ {
printf("alicespend.(%s)\n",rswap.txbytes[BASILISK_ALICESPEND]); printf("alicespend.(%s)\n",rswap.txbytes[BASILISK_ALICESPEND]);

4
iguana/exchanges/LP_transaction.c

@ -1788,7 +1788,7 @@ int32_t basilisk_swap_bobredeemscript(int32_t depositflag,int32_t *secretstartp,
uint8_t bufA[20],bufB[20]; uint8_t bufA[20],bufB[20];
revcalc_rmd160_sha256(bufA,privkey); revcalc_rmd160_sha256(bufA,privkey);
calc_rmd160_sha256(bufB,privkey.bytes,sizeof(privkey)); calc_rmd160_sha256(bufB,privkey.bytes,sizeof(privkey));
if ( memcmp(bufA,secret160,sizeof(bufA)) == 0 ) /*if ( memcmp(bufA,secret160,sizeof(bufA)) == 0 )
printf("MATCHES BUFA\n"); printf("MATCHES BUFA\n");
else if ( memcmp(bufB,secret160,sizeof(bufB)) == 0 ) else if ( memcmp(bufB,secret160,sizeof(bufB)) == 0 )
printf("MATCHES BUFB\n"); printf("MATCHES BUFB\n");
@ -1798,7 +1798,7 @@ int32_t basilisk_swap_bobredeemscript(int32_t depositflag,int32_t *secretstartp,
printf(" <- revcalc\n"); printf(" <- revcalc\n");
for (i=0; i<20; i++) for (i=0; i<20; i++)
printf("%02x",bufB[i]); printf("%02x",bufB[i]);
printf(" <- calc\n"); printf(" <- calc\n");*/
memcpy(secret160,bufB,20); memcpy(secret160,bufB,20);
} }
n = bitcoin_secret160verify(redeemscript,n,secret160); n = bitcoin_secret160verify(redeemscript,n,secret160);

Loading…
Cancel
Save