Browse Source

Merge pull request #533 from jl777/spvdex

BCH and maybe even BTG support
etomic
jl777 7 years ago
committed by GitHub
parent
commit
a5f873088b
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      iguana/exchanges/LP_bitcoin.c
  2. 4
      iguana/exchanges/LP_include.h
  3. 4
      iguana/exchanges/LP_ordermatch.c
  4. 4
      iguana/exchanges/LP_portfolio.c
  5. 4
      iguana/exchanges/LP_secp.c
  6. 2
      iguana/exchanges/coins
  7. 2
      iguana/exchanges/coins.json

6
iguana/exchanges/LP_bitcoin.c

@ -3442,9 +3442,9 @@ bits256 bitcoin_sigtxid(char *symbol,uint8_t taddr,uint8_t pubtype,uint8_t p2sht
printf("%02x",serialized[i]);
revsigtxid = bits256_doublesha256(0,serialized,len);
printf(" B path version.%08x spendamount %.8f locktime %u hashtype %08x %s\n",dest.version,dstr(spendamount),dest.lock_time,hashtype,bits256_str(str,revsigtxid));
//for (i=0; i<sizeof(revsigtxid); i++)
// sigtxid.bytes[31-i] = revsigtxid.bytes[i];
sigtxid = revsigtxid;
for (i=0; i<sizeof(revsigtxid); i++)
sigtxid.bytes[31-i] = revsigtxid.bytes[i];
//sigtxid = revsigtxid;
}
//char str[65]; printf("SIGTXID.(%s) numvouts.%d\n",bits256_str(str,sigtxid),dest.tx_out);
free(dest.vins);

4
iguana/exchanges/LP_include.h

@ -27,7 +27,7 @@
#define LP_MAJOR_VERSION "0"
#define LP_MINOR_VERSION "1"
#define LP_BUILD_NUMBER "17741"
#define LP_BUILD_NUMBER "17742"
#define LP_BARTERDEX_VERSION 1
#define LP_MAGICBITS 1
@ -485,7 +485,7 @@ int32_t LP_coinbus(uint16_t coin_busport);
int32_t LP_nanomsg_recvs(void *ctx);
int32_t LP_numconfirms(char *symbol,char *coinaddr,bits256 txid,int32_t vout,int32_t mempool);
void LP_aliceid(uint32_t tradeid,uint64_t aliceid,char *event,uint32_t requestid,uint32_t quoteid);
void LP_autoprices_update(char *base,double basevol,char *rel,double relvol);
void LP_autoprices_update(char *method,char *base,double basevol,char *rel,double relvol);
cJSON *LP_cache_transaction(struct iguana_info *coin,bits256 txid,uint8_t *serialized,int32_t len);
cJSON *LP_transaction_fromdata(struct iguana_info *coin,bits256 txid,uint8_t *serialized,int32_t len);
uint64_t LP_RTsmartbalance(struct iguana_info *coin);

4
iguana/exchanges/LP_ordermatch.c

@ -1166,12 +1166,12 @@ int32_t LP_tradecommand(void *ctx,char *myipaddr,int32_t pubsock,cJSON *argjson,
LP_requestinit(&Q.R,Q.srchash,Q.desthash,Q.srccoin,Q.satoshis-Q.txfee,Q.destcoin,Q.destsatoshis-Q.desttxfee,Q.timestamp,Q.quotetime,DEXselector);
LP_tradecommand_log(argjson);
printf("%-4d (%-10u %10u) %12s id.%22llu %5s/%-5s %12.8f -> %11.8f price %11.8f | RT.%d %d\n",(uint32_t)time(NULL) % 3600,Q.R.requestid,Q.R.quoteid,method,(long long)Q.aliceid,Q.srccoin,Q.destcoin,dstr(Q.satoshis),dstr(Q.destsatoshis),(double)Q.destsatoshis/Q.satoshis,LP_RTcount,LP_swapscount);
LP_autoprices_update(method,Q.srccoin,dstr(Q.satoshis),Q.destcoin,dstr(Q.destsatoshis));
retval = 1;
aliceid = j64bits(argjson,"aliceid");
qprice = jdouble(argjson,"price");
if ( strcmp(method,"reserved") == 0 )
{
LP_autoprices_update(Q.srccoin,dstr(Q.satoshis),Q.destcoin,dstr(Q.destsatoshis));
bestprice = LP_bob_competition(&counter,aliceid,qprice,1);
//printf("%s lag %ld: aliceid.%llu price %.8f -> bestprice %.8f Alice max %.8f\n",jprint(argjson,0),Q.quotetime - (time(NULL)-20),(long long)aliceid,qprice,bestprice,LP_Alicemaxprice);
if ( 0 )
@ -1202,7 +1202,6 @@ int32_t LP_tradecommand(void *ctx,char *myipaddr,int32_t pubsock,cJSON *argjson,
}
else if ( strcmp(method,"connected") == 0 )
{
LP_autoprices_update(Q.srccoin,dstr(Q.satoshis),Q.destcoin,dstr(Q.destsatoshis));
bestprice = LP_bob_competition(&counter,aliceid,qprice,1000);
if ( bits256_cmp(G.LP_mypub25519,Q.desthash) == 0 && bits256_cmp(G.LP_mypub25519,Q.srchash) != 0 )
{
@ -1239,7 +1238,6 @@ int32_t LP_tradecommand(void *ctx,char *myipaddr,int32_t pubsock,cJSON *argjson,
}
else if ( strcmp(method,"connect") == 0 )
{
LP_autoprices_update(Q.srccoin,dstr(Q.satoshis),Q.destcoin,dstr(Q.destsatoshis));
LP_bob_competition(&counter,aliceid,qprice,1000);
if ( bits256_cmp(G.LP_mypub25519,Q.srchash) == 0 && bits256_cmp(G.LP_mypub25519,Q.desthash) != 0 )
{

4
iguana/exchanges/LP_portfolio.c

@ -591,9 +591,9 @@ void LP_autoprice_iter(void *ctx,struct LP_priceinfo *btcpp)
}
}
void LP_autoprices_update(char *base,double basevol,char *rel,double relvol)
void LP_autoprices_update(char *method,char *base,double basevol,char *rel,double relvol)
{
// printf("autoprice update %s/%s %.8f\n",base,rel,relvol/basevol);
//printf("%s: autoprice update %s/%s %.8f\n",method,base,rel,relvol/basevol);
}
int32_t LP_autoprice(void *ctx,char *base,char *rel,cJSON *argjson)

4
iguana/exchanges/LP_secp.c

@ -97,9 +97,9 @@ int32_t bitcoin_sign(void *ctx,char *symbol,uint8_t *sig,bits256 txhash2,bits256
//printf("bitcoin_sign illegal privkey\n");
return(-1);
}
if ( strcmp(symbol,"BCH") == 0 )
if ( strcmp(symbol,"BCH") == 0 || strcmp(symbol,"BTG") == 0 )
{
char str[65]; printf("BCH deterministic signature %s\n",bits256_str(str,txhash2));
char str[65]; printf("BCH/BTG deterministic signature %s\n",bits256_str(str,txhash2));
funcp = 0;
entropy = 0;
} else entropy = extra_entropy.bytes;

2
iguana/exchanges/coins

File diff suppressed because one or more lines are too long

2
iguana/exchanges/coins.json

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save