Browse Source

Merge pull request #663 from jl777/jl777

SMART
increase effective limit to 256 coins, at 172 now
patch-3
jl777 7 years ago
committed by GitHub
parent
commit
ea615921ec
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      iguana/exchanges/LP_bitcoin.c
  2. 30
      iguana/exchanges/LP_commands.c
  3. 15
      iguana/exchanges/LP_nativeDEX.c
  4. 9
      iguana/exchanges/LP_prices.c
  5. 9
      iguana/exchanges/LP_privkey.c
  6. 2
      iguana/exchanges/coins

2
iguana/exchanges/LP_bitcoin.c

@ -2027,7 +2027,7 @@ bits256 bits256_calctxid(char *symbol,uint8_t *serialized,int32_t len)
{
bits256 txid,revtxid; int32_t i;
memset(txid.bytes,0,sizeof(txid));
if ( strcmp(symbol,"GRS") != 0 )
if ( strcmp(symbol,"GRS") != 0 && strcmp(symbol,"SMART") != 0 )
txid = bits256_doublesha256(0,serialized,len);
else
{

30
iguana/exchanges/LP_commands.c

@ -160,7 +160,7 @@ bot_settings(botid, newprice, newvolume)\n\
bot_status(botid)\n\
bot_stop(botid)\n\
bot_pause(botid)\n\
calcaddress(passphrase)\n\
calcaddress(passphrase, coin=KMD)\n\
convaddress(coin, address, destcoin)\n\
instantdex_deposit(weeks, amount, broadcast=1)\n\
instantdex_claim()\n\
@ -337,17 +337,39 @@ jpg(srcfile, destfile, power2=7, password, data="", required, ind=0)\n\
}
else if ( strcmp(method,"calcaddress") == 0 )
{
bits256 privkey,pub; uint8_t pubkey33[33]; char *passphrase,coinaddr[64],wifstr[64];
bits256 privkey,pub; uint8_t pubtype,wiftaddr,p2shtype,taddr,wiftype,pubkey33[33]; char *passphrase,coinaddr[64],wifstr[64],pubsecp[67];
if ( (passphrase= jstr(argjson,"passphrase")) != 0 )
{
conv_NXTpassword(privkey.bytes,pub.bytes,(uint8_t *)passphrase,(int32_t)strlen(passphrase));
privkey.bytes[0] &= 248, privkey.bytes[31] &= 127, privkey.bytes[31] |= 64;
bitcoin_priv2pub(ctx,"KMD",pubkey33,coinaddr,privkey,0,60);
if ( (coin= jstr(argjson,"coin")) == 0 || (ptr= LP_coinfind(coin)) == 0 )
{
coin = "KMD";
taddr = 0;
pubtype = 60;
p2shtype = 85;
wiftype = 188;
wiftaddr = 0;
}
else
{
coin = ptr->symbol;
taddr = ptr->taddr;
pubtype = ptr->pubtype;
p2shtype = ptr->p2shtype;
wiftype = ptr->wiftype;
wiftaddr = ptr->wiftaddr;
}
retjson = cJSON_CreateObject();
jaddstr(retjson,"passphrase",passphrase);
bitcoin_priv2pub(ctx,coin,pubkey33,coinaddr,privkey,taddr,pubtype);
init_hexbytes_noT(pubsecp,pubkey33,33);
jaddstr(retjson,"pubsecp",pubsecp);
jaddstr(retjson,"coinaddr",coinaddr);
bitcoin_priv2pub(ctx,coin,pubkey33,coinaddr,privkey,taddr,p2shtype);
jaddstr(retjson,"p2shaddr",coinaddr);
jaddbits256(retjson,"privkey",privkey);
bitcoin_priv2wif("KMD",0,wifstr,privkey,188);
bitcoin_priv2wif(coin,wiftaddr,wifstr,privkey,wiftype);
jaddstr(retjson,"wif",wifstr);
return(jprint(retjson,1));
} else return(clonestr("{\"error\":\"need to have passphrase\"}"));

15
iguana/exchanges/LP_nativeDEX.c

@ -828,7 +828,7 @@ void LP_initcoins(void *ctx,int32_t pubsock,cJSON *coins)
item = jitem(coins,i);
if ( (symbol= jstr(item,"coin")) != 0 )
{
printf("%s, ",jstr(item,"coin"));
printf("%s.%d ",jstr(item,"coin"),LP_numpriceinfos);
LP_coincreate(item);
LP_priceinfoadd(jstr(item,"coin"));
if ( (coin= LP_coinfind(symbol)) != 0 )
@ -847,6 +847,19 @@ void LP_initcoins(void *ctx,int32_t pubsock,cJSON *coins)
{
bech32_tests();
}
else if ( 0 && strcmp(coin->symbol,"SMART") == 0 )
{
uint8_t txdata[8129]; int32_t len; bits256 txid,txid2,ktxid; char str[65];
char *txstr = "0100000005c9a9c56f4e702766c582127587ee49695ba5b9e5c449290a4f8a0505c12beeb7000000006b483045022100867f85d9f8d7f543225448f1d2383ff7d60a325b5f643557ea36325372de9993022034ccd202ee017c3d8a2dfa615b72d661b891d2071b1c15d4d7ab063762c79d2f012103f9be43471012e3e6daaa7a91a68cbc667fa61791e4a93f8e8d53255a93b68d03ffffffffe062eb6845b69856d62ceb3fd9b7e05c383b8b88b9359bc7c8ac49cd7dd2b2bb010000006b483045022100d4ef1c6d5f24ad3877f57f8ae4a1c0f8aa2f6de5ccaa8ed8e10b2937a4316c1402200d41b154a892a98d40c4d39e619992cca1eba4b5939bbf2b418062cd1275a8b101210302649cc91eda9d5fbc9d41b4a14f98917a00cdc6fc952c9fdf8a98a544cfcca9ffffffff561ee4189323bf8f619bcedd1f9e02033adb588db31cb3dc7ec3bda23f73aac4000000006b483045022100d4a5ab03675f585cc055c76fdaa80333757c42583883dfcde08cb0aeb57f256a022063440e24ef4ef5b44dcb0e7aacaa4562effd80f9a1d9b273daa581066c8359fb0121035c0e6d900a5e8c27901ce7edcdc9bfafea44dbfb714274271114245d7e895198ffffffff56cf1fa6d5779fd2bded063d63455809373ff2bf79edf921be7e92f918ef43df010000006b48304502210091d15d5fcb518103f04fdc819513200d30033f9a1e29960458375e7c71247d31022064a233c4073ac88652a0324f6973914b08bfcf76e928afae0099dc2d7eb227750121032946d47c35c0a98ae7ccad30fee846007434fff25cf70973b5c76deb4be2a14fffffffff4754ee214a33da0116730b43238cc6ff0510b8cebc59a42b1f0609e2a10aa8c8000000006b483045022100f3cea95cd6451d706fb1766cec30450ef000649df15d7d7bebcecbfe6ec48e98022016e687a7d956d2ab089d76306046d33ce5ace55fcb4595021de3f97c4293d1b601210367db63755cf13760c81b8cb0c13eee10474064dfacc7c45a8c3271b5b058f0ccffffffff025e489467030000001976a9147283e4813a5e5fb8d723e75403ba10e05a7820db88ac60f71b00000000001976a914d740ff057317d3b12d5a6dadac5bb7ff87e48afe88ac578a0500";
len = (int32_t)strlen(txstr) >> 1;
decode_hex(txdata,len,txstr);
vcalc_sha256(0,txid.bytes,txdata,len);
txid2 = bits256_doublesha256(0,txdata,len);
HashKeccak(ktxid.bytes,txdata,len);
printf("txid %s\n",bits256_str(str,txid));
printf("txid2 %s\n",bits256_str(str,txid2));
printf("ktxid %s\n",bits256_str(str,ktxid));
}
}
}
}

9
iguana/exchanges/LP_prices.c

@ -644,9 +644,14 @@ struct LP_priceinfo *LP_priceinfoadd(char *symbol)
struct LP_priceinfo *pp; cJSON *retjson;
if ( symbol == 0 )
return(0);
if ( (pp= LP_priceinfofind(symbol)) != 0 )
{
printf("%s already there\n",symbol);
return(pp);
}
if ( LP_numpriceinfos >= sizeof(LP_priceinfos)/sizeof(*LP_priceinfos) )
{
printf("cant add any more priceinfos\n");
printf("cant add any more priceinfos than %d\n",LP_numpriceinfos);
return(0);
}
pp = &LP_priceinfos[LP_numpriceinfos];
@ -654,7 +659,7 @@ struct LP_priceinfo *LP_priceinfoadd(char *symbol)
safecopy(pp->symbol,symbol,sizeof(pp->symbol));
pp->coinbits = stringbits(symbol);
pp->ind = LP_numpriceinfos++;
LP_numpriceinfos++;
//LP_numpriceinfos++;
if ( (retjson= LP_priceinfomatrix(0)) != 0 )
free_json(retjson);
return(pp);

9
iguana/exchanges/LP_privkey.c

@ -571,6 +571,8 @@ uint8_t *JPG_decrypt(uint16_t *indp,int32_t *recvlenp,uint8_t space[JPG_ENCRYPTE
int32_t LP_opreturn_decrypt(uint16_t *ind16p,uint8_t *decoded,uint8_t *encoded,int32_t encodedlen,char *passphrase)
{
bits256 privkey; int32_t msglen; uint8_t *extracted,space[JPG_ENCRYPTED_MAXSIZE + crypto_box_ZEROBYTES];
if ( passphrase != 0 && passphrase[0] != 0 )
{
vcalc_sha256(0,privkey.bytes,(uint8_t *)passphrase,(int32_t)strlen(passphrase));
msglen = ((int32_t)encoded[1] << 8) | encoded[0];
*ind16p = ((int32_t)encoded[3] << 8) | encoded[2];
@ -580,6 +582,13 @@ int32_t LP_opreturn_decrypt(uint16_t *ind16p,uint8_t *decoded,uint8_t *encoded,i
return(msglen);
} else return(-1);
}
else
{
*ind16p = calc_crc32(0,extracted,encodedlen);
memcpy(decoded,extracted,encodedlen);
return(encodedlen);
}
}
int32_t LP_opreturn_encrypt(uint8_t *dest,int32_t maxsize,uint8_t *data,int32_t datalen,char *passphrase,uint16_t ind16)
{

2
iguana/exchanges/coins

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