Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
ac6f87ea15
  1. 4
      iguana/exchanges777.h
  2. 16
      iguana/swaps/iguana_BTCswap.c

4
iguana/exchanges777.h

@ -24,7 +24,7 @@
#define INSTANTDEX_DECKSIZE 777
#define INSTANTDEX_HOPS 2
#define INSTANTDEX_DURATION 30
#define INSTANTDEX_DURATION 60
#define INSTANTDEX_ORDERSTATE_IDLE 0
#define INSTANTDEX_ORDERSTATE_HAVEOTHERFEE 1
@ -41,7 +41,7 @@
#define INSTANTDEX_BTCD "RThtXup6Zo7LZAi8kRWgjAyi1s4u6U9Cpf"
#define INSTANTDEX_MINPERC 50
#define INSTANTDEX_OFFERDURATION 60
#define INSTANTDEX_OFFERDURATION 120
#define INSTANTDEX_LOCKTIME 3600
#define EXCHANGES777_MINPOLLGAP 1

16
iguana/swaps/iguana_BTCswap.c

@ -505,16 +505,13 @@ char *instantdex_choosei(struct bitcoin_swapinfo *swap,cJSON *newjson,cJSON *arg
void instantdex_privkeyextract(struct supernet_info *myinfo,struct bitcoin_swapinfo *swap,uint8_t *serdata,int32_t serdatalen)
{
int32_t i,j,wrongfirstbyte,errs,len = 0; bits256 hashpriv,otherpriv,pubi; uint8_t otherpubkey[33],pubkey[33]; char str[65];
int32_t i,j,wrongfirstbyte,errs,len = 0; bits256 otherpriv,pubi; uint8_t secret160[20],otherpubkey[33],pubkey[33]; char str[65]; uint64_t txid;
if ( swap->cutverified == 0 && swap->choosei >= 0 && serdatalen == sizeof(swap->privkeys) )
{
for (i=wrongfirstbyte=errs=0; i<sizeof(swap->privkeys)/sizeof(*swap->privkeys); i++)
{
if ( i == 0 )
printf("raw recv.%s\n",bits256_str(str,*(bits256 *)serdata));
for (j=0; j<32; j++)
otherpriv.bytes[j] = serdata[len++];
//len += iguana_rwbignum(0,&serdata[len],sizeof(bits256),otherpriv.bytes);
if ( i == 0 )
printf("got instantdex_privkeyextract serdatalen.%d choosei.%d cutverified.%d priv0 %s\n",serdatalen,swap->choosei,swap->cutverified,bits256_str(str,otherpriv));
if ( i == swap->choosei )
@ -541,20 +538,21 @@ void instantdex_privkeyextract(struct supernet_info *myinfo,struct bitcoin_swapi
continue;
}
pubi = bitcoin_pubkey33(myinfo->ctx,otherpubkey,otherpriv);
vcalc_sha256(0,hashpriv.bytes,otherpriv.bytes,sizeof(otherpriv));
calc_rmd160_sha256(secret160,otherpriv.bytes,sizeof(otherpriv));
memcpy(&txid,secret160,sizeof(txid));
if ( otherpubkey[0] != (instantdex_isbob(swap) ^ 1) + 0x02 )
{
wrongfirstbyte++;
printf("wrongfirstbyte[%d] %02x\n",i,otherpubkey[0]);
}
else if ( swap->otherdeck[i][0] != hashpriv.txid )
else if ( swap->otherdeck[i][1] != pubi.txid )
{
printf("otherdeck[%d] priv mismatch %llx != %llx\n",i,(long long)swap->otherdeck[i][0],(long long)hashpriv.txid);
printf("otherdeck[%d] priv ->pub mismatch %llx != %llx\n",i,(long long)swap->otherdeck[i][1],(long long)pubi.txid);
errs++;
}
else if ( swap->otherdeck[i][1] != pubi.txid )
else if ( swap->otherdeck[i][0] != txid )
{
printf("otherdeck[%d] priv mismatch %llx != %llx\n",i,(long long)swap->otherdeck[i][1],(long long)pubi.txid);
printf("otherdeck[%d] priv mismatch %llx != %llx\n",i,(long long)swap->otherdeck[i][0],(long long)txid);
errs++;
}
}

Loading…
Cancel
Save