From 9a8313e21248e9421afc8d42727a67c9782c36eb Mon Sep 17 00:00:00 2001 From: jl777 Date: Sun, 22 Oct 2017 16:43:07 +0300 Subject: [PATCH] Test --- iguana/exchanges/LP_coins.c | 4 ++-- iguana/exchanges/LP_commands.c | 12 ++++++------ iguana/exchanges/LP_nativeDEX.c | 2 +- iguana/exchanges/LP_portfolio.c | 2 +- iguana/exchanges/LP_signatures.c | 2 +- iguana/exchanges/LP_utxos.c | 6 ++---- 6 files changed, 13 insertions(+), 15 deletions(-) diff --git a/iguana/exchanges/LP_coins.c b/iguana/exchanges/LP_coins.c index 9a7cb7509..5ef612669 100644 --- a/iguana/exchanges/LP_coins.c +++ b/iguana/exchanges/LP_coins.c @@ -188,9 +188,9 @@ cJSON *LP_coinjson(struct iguana_info *coin,int32_t showwif) jaddstr(item,"coin",coin->symbol); if ( showwif != 0 ) { - bitcoin_priv2wif(coin->wiftaddr,wifstr,G.LP_mypriv25519,coin->wiftype); + bitcoin_priv2wif(coin->wiftaddr,wifstr,G.LP_privkey,coin->wiftype); bitcoin_wif2priv(coin->wiftaddr,&tmptype,&checkkey,wifstr); - if ( bits256_cmp(G.LP_mypriv25519,checkkey) == 0 ) + if ( bits256_cmp(G.LP_privkey,checkkey) == 0 ) jaddstr(item,"wif",wifstr); else jaddstr(item,"wif","error creating wif"); } diff --git a/iguana/exchanges/LP_commands.c b/iguana/exchanges/LP_commands.c index 49dcb96ab..dc9ca2ca5 100644 --- a/iguana/exchanges/LP_commands.c +++ b/iguana/exchanges/LP_commands.c @@ -382,9 +382,9 @@ stop()\n\ { //privkey = LP_privkeycalc(ctx,pubkey33,&pubkey,ptr,"",USERPASS_WIFSTR); //LP_utxopurge(0); - if ( bits256_nonz(G.LP_mypriv25519) != 0 ) - LP_privkey_init(-1,ptr,G.LP_mypriv25519,G.LP_mypub25519); - else printf("no LP_mypriv25519\n"); + if ( bits256_nonz(G.LP_privkey) != 0 ) + LP_privkey_init(-1,ptr,G.LP_privkey,G.LP_mypub25519); + else printf("no LP_privkey\n"); retjson = cJSON_CreateObject(); jaddstr(retjson,"result","success"); jaddstr(retjson,"coin",coin); @@ -483,9 +483,9 @@ stop()\n\ { LP_address(ptr,coinaddr); LP_listunspent_issue(coin,coinaddr,1); - if ( strcmp(coinaddr,ptr->smartaddr) == 0 && bits256_nonz(G.LP_mypriv25519) != 0 ) + if ( strcmp(coinaddr,ptr->smartaddr) == 0 && bits256_nonz(G.LP_privkey) != 0 ) { - LP_privkey_init(-1,ptr,G.LP_mypriv25519,G.LP_mypub25519); + LP_privkey_init(-1,ptr,G.LP_privkey,G.LP_mypub25519); //LP_smartutxos_push(ptr); } else @@ -508,7 +508,7 @@ stop()\n\ if ( coinaddr[0] != 0 ) { LP_address(ptr,coinaddr); - if ( strcmp(coinaddr,ptr->smartaddr) == 0 && bits256_nonz(G.LP_mypriv25519) != 0 ) + if ( strcmp(coinaddr,ptr->smartaddr) == 0 && bits256_nonz(G.LP_privkey) != 0 ) { //printf("ADDR_UNSPENTS %s %s is my address being asked for!\n",ptr->symbol,coinaddr); ptr->addr_listunspent_requested = (uint32_t)time(NULL); diff --git a/iguana/exchanges/LP_nativeDEX.c b/iguana/exchanges/LP_nativeDEX.c index e74f5c626..aee72a9d0 100644 --- a/iguana/exchanges/LP_nativeDEX.c +++ b/iguana/exchanges/LP_nativeDEX.c @@ -61,7 +61,7 @@ struct LP_privkey { bits256 privkey; uint8_t rmd160[20]; }; struct LP_globals { struct LP_utxoinfo *LP_utxoinfos[2],*LP_utxoinfos2[2]; - bits256 LP_mypub25519,LP_mypriv25519; + bits256 LP_mypub25519,LP_privkey,LP_mypriv25519; uint64_t LP_skipstatus[10000]; uint8_t LP_myrmd160[20],LP_pubsecp[33]; uint32_t LP_sessionid,counter; diff --git a/iguana/exchanges/LP_portfolio.c b/iguana/exchanges/LP_portfolio.c index 6d27a07aa..9bb176b00 100644 --- a/iguana/exchanges/LP_portfolio.c +++ b/iguana/exchanges/LP_portfolio.c @@ -93,7 +93,7 @@ char *LP_portfolio() continue; if ( iter == 0 ) { - LP_privkey_init(-1,coin,G.LP_mypriv25519,G.LP_mypub25519); + LP_privkey_init(-1,coin,G.LP_privkey,G.LP_mypub25519); coin->balanceA = LP_balance(&coin->valuesumA,0,coin->symbol,coin->smartaddr); coin->balanceB = LP_balance(&coin->valuesumB,1,coin->symbol,coin->smartaddr); if ( strcmp(coin->symbol,"KMD") != 0 ) diff --git a/iguana/exchanges/LP_signatures.c b/iguana/exchanges/LP_signatures.c index fde4661ba..bf9ce82fd 100644 --- a/iguana/exchanges/LP_signatures.c +++ b/iguana/exchanges/LP_signatures.c @@ -421,7 +421,7 @@ void LP_notify_pubkeys(void *ctx,int32_t pubsock) jaddbits256(reqjson,"pub",G.LP_mypub25519); init_hexbytes_noT(secpstr,G.LP_pubsecp,33); jaddstr(reqjson,"pubsecp",secpstr); - LP_pubkey_sigadd(reqjson,G.LP_mypriv25519,G.LP_mypub25519,G.LP_myrmd160,G.LP_pubsecp); + LP_pubkey_sigadd(reqjson,G.LP_privkey,G.LP_mypub25519,G.LP_myrmd160,G.LP_pubsecp); LP_reserved_msg("","",zero,jprint(reqjson,1)); } diff --git a/iguana/exchanges/LP_utxos.c b/iguana/exchanges/LP_utxos.c index 0df37e199..565cfdda2 100644 --- a/iguana/exchanges/LP_utxos.c +++ b/iguana/exchanges/LP_utxos.c @@ -730,6 +730,7 @@ bits256 LP_privkeycalc(void *ctx,uint8_t *pubkey33,bits256 *pubkeyp,struct iguan bitcoin_priv2wif(coin->wiftaddr,tmpstr,privkey,coin->wiftype); bitcoin_addr2rmd160(coin->taddr,&tmptype,G.LP_myrmd160,coin->smartaddr); LP_privkeyadd(privkey,G.LP_myrmd160); + G.LP_privkey = privkey; if ( 0 && (coin->pubtype != 60 || strcmp(coin->symbol,"KMD") == 0) ) printf("%s (%s) %d wif.(%s) (%s)\n",coin->symbol,coin->smartaddr,coin->pubtype,tmpstr,passphrase); if ( G.counter++ == 0 ) @@ -763,9 +764,6 @@ bits256 LP_privkeycalc(void *ctx,uint8_t *pubkey33,bits256 *pubkeyp,struct iguan checkkey.bytes[0] &= 248, checkkey.bytes[31] &= 127, checkkey.bytes[31] |= 64; G.LP_mypub25519 = *pubkeyp = curve25519(checkkey,curve25519_basepoint9()); G.LP_mypriv25519 = checkkey; - char str[65],str2[65]; - if ( bits256_cmp(checkkey,privkey) != 0 ) - printf("??????????? privkey mismatch %s vs %s\n",bits256_str(str,privkey),bits256_str(str2,checkkey)); LP_pubkeyadd(G.LP_mypub25519); return(privkey); } @@ -791,7 +789,7 @@ void LP_privkey_updates(void *ctx,int32_t pubsock,char *passphrase) //printf("i.%d of %d\n",i,LP_numcoins); else if ( IAMLP == 0 || coin->inactive == 0 ) { - if ( LP_privkey_init(pubsock,coin,G.LP_mypriv25519,G.LP_mypub25519) == 0 && (rand() % 10) == 0 ) + if ( LP_privkey_init(pubsock,coin,G.LP_privkey,G.LP_mypub25519) == 0 && (rand() % 10) == 0 ) LP_postutxos(coin->symbol,coin->smartaddr); } }