diff --git a/iguana/exchanges/LP_bitcoin.c b/iguana/exchanges/LP_bitcoin.c index 20cc5858f..3874991b7 100644 --- a/iguana/exchanges/LP_bitcoin.c +++ b/iguana/exchanges/LP_bitcoin.c @@ -325,33 +325,6 @@ enum opcodetype OP_INVALIDOPCODE = 0xff, }; -bits256 LP_privkeyfind(uint8_t rmd160[20]) -{ - int32_t i; static bits256 zero; - for (i=0; i no privkey\n"); - return(zero); -} - -int32_t LP_privkeyadd(bits256 privkey,uint8_t rmd160[20]) -{ - bits256 tmpkey; - tmpkey = LP_privkeyfind(rmd160); - if ( bits256_nonz(tmpkey) != 0 ) - return(-bits256_cmp(privkey,tmpkey)); - G.LP_privkeys[G.LP_numprivkeys].privkey = privkey; - memcpy(G.LP_privkeys[G.LP_numprivkeys].rmd160,rmd160,20); - //int32_t i; for (i=0; i<20; i++) - // printf("%02x",rmd160[i]); - //char str[65]; printf(" -> add privkey.(%s)\n",bits256_str(str,privkey)); - G.LP_numprivkeys++; - return(G.LP_numprivkeys); -} - int32_t iguana_rwnum(int32_t rwflag,uint8_t *serialized,int32_t len,void *endianedp) { int32_t i; uint64_t x; @@ -2231,21 +2204,6 @@ int32_t bitcoin_priv2wiflong(uint8_t wiftaddr,char *wifstr,bits256 privkey,uint8 return((int32_t)strlen(wifstr)); } -bits256 LP_privkey(char *coinaddr,uint8_t taddr) -{ - bits256 privkey; uint8_t addrtype,rmd160[20]; - bitcoin_addr2rmd160(taddr,&addrtype,rmd160,coinaddr); - privkey = LP_privkeyfind(rmd160); - return(privkey); -} - -bits256 LP_pubkey(bits256 privkey) -{ - bits256 pubkey; - pubkey = curve25519(privkey,curve25519_basepoint9()); - return(pubkey); -} - char *_setVsigner(uint8_t wiftaddr,uint8_t pubtype,struct vin_info *V,int32_t ind,char *pubstr,char *wifstr) { uint8_t addrtype; diff --git a/iguana/exchanges/LP_nativeDEX.c b/iguana/exchanges/LP_nativeDEX.c index 05bef27d5..bc9f16777 100644 --- a/iguana/exchanges/LP_nativeDEX.c +++ b/iguana/exchanges/LP_nativeDEX.c @@ -19,12 +19,12 @@ // marketmaker // // process stats.log local file -> map of realtime activity! -// serialize sighash functions // select oldest utxo first // handles <-> pubkeys, deal with offline pubkeys, reputations, bonds etc. // // verify portfolio, pricearray, interest to KMD withdraw, reliable networking // dPoW security -> 4: KMD notarized, 5: BTC notarized, after next notary elections +// bigendian architectures need to use little endian for sighash calcs #include #include "LP_include.h" diff --git a/iguana/exchanges/LP_rpc.c b/iguana/exchanges/LP_rpc.c index cec077f1b..4f3084b4e 100644 --- a/iguana/exchanges/LP_rpc.c +++ b/iguana/exchanges/LP_rpc.c @@ -1047,7 +1047,6 @@ int32_t LP_notarization_latest(int32_t *bestheightp,struct iguana_info *coin) blockhash = LP_getbestblockhash(coin); if ( bits256_nonz(blockhash) != 0 ) { - //char str[65]; printf("check %s\n",bits256_str(str,blockhash)); if ( (blockjson= LP_getblock(coin->symbol,blockhash)) != 0 ) { if ( *bestheightp < 0 ) @@ -1055,7 +1054,7 @@ int32_t LP_notarization_latest(int32_t *bestheightp,struct iguana_info *coin) if ( (hasnotarization= LP_hasnotarization(coin,blockjson)) > 0 ) { height = jint(blockjson,"height"); - //printf("height.%d\n",height); + //char str[65]; printf("%s height.%d\n",bits256_str(str,blockhash),height); } else { diff --git a/iguana/exchanges/LP_transaction.c b/iguana/exchanges/LP_transaction.c index 8ecad59c7..b72cb111a 100644 --- a/iguana/exchanges/LP_transaction.c +++ b/iguana/exchanges/LP_transaction.c @@ -18,6 +18,47 @@ // LP_transaction.c // marketmaker // +bits256 LP_privkeyfind(uint8_t rmd160[20]) +{ + int32_t i; static bits256 zero; + for (i=0; i no privkey\n"); + return(zero); +} + +int32_t LP_privkeyadd(bits256 privkey,uint8_t rmd160[20]) +{ + bits256 tmpkey; + tmpkey = LP_privkeyfind(rmd160); + if ( bits256_nonz(tmpkey) != 0 ) + return(-bits256_cmp(privkey,tmpkey)); + G.LP_privkeys[G.LP_numprivkeys].privkey = privkey; + memcpy(G.LP_privkeys[G.LP_numprivkeys].rmd160,rmd160,20); + //int32_t i; for (i=0; i<20; i++) + // printf("%02x",rmd160[i]); + //char str[65]; printf(" -> add privkey.(%s)\n",bits256_str(str,privkey)); + G.LP_numprivkeys++; + return(G.LP_numprivkeys); +} + +bits256 LP_privkey(char *coinaddr,uint8_t taddr) +{ + bits256 privkey; uint8_t addrtype,rmd160[20]; + bitcoin_addr2rmd160(taddr,&addrtype,rmd160,coinaddr); + privkey = LP_privkeyfind(rmd160); + return(privkey); +} + +bits256 LP_pubkey(bits256 privkey) +{ + bits256 pubkey; + pubkey = curve25519(privkey,curve25519_basepoint9()); + return(pubkey); +} int32_t LP_gettx_presence(char *symbol,bits256 expectedtxid) { diff --git a/iguana/exchanges/LP_utxos.c b/iguana/exchanges/LP_utxos.c index 565cfdda2..54b5aec3a 100644 --- a/iguana/exchanges/LP_utxos.c +++ b/iguana/exchanges/LP_utxos.c @@ -18,6 +18,9 @@ // marketmaker // + + + int32_t LP_ismine(struct LP_utxoinfo *utxo) { if ( utxo != 0 && bits256_cmp(utxo->pubkey,G.LP_mypub25519) == 0 )