|
@ -493,7 +493,7 @@ char *instantdex_choosei(struct bitcoin_swapinfo *swap,cJSON *newjson,cJSON *arg |
|
|
swap->choosei = -swap->choosei; |
|
|
swap->choosei = -swap->choosei; |
|
|
swap->choosei %= max; |
|
|
swap->choosei %= max; |
|
|
jaddnum(newjson,"mychoosei",swap->choosei); |
|
|
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); |
|
|
return(0); |
|
|
} |
|
|
} |
|
|
else |
|
|
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) |
|
|
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) ) |
|
|
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++) |
|
|
for (i=wrongfirstbyte=errs=0; i<sizeof(swap->privkeys)/sizeof(*swap->privkeys); i++) |
|
|
{ |
|
|
{ |
|
|
len += iguana_rwbignum(0,&serdata[len],sizeof(bits256),otherpriv.bytes); |
|
|
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 ( i == swap->choosei ) |
|
|
{ |
|
|
{ |
|
|
if ( bits256_nonz(otherpriv) != 0 ) |
|
|
if ( bits256_nonz(otherpriv) != 0 ) |
|
|