Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
c003bff543
  1. 8
      iguana/iguana_instantdex.c
  2. 6
      iguana/swaps/iguana_BTCswap.c

8
iguana/iguana_instantdex.c

@ -389,7 +389,7 @@ bits256 instantdex_rwoffer(int32_t rwflag,int32_t *lenp,uint8_t *serialized,stru
char *instantdex_sendcmd(struct supernet_info *myinfo,struct instantdex_offer *offer,cJSON *argjson,char *cmdstr,bits256 desthash,int32_t hops,void *extraser,int32_t extralen,struct iguana_peer *addr,struct bitcoin_swapinfo *swap)
{
char *reqstr,*hexstr,*retstr; struct instantdex_msghdr *msg; bits256 orderhash,tmphash; struct iguana_info *coin; int32_t i,len,serflag,olen,slen,datalen,max=-1; uint8_t serialized[sizeof(*offer) + sizeof(struct iguana_msghdr) + 4096 + INSTANTDEX_DECKSIZE*33]; uint64_t x,nxt64bits;
char *reqstr,*hexstr,*retstr; struct instantdex_msghdr *msg; bits256 orderhash,tmphash; struct iguana_info *coin; int32_t i,j,len,serflag,olen,slen,datalen,max=-1; uint8_t serialized[sizeof(*offer) + sizeof(struct iguana_msghdr) + 4096 + INSTANTDEX_DECKSIZE*33]; uint64_t x,nxt64bits;
//if ( strcmp(cmdstr,"poll") == 0 )
// return(clonestr("{\"result\":\"skip sending poll\"}"));
category_subscribe(myinfo,myinfo->instantdex_category,GENESIS_PUBKEY);
@ -455,8 +455,10 @@ char *instantdex_sendcmd(struct supernet_info *myinfo,struct instantdex_offer *o
printf("send privkeys0 %s\n",bits256_str(str,swap->privkeys[0]));
while ( len < extralen )
{
memcpy(&tmphash,&((uint8_t *)extraser)[len],sizeof(x));
iguana_rwbignum(1,&((uint8_t *)extraser)[len],sizeof(bits256),tmphash.bytes);
memcpy(&tmphash,&((uint8_t *)extraser)[len],sizeof(tmphash));
for (j=0; j<32; j++)
((uint8_t *)extraser)[len++] = tmphash.bytes[j];
//iguana_rwbignum(1,&((uint8_t *)extraser)[len],sizeof(bits256),tmphash.bytes);
if ( len == 0 )
printf("ser privkeys0 %s\n",bits256_str(str,*(bits256 *)extraser));
len += sizeof(bits256);

6
iguana/swaps/iguana_BTCswap.c

@ -505,14 +505,16 @@ 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]; char str[65];
int32_t i,j,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) )
{
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));
len += iguana_rwbignum(0,&serdata[len],sizeof(bits256),otherpriv.bytes);
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 )

Loading…
Cancel
Save