Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
e2aa9f04a0
  1. 3
      iguana/iguana_instantdex.c
  2. 7
      iguana/swaps/iguana_BTCswap.c

3
iguana/iguana_instantdex.c

@ -437,10 +437,12 @@ char *instantdex_sendcmd(struct supernet_info *myinfo,struct instantdex_offer *o
//printf("extralen.%d datalen.%d slen.%d olen.%d\n",extralen,datalen,slen,olen);
if ( extralen > 0 )
{
char str[65];
memcpy(&msg->serialized[slen + olen],extraser,extralen);
len = 0;
if ( serflag == 1 )
{
printf("send deck (%llx %llx)\n",(long long)swap->deck[0][0],(long long)swap->deck[0][1]);
while ( len < extralen )
{
memcpy(&x,&((uint8_t *)extraser)[len],sizeof(x));
@ -450,6 +452,7 @@ char *instantdex_sendcmd(struct supernet_info *myinfo,struct instantdex_offer *o
}
else if ( serflag == 2 )
{
printf("send privkeys0 %s\n",bits256_str(str,swap->privkeys[0]));
while ( len < extralen )
{
memcpy(&tmphash,&((uint8_t *)extraser)[len],sizeof(x));

7
iguana/swaps/iguana_BTCswap.c

@ -493,7 +493,7 @@ char *instantdex_choosei(struct bitcoin_swapinfo *swap,cJSON *newjson,cJSON *arg
swap->choosei = -swap->choosei;
swap->choosei %= max;
jaddnum(newjson,"mychoosei",swap->choosei);
printf("%llu/%llu %s send mychoosei.%d of max.%d\n",(long long)swap->mine.orderid,(long long)swap->other.orderid,instantdex_isbob(swap)!=0?"BOB":"alice",swap->choosei,max);
printf("%llu/%llu %s send mychoosei.%d of max.%d deck.(%llx %llx)\n",(long long)swap->mine.orderid,(long long)swap->other.orderid,instantdex_isbob(swap)!=0?"BOB":"alice",swap->choosei,max,(long long)swap->deck[0][0],(long long)swap->deck[0][1]);
return(0);
}
else
@ -505,13 +505,14 @@ 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,wrongfirstbyte,errs,len = 0; bits256 hashpriv,otherpriv,pubi; uint8_t otherpubkey[33],pubkey[33];
int32_t i,wrongfirstbyte,errs,len = 0; bits256 hashpriv,otherpriv,pubi; uint8_t otherpubkey[33],pubkey[33]; char str[65];
if ( swap->cutverified == 0 && swap->choosei >= 0 && serdatalen == sizeof(swap->privkeys) )
{
printf("got instantdex_privkeyextract serdatalen.%d choosei.%d cutverified.%d\n",serdatalen,swap->choosei,swap->cutverified);
for (i=wrongfirstbyte=errs=0; i<sizeof(swap->privkeys)/sizeof(*swap->privkeys); i++)
{
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 )
{
if ( bits256_nonz(otherpriv) != 0 )

Loading…
Cancel
Save