Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
b6ef92ecad
  1. 20
      iguana/swaps/iguana_BTCswap.c

20
iguana/swaps/iguana_BTCswap.c

@ -517,16 +517,32 @@ void instantdex_privkeyextract(struct supernet_info *myinfo,struct bitcoin_swapi
for (i=wrongfirstbyte=errs=0; i<sizeof(swap->privkeys)/sizeof(*swap->privkeys); i++)
{
len += iguana_rwbignum(0,&serdata[len],sizeof(bits256),otherpriv.bytes);
pubi = bitcoin_pubkey33(myinfo->ctx,otherpubkey,otherpriv);
if ( i == swap->choosei )
{
if ( bits256_nonz(otherpriv) != 0 )
{
printf("got privkey in slot.%d my choosi??\n",i);
printf("got privkey in slot.%d my choosei??\n",i);
errs++;
}
if ( instantdex_isbob(swap) != 0 )
{
if ( otherpubkey[0] == 3 )
{
swap->privAm = otherpriv;
memcpy(swap->pubAm.bytes,otherpubkey+1,32);
} else printf("wrong first byte.%02x\n",otherpubkey[0]);
}
else
{
if ( otherpubkey[0] == 2 )
{
swap->privBn = otherpriv;
memcpy(swap->pubBn.bytes,otherpubkey+1,32);
} else printf("wrong first byte.%02x\n",otherpubkey[0]);
}
continue;
}
pubi = bitcoin_pubkey33(myinfo->ctx,otherpubkey,otherpriv);
vcalc_sha256(0,hashpriv.bytes,otherpriv.bytes,sizeof(otherpriv));
if ( otherpubkey[0] != (instantdex_isbob(swap) ^ 1) + 0x02 )
{

Loading…
Cancel
Save