diff --git a/iguana/exchanges777.h b/iguana/exchanges777.h index 45aed67d7..c888a05d1 100755 --- a/iguana/exchanges777.h +++ b/iguana/exchanges777.h @@ -24,7 +24,7 @@ #define INSTANTDEX_DECKSIZE 777 #define INSTANTDEX_HOPS 2 -#define INSTANTDEX_DURATION 60 +#define INSTANTDEX_DURATION 30 #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 120 +#define INSTANTDEX_OFFERDURATION 60 #define INSTANTDEX_LOCKTIME 3600 #define EXCHANGES777_MINPOLLGAP 1 diff --git a/iguana/iguana_instantdex.c b/iguana/iguana_instantdex.c index f9c823fdd..d4f1ed332 100755 --- a/iguana/iguana_instantdex.c +++ b/iguana/iguana_instantdex.c @@ -437,12 +437,11 @@ 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]); + //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)); @@ -458,8 +457,8 @@ char *instantdex_sendcmd(struct supernet_info *myinfo,struct instantdex_offer *o 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)); + //if ( len == 0 ) + // printf("ser privkeys0 %s\n",bits256_str(str,*(bits256 *)extraser)); len += sizeof(bits256); } } diff --git a/iguana/swaps/iguana_BTCswap.c b/iguana/swaps/iguana_BTCswap.c index 261ae9b8a..d6882fdbe 100755 --- a/iguana/swaps/iguana_BTCswap.c +++ b/iguana/swaps/iguana_BTCswap.c @@ -527,6 +527,7 @@ void instantdex_privkeyextract(struct supernet_info *myinfo,struct bitcoin_swapi if ( otherpubkey[0] == 0x02 ) { swap->privBn = swap->privkeys[i]; + calc_rmd160_sha256(swap->secretBn,swap->privBn.bytes,sizeof(swap->privBn)); swap->pubBn = bitcoin_pubkey33(myinfo->ctx,pubkey,swap->privBn); } else printf("wrong first byte.%02x\n",otherpubkey[0]); } @@ -535,6 +536,7 @@ void instantdex_privkeyextract(struct supernet_info *myinfo,struct bitcoin_swapi if ( otherpubkey[0] == 0x03 ) { swap->privAm = swap->privkeys[i]; + calc_rmd160_sha256(swap->secretAm,swap->privAm.bytes,sizeof(swap->privAm)); swap->pubAm = bitcoin_pubkey33(myinfo->ctx,pubkey,swap->privAm); } else printf("wrong first byte.%02x\n",otherpubkey[0]); } @@ -608,7 +610,7 @@ void instantdex_swapbits256update(bits256 *txidp,cJSON *argjson,char *fieldname) void instantdex_newjson(struct supernet_info *myinfo,struct bitcoin_swapinfo *swap,cJSON *newjson) { - uint8_t pubkey[33],*secret160; int32_t deckflag; char secretstr[41],*field; bits256 priv; + uint8_t pubkey[33],*secret160; int32_t deckflag; char secretstr[41],*field; deckflag = (newjson != 0 && swap->otherchoosei < 0) ? 1 : 0; if ( instantdex_pubkeyargs(myinfo,swap,2 + deckflag*INSTANTDEX_DECKSIZE,myinfo->persistent_priv,swap->myorderhash,0x02+instantdex_isbob(swap)) != 2 + deckflag*INSTANTDEX_DECKSIZE ) printf("ERROR: couldnt generate pubkeys deckflag.%d\n",deckflag); @@ -622,26 +624,21 @@ void instantdex_newjson(struct supernet_info *myinfo,struct bitcoin_swapinfo *sw { secret160 = swap->secretBn; field = "secretBn"; - priv = swap->privBn; } else { secret160 = swap->secretAm; field = "secretAm"; - priv = swap->privAm; - } - if ( bits256_nonz(priv) != 0 ) - { - calc_rmd160_sha256(secret160,priv.bytes,sizeof(priv)); - init_hexbytes_noT(secretstr,secret160,20); - jaddstr(newjson,field,secretstr); } + init_hexbytes_noT(secretstr,secret160,20); + jaddstr(newjson,field,secretstr); + printf("send secretstr.(%s)\n",secretstr); } - if ( swap->myfee != 0 && jobj(newjson,"feetx") == 0 && (swap->otherhavestate & INSTANTDEX_ORDERSTATE_HAVEOTHERFEE) == 0 ) + if ( jobj(newjson,"feetx") == 0 && swap->myfee != 0 ) // && (swap->otherhavestate & INSTANTDEX_ORDERSTATE_HAVEOTHERFEE) == 0 ) { jaddbits256(newjson,"feetxid",swap->myfee->txid); jaddstr(newjson,"feetx",swap->myfee->txbytes); - printf("add feetx to newjson have.%x\n",swap->havestate); + //printf("add feetx to newjson have.%x\n",swap->havestate); } if ( instantdex_isbob(swap) == 0 ) {