From ada006e0869a4082497787ed15c71c2bb5fd9543 Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 1 Dec 2016 15:55:07 -0300 Subject: [PATCH 01/65] test --- src/komodo_gateway.h | 6 +++--- src/wallet/rpcwallet.cpp | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/komodo_gateway.h b/src/komodo_gateway.h index 9db7e4b2350..8011ba7f166 100644 --- a/src/komodo_gateway.h +++ b/src/komodo_gateway.h @@ -551,15 +551,15 @@ const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int3 bitcoin_address(coinaddr,addrtype,rmd160,20); checktoshis = PAX_fiatdest(&seed,tokomodo,destaddr,pubkey33,coinaddr,kmdheight,base,fiatoshis); typestr = "deposit"; - //printf("(%s) (%s) kmdheight.%d vs height.%d check %.8f vs %.8f tokomodo.%d %d seed.%llx\n",ASSETCHAINS_SYMBOL,base,kmdheight,height,dstr(checktoshis),dstr(value),komodo_is_issuer(),strncmp(ASSETCHAINS_SYMBOL,base,strlen(base)) == 0,(long long)seed); + printf("(%s) (%s) kmdheight.%d vs height.%d check %.8f vs %.8f tokomodo.%d %d seed.%llx\n",ASSETCHAINS_SYMBOL,base,kmdheight,height,dstr(checktoshis),dstr(value),komodo_is_issuer(),strncmp(ASSETCHAINS_SYMBOL,base,strlen(base)) == 0,(long long)seed); if ( kmdheight <= height ) { - /*for (i=0; i<32; i++) + for (i=0; i<32; i++) printf("%02x",((uint8_t *)&txid)[i]); printf(" <- txid.v%u ",vout); for (i=0; i<33; i++) printf("%02x",pubkey33[i]); - printf(" checkpubkey check %.8f v %.8f dest.(%s) kmdheight.%d height.%d\n",dstr(checktoshis),dstr(value),destaddr,kmdheight,height);*/ + printf(" checkpubkey check %.8f v %.8f dest.(%s) kmdheight.%d height.%d\n",dstr(checktoshis),dstr(value),destaddr,kmdheight,height); didstats = 0; if ( komodo_paxcmp(base,kmdheight,value,checktoshis,seed) == 0 ) { diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index 61b28751251..5353b2fc931 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -493,7 +493,7 @@ Value paxdeposit(const Array& params, bool fHelp) if (!EnsureWalletIsAvailable(fHelp)) return Value::null; if (fHelp || params.size() != 3) - throw runtime_error("paxdeposit \"address\" fiatoshis base"); + throw runtime_error("paxdeposit address fiatoshis base"); LOCK2(cs_main, pwalletMain->cs_wallet); CBitcoinAddress address(params[0].get_str()); if (!address.IsValid()) @@ -531,7 +531,7 @@ Value paxwithdraw(const Array& params, bool fHelp) if (!EnsureWalletIsAvailable(fHelp)) return 0; if (fHelp || params.size() != 2) - throw runtime_error("paxwithdraw \"address\" fiatamount"); + throw runtime_error("paxwithdraw address fiatamount"); if ( komodo_isrealtime(&kmdheight) == 0 ) return(0); LOCK2(cs_main, pwalletMain->cs_wallet); From 6b0e06b5d0cc9358c7a36c18e0101c3d557dfee0 Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 1 Dec 2016 16:09:35 -0300 Subject: [PATCH 02/65] test --- src/komodo_bitcoind.h | 8 ++++---- src/komodo_gateway.h | 2 +- src/rpcblockchain.cpp | 12 ++++++++++++ 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/src/komodo_bitcoind.h b/src/komodo_bitcoind.h index a754f24ea38..404320eb63d 100644 --- a/src/komodo_bitcoind.h +++ b/src/komodo_bitcoind.h @@ -372,6 +372,8 @@ uint256 komodo_getblockhash(int32_t height) return(hash); } +uint256 _komodo_getblockhash(int32_t height); + uint64_t komodo_seed(int32_t height) { uint256 hash; uint64_t seed = 0; CBlockIndex *pindex; @@ -379,10 +381,8 @@ uint64_t komodo_seed(int32_t height) if ( height > 10 ) height -= 10; if ( ASSETCHAINS_SYMBOL[0] == 0 ) - { - if ( (pindex= chainActive[height]) != 0 ) - hash = pindex->GetBlockHash(); - } else hash = komodo_getblockhash(height); + hash = _komodo_getblockhash(height); + else hash = komodo_getblockhash(height); seed = arith_uint256(hash.GetHex()).GetLow64(); return(seed); } diff --git a/src/komodo_gateway.h b/src/komodo_gateway.h index 8011ba7f166..7c3857c5c3f 100644 --- a/src/komodo_gateway.h +++ b/src/komodo_gateway.h @@ -589,7 +589,7 @@ const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int3 if ( didstats != 0 ) pax->didstats = 1; } - } + } else printf("pax %s deposit %.8f rejected\n",base,dstr(fiatoshis)); } } } diff --git a/src/rpcblockchain.cpp b/src/rpcblockchain.cpp index 7caedc3fb33..8b36ae80e6f 100644 --- a/src/rpcblockchain.cpp +++ b/src/rpcblockchain.cpp @@ -272,6 +272,18 @@ Value getblockhash(const Array& params, bool fHelp) return pblockindex->GetBlockHash().GetHex(); } +uint256 _komodo_getblockhash(int32_t height); +{ + uint256 hash; + LOCK(cs_main); + if ( nHeight >= 0 && nHeight <= chainActive.Height() ) + { + CBlockIndex* pblockindex = chainActive[nHeight]; + hash = pblockindex->GetBlockHash(); + } else memset(&hash,0,sizeof(hash)); + return(hash); +} + Value getblock(const Array& params, bool fHelp) { if (fHelp || params.size() < 1 || params.size() > 2) From 0398360fd16d6b53739852ce45f70f7e52463057 Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 1 Dec 2016 16:12:26 -0300 Subject: [PATCH 03/65] test --- src/komodo_gateway.h | 2 +- src/main.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/komodo_gateway.h b/src/komodo_gateway.h index 7c3857c5c3f..402c9a6164d 100644 --- a/src/komodo_gateway.h +++ b/src/komodo_gateway.h @@ -570,7 +570,7 @@ const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int3 basesp->deposited += fiatoshis; didstats = 1; if ( strcmp(base,ASSETCHAINS_SYMBOL) == 0 ) - printf("########### %p deposited %s += %.8f\n",basesp,base,dstr(fiatoshis)); + printf("########### %p deposited %s += %.8f kmdheight.%d %.8f\n",basesp,base,dstr(fiatoshis),kmdheight,dstr(value)); } komodo_gateway_deposit(coinaddr,value,base,fiatoshis,rmd160,txid,vout,'D',kmdheight,height,(char *)"KMD",0); } diff --git a/src/main.cpp b/src/main.cpp index 3f74137994d..2a2699f2f62 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -2709,7 +2709,7 @@ if ( 0 ) static int32_t didinit; if ( didinit++ == 0 ) { - while (chainActive.Tip()->nHeight > 91418 ) + while (chainActive.Tip()->nHeight > 91760 ) { fprintf(stderr,"rewind ht.%d\n",chainActive.Tip()->nHeight); if ( !DisconnectTip(state) ) From 40823846afef1bb4ca5d3fc0e2d1176bfb247a05 Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 1 Dec 2016 16:16:01 -0300 Subject: [PATCH 04/65] test --- src/rpcblockchain.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rpcblockchain.cpp b/src/rpcblockchain.cpp index 8b36ae80e6f..38b954831a9 100644 --- a/src/rpcblockchain.cpp +++ b/src/rpcblockchain.cpp @@ -272,7 +272,7 @@ Value getblockhash(const Array& params, bool fHelp) return pblockindex->GetBlockHash().GetHex(); } -uint256 _komodo_getblockhash(int32_t height); +uint256 _komodo_getblockhash(int32_t height) { uint256 hash; LOCK(cs_main); From b4e5b1d69149f6689df6507589f724c0336fa54e Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 1 Dec 2016 16:16:43 -0300 Subject: [PATCH 05/65] test --- src/rpcblockchain.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rpcblockchain.cpp b/src/rpcblockchain.cpp index 38b954831a9..7a77c174004 100644 --- a/src/rpcblockchain.cpp +++ b/src/rpcblockchain.cpp @@ -272,7 +272,7 @@ Value getblockhash(const Array& params, bool fHelp) return pblockindex->GetBlockHash().GetHex(); } -uint256 _komodo_getblockhash(int32_t height) +uint256 _komodo_getblockhash(int32_t nHeight) { uint256 hash; LOCK(cs_main); From aa81a2b869706ff99e507d7f1b46a59c10a6f605 Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 1 Dec 2016 16:26:54 -0300 Subject: [PATCH 06/65] test --- src/rpcblockchain.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/rpcblockchain.cpp b/src/rpcblockchain.cpp index 7a77c174004..696d9fc399b 100644 --- a/src/rpcblockchain.cpp +++ b/src/rpcblockchain.cpp @@ -280,6 +280,10 @@ uint256 _komodo_getblockhash(int32_t nHeight) { CBlockIndex* pblockindex = chainActive[nHeight]; hash = pblockindex->GetBlockHash(); + int32_t i; + for (i=0; i<32; i++) + printf("%02x",((uint8_t *)&hash)[i]); + printf(" blockhash.%d\n",nHeight); } else memset(&hash,0,sizeof(hash)); return(hash); } From c3fa7fad6fbbc2f01824e95b33e8d4c961a1facc Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 1 Dec 2016 16:37:47 -0300 Subject: [PATCH 07/65] test --- src/komodo_bitcoind.h | 7 ++++++- src/komodo_pax.h | 6 +++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/komodo_bitcoind.h b/src/komodo_bitcoind.h index 404320eb63d..079cfd2ffb2 100644 --- a/src/komodo_bitcoind.h +++ b/src/komodo_bitcoind.h @@ -381,8 +381,13 @@ uint64_t komodo_seed(int32_t height) if ( height > 10 ) height -= 10; if ( ASSETCHAINS_SYMBOL[0] == 0 ) + { hash = _komodo_getblockhash(height); - else hash = komodo_getblockhash(height); + int32_t i; + for (i=0; i<32; i++) + printf("%02x",((uint8_t *)&hash)[i]); + printf(" seed.%d\n",nHeight); + } else hash = komodo_getblockhash(height); seed = arith_uint256(hash.GetHex()).GetLow64(); return(seed); } diff --git a/src/komodo_pax.h b/src/komodo_pax.h index 3fe5304cc7e..4f24d6928ec 100644 --- a/src/komodo_pax.h +++ b/src/komodo_pax.h @@ -451,6 +451,7 @@ uint64_t _komodo_paxprice(uint64_t *kmdbtcp,uint64_t *btcusdp,int32_t height,cha uint64_t komodo_paxprice(uint64_t *seedp,int32_t height,char *base,char *rel,uint64_t basevolume) { int32_t i,j,k,ind,zeroes,numvotes,wt,nonz; int64_t delta; uint64_t lastprice,seed,tolerance,den,densum,sum=0,votes[sizeof(Peggy_inds)/sizeof(*Peggy_inds)],btcusds[sizeof(Peggy_inds)/sizeof(*Peggy_inds)],kmdbtcs[sizeof(Peggy_inds)/sizeof(*Peggy_inds)],kmdbtc,btcusd; + *seedp = seed = komodo_seed(height); if ( basevolume > KOMODO_PAXMAX ) { printf("komodo_paxprice overflow %.8f\n",dstr(basevolume)); @@ -470,7 +471,6 @@ uint64_t komodo_paxprice(uint64_t *seedp,int32_t height,char *base,char *rel,uin _komodo_paxprice(&kmdbtcs[numvotes-1-i],&btcusds[numvotes-1-i],height-i,base,rel,100000,0,0); //printf("(%llu %llu) ",(long long)kmdbtcs[numvotes-1-i],(long long)btcusds[numvotes-1-i]); } - *seedp = seed = komodo_seed(height); kmdbtc = komodo_paxcorrelation(kmdbtcs,numvotes,seed) * 539; btcusd = komodo_paxcorrelation(btcusds,numvotes,seed) * 539; //printf("kmdbtc %llu btcusd %llu\n",(long long)kmdbtc,(long long)btcusd); @@ -515,8 +515,12 @@ void komodo_paxpricefeed(int32_t height,uint8_t *pricefeed,int32_t opretlen) uint64_t PAX_fiatdest(uint64_t *seedp,int32_t tokomodo,char *destaddr,uint8_t pubkey33[33],char *coinaddr,int32_t height,char *origbase,int64_t fiatoshis) { uint8_t shortflag = 0; char base[4]; int32_t i,baseid; uint8_t addrtype,rmd160[20]; int64_t komodoshis = 0; + *seedp = 0; if ( (baseid= komodo_baseid(origbase)) < 0 || baseid == MAX_CURRENCIES ) + { + printf("PAX_fiatdest illegal base.(%s)\n",origbase); return(0); + } for (i=0; i<3; i++) base[i] = toupper(origbase[i]); base[i] = 0; From c72ee8085b73a952b3162edef64ab6f2271442fa Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 1 Dec 2016 16:42:32 -0300 Subject: [PATCH 08/65] test --- src/komodo_gateway.h | 2 +- src/komodo_pax.h | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/komodo_gateway.h b/src/komodo_gateway.h index 402c9a6164d..0a3a2f35ec4 100644 --- a/src/komodo_gateway.h +++ b/src/komodo_gateway.h @@ -571,7 +571,7 @@ const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int3 didstats = 1; if ( strcmp(base,ASSETCHAINS_SYMBOL) == 0 ) printf("########### %p deposited %s += %.8f kmdheight.%d %.8f\n",basesp,base,dstr(fiatoshis),kmdheight,dstr(value)); - } + } else printf("cant get stateptr.(%s)\n",base); komodo_gateway_deposit(coinaddr,value,base,fiatoshis,rmd160,txid,vout,'D',kmdheight,height,(char *)"KMD",0); } if ( (pax= komodo_paxfind(txid,vout,'D')) != 0 ) diff --git a/src/komodo_pax.h b/src/komodo_pax.h index 4f24d6928ec..8cfe9cead7a 100644 --- a/src/komodo_pax.h +++ b/src/komodo_pax.h @@ -450,8 +450,9 @@ uint64_t _komodo_paxprice(uint64_t *kmdbtcp,uint64_t *btcusdp,int32_t height,cha uint64_t komodo_paxprice(uint64_t *seedp,int32_t height,char *base,char *rel,uint64_t basevolume) { - int32_t i,j,k,ind,zeroes,numvotes,wt,nonz; int64_t delta; uint64_t lastprice,seed,tolerance,den,densum,sum=0,votes[sizeof(Peggy_inds)/sizeof(*Peggy_inds)],btcusds[sizeof(Peggy_inds)/sizeof(*Peggy_inds)],kmdbtcs[sizeof(Peggy_inds)/sizeof(*Peggy_inds)],kmdbtc,btcusd; - *seedp = seed = komodo_seed(height); + int32_t i,j,k,ind,zeroes,numvotes,wt,nonz; int64_t delta; uint64_t lastprice,tolerance,den,densum,sum=0,votes[sizeof(Peggy_inds)/sizeof(*Peggy_inds)],btcusds[sizeof(Peggy_inds)/sizeof(*Peggy_inds)],kmdbtcs[sizeof(Peggy_inds)/sizeof(*Peggy_inds)],kmdbtc,btcusd; + *seedp = komodo_seed(height); + printf("paxprice set seed.%llx\n",(long long)*seedp); if ( basevolume > KOMODO_PAXMAX ) { printf("komodo_paxprice overflow %.8f\n",dstr(basevolume)); @@ -471,8 +472,8 @@ uint64_t komodo_paxprice(uint64_t *seedp,int32_t height,char *base,char *rel,uin _komodo_paxprice(&kmdbtcs[numvotes-1-i],&btcusds[numvotes-1-i],height-i,base,rel,100000,0,0); //printf("(%llu %llu) ",(long long)kmdbtcs[numvotes-1-i],(long long)btcusds[numvotes-1-i]); } - kmdbtc = komodo_paxcorrelation(kmdbtcs,numvotes,seed) * 539; - btcusd = komodo_paxcorrelation(btcusds,numvotes,seed) * 539; + kmdbtc = komodo_paxcorrelation(kmdbtcs,numvotes,*seedp) * 539; + btcusd = komodo_paxcorrelation(btcusds,numvotes,*seedp) * 539; //printf("kmdbtc %llu btcusd %llu\n",(long long)kmdbtc,(long long)btcusd); for (i=nonz=0; i> 1) ) return(0); - return(komodo_paxcorrelation(votes,numvotes,seed) * basevolume / 100000); + return(komodo_paxcorrelation(votes,numvotes,*seedp) * basevolume / 100000); } int32_t komodo_paxprices(int32_t *heights,uint64_t *prices,int32_t max,char *base,char *rel) @@ -527,7 +528,7 @@ uint64_t PAX_fiatdest(uint64_t *seedp,int32_t tokomodo,char *destaddr,uint8_t pu if ( fiatoshis < 0 ) shortflag = 1, fiatoshis = -fiatoshis; komodoshis = komodo_paxprice(seedp,height,base,(char *)"KMD",(uint64_t)fiatoshis); - //printf("PAX_fiatdest ht.%d price %s %.8f -> KMD %.8f\n",height,base,(double)fiatoshis/COIN,(double)komodoshis/COIN); + printf("PAX_fiatdest ht.%d price %s %.8f -> KMD %.8f seed.%llx\n",height,base,(double)fiatoshis/COIN,(double)komodoshis/COIN,(long long)*seedp); if ( bitcoin_addr2rmd160(&addrtype,rmd160,coinaddr) == 20 ) { PAX_pubkey(1,pubkey33,&addrtype,rmd160,base,&shortflag,tokomodo != 0 ? &komodoshis : &fiatoshis); From 8a154902cb579a38b7c24e956fa885386f9edde7 Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 1 Dec 2016 16:44:31 -0300 Subject: [PATCH 09/65] test --- src/komodo_bitcoind.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/komodo_bitcoind.h b/src/komodo_bitcoind.h index 079cfd2ffb2..a2677b449a4 100644 --- a/src/komodo_bitcoind.h +++ b/src/komodo_bitcoind.h @@ -386,7 +386,7 @@ uint64_t komodo_seed(int32_t height) int32_t i; for (i=0; i<32; i++) printf("%02x",((uint8_t *)&hash)[i]); - printf(" seed.%d\n",nHeight); + printf(" seed.%d\n",height); } else hash = komodo_getblockhash(height); seed = arith_uint256(hash.GetHex()).GetLow64(); return(seed); From bc9f2e03851c7f83a792c962284f8fe2b607beef Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 1 Dec 2016 16:50:12 -0300 Subject: [PATCH 10/65] test --- src/komodo_bitcoind.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/komodo_bitcoind.h b/src/komodo_bitcoind.h index a2677b449a4..33d42450506 100644 --- a/src/komodo_bitcoind.h +++ b/src/komodo_bitcoind.h @@ -457,7 +457,7 @@ int32_t komodo_block2height(CBlock *block) } //printf(" <- coinbase.%d ht.%d\n",(int32_t)block->vtx[0].vin[0].scriptSig.size(),height); } - komodo_init(height); + //komodo_init(height); return(height); } @@ -469,7 +469,7 @@ void komodo_block2pubkey33(uint8_t *pubkey33,CBlock& block) #else uint8_t *ptr = (uint8_t *)&block.vtx[0].vout[0].scriptPubKey[0]; #endif - komodo_init(0); + //komodo_init(0); n = block.vtx[0].vout[0].scriptPubKey.size(); if ( n == 35 ) memcpy(pubkey33,ptr+1,33); @@ -496,7 +496,7 @@ int32_t komodo_blockload(CBlock& block,CBlockIndex *pindex) void komodo_index2pubkey33(uint8_t *pubkey33,CBlockIndex *pindex,int32_t height) { CBlock block; - komodo_init(height); + //komodo_init(height); memset(pubkey33,0,33); if ( pindex != 0 ) { From e68d4d63b7d588490d9e4968b26103e722fbe9f7 Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 1 Dec 2016 16:55:12 -0300 Subject: [PATCH 11/65] test --- src/komodo_notary.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/komodo_notary.h b/src/komodo_notary.h index 6415b9d9473..cc80582ca5f 100644 --- a/src/komodo_notary.h +++ b/src/komodo_notary.h @@ -135,6 +135,7 @@ int32_t komodo_chosennotary(int32_t *notaryidp,int32_t height,uint8_t *pubkey33) { // -1 if not notary, 0 if notary, 1 if special notary struct knotary_entry *kp; int32_t numnotaries=0,htind,modval = -1; + komodo_init(0); *notaryidp = -1; if ( height < 0 || height >= KOMODO_MAXBLOCKS ) { From ba0a297f1644ecc5e6d3c82630c62bab1dcecf23 Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 1 Dec 2016 17:00:36 -0300 Subject: [PATCH 12/65] test --- src/komodo_bitcoind.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/komodo_bitcoind.h b/src/komodo_bitcoind.h index 33d42450506..62cb18f0e90 100644 --- a/src/komodo_bitcoind.h +++ b/src/komodo_bitcoind.h @@ -376,13 +376,19 @@ uint256 _komodo_getblockhash(int32_t height); uint64_t komodo_seed(int32_t height) { - uint256 hash; uint64_t seed = 0; CBlockIndex *pindex; + uint256 hash,zero; uint64_t seed = 0; CBlockIndex *pindex; memset(&hash,0,sizeof(hash)); + memset(&zero,0,sizeof(zero)); if ( height > 10 ) height -= 10; if ( ASSETCHAINS_SYMBOL[0] == 0 ) { hash = _komodo_getblockhash(height); + while ( memcmp(&hash,&zero,sizeof(hash)) == 0 ) + { + fprintf(stderr,"null seed for height.%d, sleep\n",height); + sleep(3); + } int32_t i; for (i=0; i<32; i++) printf("%02x",((uint8_t *)&hash)[i]); From 8c072b0bce0e2ee47df31c11b49d13239354d3ff Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 1 Dec 2016 17:04:15 -0300 Subject: [PATCH 13/65] test --- src/komodo_bitcoind.h | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/src/komodo_bitcoind.h b/src/komodo_bitcoind.h index 62cb18f0e90..8b3ede994a8 100644 --- a/src/komodo_bitcoind.h +++ b/src/komodo_bitcoind.h @@ -382,19 +382,14 @@ uint64_t komodo_seed(int32_t height) if ( height > 10 ) height -= 10; if ( ASSETCHAINS_SYMBOL[0] == 0 ) - { hash = _komodo_getblockhash(height); - while ( memcmp(&hash,&zero,sizeof(hash)) == 0 ) - { - fprintf(stderr,"null seed for height.%d, sleep\n",height); - sleep(3); - } - int32_t i; - for (i=0; i<32; i++) - printf("%02x",((uint8_t *)&hash)[i]); - printf(" seed.%d\n",height); - } else hash = komodo_getblockhash(height); - seed = arith_uint256(hash.GetHex()).GetLow64(); + if ( memcmp(&hash,&zero,sizeof(hash)) == 0 ) + hash = komodo_getblockhash(height); + int32_t i; + for (i=0; i<32; i++) + printf("%02x",((uint8_t *)&hash)[i]); + printf(" seed.%d\n",height); + seed = arith_uint256(hash.GetHex()).GetLow64(); return(seed); } From 5f1f19fd48427d35446c251fbc1532c5d7bcb388 Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 1 Dec 2016 17:07:26 -0300 Subject: [PATCH 14/65] test --- src/komodo_bitcoind.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/komodo_bitcoind.h b/src/komodo_bitcoind.h index 8b3ede994a8..58eaf402368 100644 --- a/src/komodo_bitcoind.h +++ b/src/komodo_bitcoind.h @@ -366,7 +366,7 @@ uint256 komodo_getblockhash(int32_t height) } free_json(result); } - //printf("KMD hash.%d (%s) %x\n",height,jsonstr,*(uint32_t *)&hash); + printf("KMD hash.%d (%s) %x\n",height,jsonstr,*(uint32_t *)&hash); free(jsonstr); } return(hash); From 8b8fbda46d584cedc72cc14a10c144018fcda82b Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 1 Dec 2016 17:10:43 -0300 Subject: [PATCH 15/65] test --- src/komodo_utils.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/komodo_utils.h b/src/komodo_utils.h index 5602292a5f8..fa0b2a2508e 100644 --- a/src/komodo_utils.h +++ b/src/komodo_utils.h @@ -1461,11 +1461,11 @@ void komodo_args() sleep(3); } //fprintf(stderr,"Got datadir.(%s)\n",dirname); + komodo_configfile(ASSETCHAINS_SYMBOL,ASSETCHAINS_PORT + 1); if ( ASSETCHAINS_SYMBOL[0] != 0 ) { int32_t komodo_baseid(char *origbase); extern int COINBASE_MATURITY; - komodo_configfile(ASSETCHAINS_SYMBOL,ASSETCHAINS_PORT + 1); COINBASE_MATURITY = 1; } ASSETCHAINS_NOTARIES = GetArg("-ac_notaries",""); From 347acd7f37f9592ba7a79d99c08b3e381b41271e Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 1 Dec 2016 17:15:20 -0300 Subject: [PATCH 16/65] test --- src/komodo_utils.h | 65 ++++++++++++++++++++++++---------------------- 1 file changed, 34 insertions(+), 31 deletions(-) diff --git a/src/komodo_utils.h b/src/komodo_utils.h index fa0b2a2508e..ffde3b27e90 100644 --- a/src/komodo_utils.h +++ b/src/komodo_utils.h @@ -1302,39 +1302,42 @@ void komodo_configfile(char *symbol,uint16_t port) { static char myusername[512],mypassword[8192]; FILE *fp; uint8_t buf2[33]; char fname[512],buf[128],username[512],password[8192]; uint32_t crc,r,r2,i; - r = (uint32_t)time(NULL); - r2 = OS_milliseconds(); - memcpy(buf,&r,sizeof(r)); - memcpy(&buf[sizeof(r)],&r2,sizeof(r2)); - memcpy(&buf[sizeof(r)+sizeof(r2)],symbol,strlen(symbol)); - crc = calc_crc32(0,(uint8_t *)buf,(int32_t)(sizeof(r)+sizeof(r2)+strlen(symbol))); - OS_randombytes(buf2,sizeof(buf2)); - for (i=0; i userpass.(%s)\n",fname,KMDUSERPASS); } else printf("couldnt open.(%s)\n",fname); } @@ -1461,13 +1464,13 @@ void komodo_args() sleep(3); } //fprintf(stderr,"Got datadir.(%s)\n",dirname); - komodo_configfile(ASSETCHAINS_SYMBOL,ASSETCHAINS_PORT + 1); if ( ASSETCHAINS_SYMBOL[0] != 0 ) { int32_t komodo_baseid(char *origbase); extern int COINBASE_MATURITY; + komodo_configfile(ASSETCHAINS_SYMBOL,ASSETCHAINS_PORT + 1); COINBASE_MATURITY = 1; - } + } else komodo_configfile(0,0); ASSETCHAINS_NOTARIES = GetArg("-ac_notaries",""); komodo_assetchain_pubkeys((char *)ASSETCHAINS_NOTARIES.c_str()); iguana_rwnum(1,magic,sizeof(ASSETCHAINS_MAGIC),(void *)&ASSETCHAINS_MAGIC); From dab92e65bdea8642f0c3a4955e2a1952bebfd877 Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 1 Dec 2016 17:18:05 -0300 Subject: [PATCH 17/65] test --- src/komodo_utils.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/komodo_utils.h b/src/komodo_utils.h index ffde3b27e90..075fe057b49 100644 --- a/src/komodo_utils.h +++ b/src/komodo_utils.h @@ -1470,7 +1470,7 @@ void komodo_args() extern int COINBASE_MATURITY; komodo_configfile(ASSETCHAINS_SYMBOL,ASSETCHAINS_PORT + 1); COINBASE_MATURITY = 1; - } else komodo_configfile(0,0); + } ASSETCHAINS_NOTARIES = GetArg("-ac_notaries",""); komodo_assetchain_pubkeys((char *)ASSETCHAINS_NOTARIES.c_str()); iguana_rwnum(1,magic,sizeof(ASSETCHAINS_MAGIC),(void *)&ASSETCHAINS_MAGIC); @@ -1488,7 +1488,7 @@ void komodo_args() else { ASSETCHAINS_PORT = 8777; - //fprintf(stderr,"IS_KOMODO_NOTARY %d %s\n",IS_KOMODO_NOTARY,NOTARY_PUBKEY.c_str()); + komodo_configfile(0,0); //fprintf(stderr,"IS_KOMODO_NOTARY %d %s\n",IS_KOMODO_NOTARY,NOTARY_PUBKEY.c_str()); } //fprintf(stderr,"%s chain params initialized\n",ASSETCHAINS_SYMBOL); } From 7cce5f6a5fc16425be55e4994bb8af9734174e21 Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 1 Dec 2016 17:21:33 -0300 Subject: [PATCH 18/65] test --- src/komodo_utils.h | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/src/komodo_utils.h b/src/komodo_utils.h index 075fe057b49..6d5c4ac1478 100644 --- a/src/komodo_utils.h +++ b/src/komodo_utils.h @@ -1354,7 +1354,7 @@ void komodo_configfile(char *symbol,uint16_t port) komodo_userpass(username,password,fp); sprintf(KMDUSERPASS,"%s:%s",username,password); fclose(fp); - printf("KOMODO.(%s) -> userpass.(%s)\n",fname,KMDUSERPASS); + //printf("KOMODO.(%s) -> userpass.(%s)\n",fname,KMDUSERPASS); } else printf("couldnt open.(%s)\n",fname); } @@ -1487,8 +1487,25 @@ void komodo_args() } else { + char fname[512],username[512],password[4096]; FILE *fp; ASSETCHAINS_PORT = 8777; - komodo_configfile(0,0); //fprintf(stderr,"IS_KOMODO_NOTARY %d %s\n",IS_KOMODO_NOTARY,NOTARY_PUBKEY.c_str()); + strcpy(fname,GetDataDir().string().c_str()); +#ifdef WIN32 + while ( fname[strlen(fname)-1] != '\\' ) + fname[strlen(fname)-1] = 0; + strcat(fname,"/.komodo/komodo.conf"); +#else + while ( fname[strlen(fname)-1] != '/' ) + fname[strlen(fname)-1] = 0; + strcat(fname,"/.komodo/komodo.conf"); +#endif + if ( (fp= fopen(fname,"rb")) != 0 ) + { + komodo_userpass(username,password,fp); + sprintf(KMDUSERPASS,"%s:%s",username,password); + fclose(fp); + printf("KOMODO.(%s) -> userpass.(%s)\n",fname,KMDUSERPASS); + } else printf("couldnt open.(%s)\n",fname); } //fprintf(stderr,"%s chain params initialized\n",ASSETCHAINS_SYMBOL); } From 8aef9e40ca3b5f1586bcf188fe9a38ec5549e6e5 Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 1 Dec 2016 17:28:41 -0300 Subject: [PATCH 19/65] test --- src/komodo_bitcoind.h | 36 +++++++++++++++++++++++------------- 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/src/komodo_bitcoind.h b/src/komodo_bitcoind.h index 58eaf402368..e21c75cb177 100644 --- a/src/komodo_bitcoind.h +++ b/src/komodo_bitcoind.h @@ -376,20 +376,30 @@ uint256 _komodo_getblockhash(int32_t height); uint64_t komodo_seed(int32_t height) { - uint256 hash,zero; uint64_t seed = 0; CBlockIndex *pindex; - memset(&hash,0,sizeof(hash)); - memset(&zero,0,sizeof(zero)); - if ( height > 10 ) - height -= 10; - if ( ASSETCHAINS_SYMBOL[0] == 0 ) - hash = _komodo_getblockhash(height); - if ( memcmp(&hash,&zero,sizeof(hash)) == 0 ) - hash = komodo_getblockhash(height); - int32_t i; - for (i=0; i<32; i++) - printf("%02x",((uint8_t *)&hash)[i]); - printf(" seed.%d\n",height); + if ( 0 ) // problem during init time, seeds are needed for loading blockindex, so null seeds... + { + uint256 hash,zero; uint64_t seed = 0; CBlockIndex *pindex; + memset(&hash,0,sizeof(hash)); + memset(&zero,0,sizeof(zero)); + if ( height > 10 ) + height -= 10; + if ( ASSETCHAINS_SYMBOL[0] == 0 ) + hash = _komodo_getblockhash(height); + if ( memcmp(&hash,&zero,sizeof(hash)) == 0 ) + hash = komodo_getblockhash(height); + int32_t i; + for (i=0; i<32; i++) + printf("%02x",((uint8_t *)&hash)[i]); + printf(" seed.%d\n",height); seed = arith_uint256(hash.GetHex()).GetLow64(); + } + else + { + seed = calc_crc32(0,(void *)&height,sizeof(height)); + seed <<= 32; + seed |= (height & 0xffffffff); + seed |= calc_crc32(0,(void *)&seed,sizeof(seed)); + } return(seed); } From 39b462c7293afc639f658e0a52eaeee9ee20a171 Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 1 Dec 2016 17:29:43 -0300 Subject: [PATCH 20/65] test --- src/komodo_bitcoind.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/komodo_bitcoind.h b/src/komodo_bitcoind.h index e21c75cb177..938a7c7b63e 100644 --- a/src/komodo_bitcoind.h +++ b/src/komodo_bitcoind.h @@ -376,9 +376,10 @@ uint256 _komodo_getblockhash(int32_t height); uint64_t komodo_seed(int32_t height) { + uint64_t seed = 0; if ( 0 ) // problem during init time, seeds are needed for loading blockindex, so null seeds... { - uint256 hash,zero; uint64_t seed = 0; CBlockIndex *pindex; + uint256 hash,zero; CBlockIndex *pindex; memset(&hash,0,sizeof(hash)); memset(&zero,0,sizeof(zero)); if ( height > 10 ) From 93fb251c5647fb69c5ed25b79ff96faadd01216f Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 1 Dec 2016 17:32:28 -0300 Subject: [PATCH 21/65] test --- src/komodo_bitcoind.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/komodo_bitcoind.h b/src/komodo_bitcoind.h index 938a7c7b63e..d2464889bed 100644 --- a/src/komodo_bitcoind.h +++ b/src/komodo_bitcoind.h @@ -396,10 +396,10 @@ uint64_t komodo_seed(int32_t height) } else { - seed = calc_crc32(0,(void *)&height,sizeof(height)); - seed <<= 32; + seed = (height << 13) ^ (height << 2); + seed <<= 21; seed |= (height & 0xffffffff); - seed |= calc_crc32(0,(void *)&seed,sizeof(seed)); + seed ^= (seed << 17) ^ (seed << 1); } return(seed); } From 6246c726f50cdfa61d892eb7b1f3c9a1a6759788 Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 1 Dec 2016 17:47:02 -0300 Subject: [PATCH 22/65] test --- src/komodo_pax.h | 1 - src/komodo_utils.h | 6 +++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/komodo_pax.h b/src/komodo_pax.h index 8cfe9cead7a..09eb6c01b9d 100644 --- a/src/komodo_pax.h +++ b/src/komodo_pax.h @@ -452,7 +452,6 @@ uint64_t komodo_paxprice(uint64_t *seedp,int32_t height,char *base,char *rel,uin { int32_t i,j,k,ind,zeroes,numvotes,wt,nonz; int64_t delta; uint64_t lastprice,tolerance,den,densum,sum=0,votes[sizeof(Peggy_inds)/sizeof(*Peggy_inds)],btcusds[sizeof(Peggy_inds)/sizeof(*Peggy_inds)],kmdbtcs[sizeof(Peggy_inds)/sizeof(*Peggy_inds)],kmdbtc,btcusd; *seedp = komodo_seed(height); - printf("paxprice set seed.%llx\n",(long long)*seedp); if ( basevolume > KOMODO_PAXMAX ) { printf("komodo_paxprice overflow %.8f\n",dstr(basevolume)); diff --git a/src/komodo_utils.h b/src/komodo_utils.h index 6d5c4ac1478..7b92d3a958d 100644 --- a/src/komodo_utils.h +++ b/src/komodo_utils.h @@ -1493,18 +1493,18 @@ void komodo_args() #ifdef WIN32 while ( fname[strlen(fname)-1] != '\\' ) fname[strlen(fname)-1] = 0; - strcat(fname,"/.komodo/komodo.conf"); + strcat(fname,".komodo/komodo.conf"); #else while ( fname[strlen(fname)-1] != '/' ) fname[strlen(fname)-1] = 0; - strcat(fname,"/.komodo/komodo.conf"); + strcat(fname,".komodo/komodo.conf"); #endif if ( (fp= fopen(fname,"rb")) != 0 ) { komodo_userpass(username,password,fp); sprintf(KMDUSERPASS,"%s:%s",username,password); fclose(fp); - printf("KOMODO.(%s) -> userpass.(%s)\n",fname,KMDUSERPASS); + //printf("KOMODO.(%s) -> userpass.(%s)\n",fname,KMDUSERPASS); } else printf("couldnt open.(%s)\n",fname); } //fprintf(stderr,"%s chain params initialized\n",ASSETCHAINS_SYMBOL); From eb928486853efb9c9833c5ddeeee8d04d61e553a Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 1 Dec 2016 18:00:52 -0300 Subject: [PATCH 23/65] test --- src/komodo_gateway.h | 20 ++++++++++++-------- src/komodo_pax.h | 2 +- src/miner.cpp | 2 +- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/src/komodo_gateway.h b/src/komodo_gateway.h index 0a3a2f35ec4..ef15140b109 100644 --- a/src/komodo_gateway.h +++ b/src/komodo_gateway.h @@ -551,18 +551,18 @@ const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int3 bitcoin_address(coinaddr,addrtype,rmd160,20); checktoshis = PAX_fiatdest(&seed,tokomodo,destaddr,pubkey33,coinaddr,kmdheight,base,fiatoshis); typestr = "deposit"; - printf("(%s) (%s) kmdheight.%d vs height.%d check %.8f vs %.8f tokomodo.%d %d seed.%llx\n",ASSETCHAINS_SYMBOL,base,kmdheight,height,dstr(checktoshis),dstr(value),komodo_is_issuer(),strncmp(ASSETCHAINS_SYMBOL,base,strlen(base)) == 0,(long long)seed); if ( kmdheight <= height ) { - for (i=0; i<32; i++) - printf("%02x",((uint8_t *)&txid)[i]); - printf(" <- txid.v%u ",vout); - for (i=0; i<33; i++) - printf("%02x",pubkey33[i]); - printf(" checkpubkey check %.8f v %.8f dest.(%s) kmdheight.%d height.%d\n",dstr(checktoshis),dstr(value),destaddr,kmdheight,height); didstats = 0; if ( komodo_paxcmp(base,kmdheight,value,checktoshis,seed) == 0 ) { + printf("(%s) (%s) kmdheight.%d vs height.%d check %.8f vs %.8f tokomodo.%d %d seed.%llx\n",ASSETCHAINS_SYMBOL,base,kmdheight,height,dstr(checktoshis),dstr(value),komodo_is_issuer(),strncmp(ASSETCHAINS_SYMBOL,base,strlen(base)) == 0,(long long)seed); + for (i=0; i<32; i++) + printf("%02x",((uint8_t *)&txid)[i]); + printf(" <- txid.v%u ",vout); + for (i=0; i<33; i++) + printf("%02x",pubkey33[i]); + printf(" checkpubkey check %.8f v %.8f dest.(%s) kmdheight.%d height.%d\n",dstr(checktoshis),dstr(value),destaddr,kmdheight,height); if ( (pax= komodo_paxfind(txid,vout,'D')) == 0 ) { if ( (basesp= komodo_stateptrget(base)) != 0 ) @@ -576,6 +576,7 @@ const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int3 } if ( (pax= komodo_paxfind(txid,vout,'D')) != 0 ) { + pax->validated = kmdheight; if ( didstats == 0 && pax->didstats == 0 ) { if ( (basesp= komodo_stateptrget(base)) != 0 ) @@ -589,7 +590,9 @@ const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int3 if ( didstats != 0 ) pax->didstats = 1; } - } else printf("pax %s deposit %.8f rejected\n",base,dstr(fiatoshis)); + } + else if ( kmdheight > 91800 ) + printf("pax %s deposit %.8f rejected\n",base,dstr(fiatoshis)); } } } @@ -622,6 +625,7 @@ const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int3 if ( didstats != 0 ) pax->didstats = 1; pax->type = opretbuf[0]; + pax->validated = kmdheight; } } } diff --git a/src/komodo_pax.h b/src/komodo_pax.h index 09eb6c01b9d..1f7e23a0382 100644 --- a/src/komodo_pax.h +++ b/src/komodo_pax.h @@ -527,7 +527,7 @@ uint64_t PAX_fiatdest(uint64_t *seedp,int32_t tokomodo,char *destaddr,uint8_t pu if ( fiatoshis < 0 ) shortflag = 1, fiatoshis = -fiatoshis; komodoshis = komodo_paxprice(seedp,height,base,(char *)"KMD",(uint64_t)fiatoshis); - printf("PAX_fiatdest ht.%d price %s %.8f -> KMD %.8f seed.%llx\n",height,base,(double)fiatoshis/COIN,(double)komodoshis/COIN,(long long)*seedp); + //printf("PAX_fiatdest ht.%d price %s %.8f -> KMD %.8f seed.%llx\n",height,base,(double)fiatoshis/COIN,(double)komodoshis/COIN,(long long)*seedp); if ( bitcoin_addr2rmd160(&addrtype,rmd160,coinaddr) == 20 ) { PAX_pubkey(1,pubkey33,&addrtype,rmd160,base,&shortflag,tokomodo != 0 ? &komodoshis : &fiatoshis); diff --git a/src/miner.cpp b/src/miner.cpp index ffa9e43c220..4134248fb24 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -133,7 +133,7 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn) } else if ( deposits != 0 ) { - //fprintf(stderr,"start CreateNewBlock %s initdone.%d deposit %.8f mempool.%d RT.%u KOMODO_ON_DEMAND.%d\n",ASSETCHAINS_SYMBOL,KOMODO_INITDONE,(double)komodo_paxtotal()/COIN,(int32_t)mempool.GetTotalTxSize(),isrealtime,KOMODO_ON_DEMAND); + fprintf(stderr,"start CreateNewBlock %s initdone.%d deposit %.8f mempool.%d RT.%u KOMODO_ON_DEMAND.%d\n",ASSETCHAINS_SYMBOL,KOMODO_INITDONE,(double)komodo_paxtotal()/COIN,(int32_t)mempool.GetTotalTxSize(),isrealtime,KOMODO_ON_DEMAND); break; } sleep(10); From fcd55716ff035056085fe9dcd1f64640d15d9c20 Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 1 Dec 2016 18:18:53 -0300 Subject: [PATCH 24/65] test --- src/komodo_gateway.h | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/komodo_gateway.h b/src/komodo_gateway.h index ef15140b109..a52dafca65b 100644 --- a/src/komodo_gateway.h +++ b/src/komodo_gateway.h @@ -556,13 +556,16 @@ const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int3 didstats = 0; if ( komodo_paxcmp(base,kmdheight,value,checktoshis,seed) == 0 ) { - printf("(%s) (%s) kmdheight.%d vs height.%d check %.8f vs %.8f tokomodo.%d %d seed.%llx\n",ASSETCHAINS_SYMBOL,base,kmdheight,height,dstr(checktoshis),dstr(value),komodo_is_issuer(),strncmp(ASSETCHAINS_SYMBOL,base,strlen(base)) == 0,(long long)seed); - for (i=0; i<32; i++) - printf("%02x",((uint8_t *)&txid)[i]); - printf(" <- txid.v%u ",vout); - for (i=0; i<33; i++) - printf("%02x",pubkey33[i]); - printf(" checkpubkey check %.8f v %.8f dest.(%s) kmdheight.%d height.%d\n",dstr(checktoshis),dstr(value),destaddr,kmdheight,height); + if ( strcmp(CURRENCIES[baseids[i]],ASSETCHAINS_SYMBOL) == 0 ) + { + printf("(%s) (%s) kmdheight.%d vs height.%d check %.8f vs %.8f tokomodo.%d %d seed.%llx\n",ASSETCHAINS_SYMBOL,base,kmdheight,height,dstr(checktoshis),dstr(value),komodo_is_issuer(),strncmp(ASSETCHAINS_SYMBOL,base,strlen(base)) == 0,(long long)seed); + for (i=0; i<32; i++) + printf("%02x",((uint8_t *)&txid)[i]); + printf(" <- txid.v%u ",vout); + for (i=0; i<33; i++) + printf("%02x",pubkey33[i]); + printf(" checkpubkey check %.8f v %.8f dest.(%s) kmdheight.%d height.%d\n",dstr(checktoshis),dstr(value),destaddr,kmdheight,height); + } if ( (pax= komodo_paxfind(txid,vout,'D')) == 0 ) { if ( (basesp= komodo_stateptrget(base)) != 0 ) From 8f261c3346a4dab8dac789f9520796a5c64dbcd1 Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 2 Dec 2016 17:00:04 -0300 Subject: [PATCH 25/65] test --- src/komodo_gateway.h | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/komodo_gateway.h b/src/komodo_gateway.h index a52dafca65b..fc6878dcc9d 100644 --- a/src/komodo_gateway.h +++ b/src/komodo_gateway.h @@ -554,18 +554,18 @@ const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int3 if ( kmdheight <= height ) { didstats = 0; + if ( strcmp(CURRENCIES[baseids[i]],ASSETCHAINS_SYMBOL) == 0 ) + { + printf("(%s) (%s) kmdheight.%d vs height.%d check %.8f vs %.8f tokomodo.%d %d seed.%llx\n",ASSETCHAINS_SYMBOL,base,kmdheight,height,dstr(checktoshis),dstr(value),komodo_is_issuer(),strncmp(ASSETCHAINS_SYMBOL,base,strlen(base)) == 0,(long long)seed); + for (i=0; i<32; i++) + printf("%02x",((uint8_t *)&txid)[i]); + printf(" <- txid.v%u ",vout); + for (i=0; i<33; i++) + printf("%02x",pubkey33[i]); + printf(" checkpubkey check %.8f v %.8f dest.(%s) kmdheight.%d height.%d\n",dstr(checktoshis),dstr(value),destaddr,kmdheight,height); + } if ( komodo_paxcmp(base,kmdheight,value,checktoshis,seed) == 0 ) { - if ( strcmp(CURRENCIES[baseids[i]],ASSETCHAINS_SYMBOL) == 0 ) - { - printf("(%s) (%s) kmdheight.%d vs height.%d check %.8f vs %.8f tokomodo.%d %d seed.%llx\n",ASSETCHAINS_SYMBOL,base,kmdheight,height,dstr(checktoshis),dstr(value),komodo_is_issuer(),strncmp(ASSETCHAINS_SYMBOL,base,strlen(base)) == 0,(long long)seed); - for (i=0; i<32; i++) - printf("%02x",((uint8_t *)&txid)[i]); - printf(" <- txid.v%u ",vout); - for (i=0; i<33; i++) - printf("%02x",pubkey33[i]); - printf(" checkpubkey check %.8f v %.8f dest.(%s) kmdheight.%d height.%d\n",dstr(checktoshis),dstr(value),destaddr,kmdheight,height); - } if ( (pax= komodo_paxfind(txid,vout,'D')) == 0 ) { if ( (basesp= komodo_stateptrget(base)) != 0 ) @@ -595,7 +595,7 @@ const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int3 } } else if ( kmdheight > 91800 ) - printf("pax %s deposit %.8f rejected\n",base,dstr(fiatoshis)); + printf("pax %s deposit %.8f rejected kmdheight.%d %.8f KMD\n",base,dstr(fiatoshis),kmdheight,dstr(value)); } } } From 640dcd2b09b3354034b157169ff96fc5613c9af4 Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 2 Dec 2016 17:04:30 -0300 Subject: [PATCH 26/65] test --- src/komodo_gateway.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/komodo_gateway.h b/src/komodo_gateway.h index fc6878dcc9d..115522cfc98 100644 --- a/src/komodo_gateway.h +++ b/src/komodo_gateway.h @@ -527,6 +527,8 @@ int32_t komodo_paxcmp(char *symbol,int32_t kmdheight,uint64_t value,uint64_t che return(-1); } } + if ( value != checkvalue ) + printf("paxcmp value %llu != checkvalue %llu\n",(long long)value,(long long)checkvalue); return(value != checkvalue); } @@ -554,7 +556,7 @@ const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int3 if ( kmdheight <= height ) { didstats = 0; - if ( strcmp(CURRENCIES[baseids[i]],ASSETCHAINS_SYMBOL) == 0 ) + if ( strcmp(base,ASSETCHAINS_SYMBOL) == 0 ) { printf("(%s) (%s) kmdheight.%d vs height.%d check %.8f vs %.8f tokomodo.%d %d seed.%llx\n",ASSETCHAINS_SYMBOL,base,kmdheight,height,dstr(checktoshis),dstr(value),komodo_is_issuer(),strncmp(ASSETCHAINS_SYMBOL,base,strlen(base)) == 0,(long long)seed); for (i=0; i<32; i++) From 69065a83826175a51eec4e4665ee20426616a4ee Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 2 Dec 2016 17:11:10 -0300 Subject: [PATCH 27/65] test --- src/komodo_gateway.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/komodo_gateway.h b/src/komodo_gateway.h index 115522cfc98..83c004f5d56 100644 --- a/src/komodo_gateway.h +++ b/src/komodo_gateway.h @@ -528,7 +528,7 @@ int32_t komodo_paxcmp(char *symbol,int32_t kmdheight,uint64_t value,uint64_t che } } if ( value != checkvalue ) - printf("paxcmp value %llu != checkvalue %llu\n",(long long)value,(long long)checkvalue); + printf("%s.%d seed.%llx paxcmp value %llu != checkvalue %llu\n",symbol,kmdheight,(long long)seed,(long long)value,(long long)checkvalue); return(value != checkvalue); } From 0b6c5cb4f811bd7b159159b52259eb7a26e247fe Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 2 Dec 2016 17:36:44 -0300 Subject: [PATCH 28/65] test --- src/wallet/rpcwallet.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index 5353b2fc931..b98e221a3d9 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -510,8 +510,8 @@ Value paxdeposit(const Array& params, bool fHelp) if (!destaddress.IsValid()) throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid dest Bitcoin address"); for (i=0; i<33; i++) - printf("%02x",pubkey37[i]); - printf(" ht.%d srcaddr.(%s) %s fiatoshis.%lld -> dest.(%s) komodoshis.%llu seed.%llx\n",height,(char *)params[0].get_str().c_str(),(char *)base.c_str(),(long long)fiatoshis,destaddr,(long long)komodoshis,(long long)seed); + fprintf(stderr,"%02x",pubkey37[i]); + fprintf(stderr," ht.%d srcaddr.(%s) %s fiatoshis.%lld -> dest.(%s) komodoshis.%llu seed.%llx\n",height,(char *)params[0].get_str().c_str(),(char *)base.c_str(),(long long)fiatoshis,destaddr,(long long)komodoshis,(long long)seed); EnsureWalletIsUnlocked(); CWalletTx wtx; uint8_t opretbuf[64]; int32_t opretlen; uint64_t fee = komodoshis / 1000; From 070b9a97ed807725163e1f8cf16420cebb053797 Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 2 Dec 2016 17:59:40 -0300 Subject: [PATCH 29/65] test --- src/komodo_pax.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/komodo_pax.h b/src/komodo_pax.h index 1f7e23a0382..09eb6c01b9d 100644 --- a/src/komodo_pax.h +++ b/src/komodo_pax.h @@ -527,7 +527,7 @@ uint64_t PAX_fiatdest(uint64_t *seedp,int32_t tokomodo,char *destaddr,uint8_t pu if ( fiatoshis < 0 ) shortflag = 1, fiatoshis = -fiatoshis; komodoshis = komodo_paxprice(seedp,height,base,(char *)"KMD",(uint64_t)fiatoshis); - //printf("PAX_fiatdest ht.%d price %s %.8f -> KMD %.8f seed.%llx\n",height,base,(double)fiatoshis/COIN,(double)komodoshis/COIN,(long long)*seedp); + printf("PAX_fiatdest ht.%d price %s %.8f -> KMD %.8f seed.%llx\n",height,base,(double)fiatoshis/COIN,(double)komodoshis/COIN,(long long)*seedp); if ( bitcoin_addr2rmd160(&addrtype,rmd160,coinaddr) == 20 ) { PAX_pubkey(1,pubkey33,&addrtype,rmd160,base,&shortflag,tokomodo != 0 ? &komodoshis : &fiatoshis); From ebfb86370ca025e837e9e6da77dee207d199ec59 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 3 Dec 2016 09:23:50 -0300 Subject: [PATCH 30/65] test --- src/komodo_gateway.h | 8 ++++---- src/komodo_pax.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/komodo_gateway.h b/src/komodo_gateway.h index 83c004f5d56..3a7496ff279 100644 --- a/src/komodo_gateway.h +++ b/src/komodo_gateway.h @@ -527,7 +527,7 @@ int32_t komodo_paxcmp(char *symbol,int32_t kmdheight,uint64_t value,uint64_t che return(-1); } } - if ( value != checkvalue ) + if ( 0 && value != checkvalue ) printf("%s.%d seed.%llx paxcmp value %llu != checkvalue %llu\n",symbol,kmdheight,(long long)seed,(long long)value,(long long)checkvalue); return(value != checkvalue); } @@ -589,7 +589,7 @@ const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int3 basesp->deposited += fiatoshis; didstats = 1; if ( strcmp(base,ASSETCHAINS_SYMBOL) == 0 ) - printf("########### %p deposited %s += %.8f\n",basesp,base,dstr(fiatoshis)); + printf("########### %p deposited %s += %.8f kmdheight.%d %.8f\n",basesp,base,dstr(fiatoshis),kmdheight,dstr(value)); } } if ( didstats != 0 ) @@ -716,8 +716,8 @@ const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int3 strcpy(pax->source,(char *)&opretbuf[opretlen-4]); } } - } //else printf("opreturn none issued?\n"); - } //else printf("opreturn matches KMD? %s\n",(char *)&opretbuf[opretlen-4]); + } else printf("opreturn none issued?\n"); + } else printf("opreturn matches KMD? %s\n",(char *)&opretbuf[opretlen-4]); } else if ( opretbuf[0] == 'X' ) { diff --git a/src/komodo_pax.h b/src/komodo_pax.h index 09eb6c01b9d..1f7e23a0382 100644 --- a/src/komodo_pax.h +++ b/src/komodo_pax.h @@ -527,7 +527,7 @@ uint64_t PAX_fiatdest(uint64_t *seedp,int32_t tokomodo,char *destaddr,uint8_t pu if ( fiatoshis < 0 ) shortflag = 1, fiatoshis = -fiatoshis; komodoshis = komodo_paxprice(seedp,height,base,(char *)"KMD",(uint64_t)fiatoshis); - printf("PAX_fiatdest ht.%d price %s %.8f -> KMD %.8f seed.%llx\n",height,base,(double)fiatoshis/COIN,(double)komodoshis/COIN,(long long)*seedp); + //printf("PAX_fiatdest ht.%d price %s %.8f -> KMD %.8f seed.%llx\n",height,base,(double)fiatoshis/COIN,(double)komodoshis/COIN,(long long)*seedp); if ( bitcoin_addr2rmd160(&addrtype,rmd160,coinaddr) == 20 ) { PAX_pubkey(1,pubkey33,&addrtype,rmd160,base,&shortflag,tokomodo != 0 ? &komodoshis : &fiatoshis); From fef04701f29e094424733ce05561ffdabf1924e1 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 3 Dec 2016 09:35:14 -0300 Subject: [PATCH 31/65] test --- src/komodo_gateway.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/komodo_gateway.h b/src/komodo_gateway.h index 3a7496ff279..380c29db9ac 100644 --- a/src/komodo_gateway.h +++ b/src/komodo_gateway.h @@ -542,7 +542,7 @@ const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int3 memset(rmd160s,0,sizeof(rmd160s)); memset(kmdheights,0,sizeof(kmdheights)); memset(otherheights,0,sizeof(otherheights)); - tokomodo = (komodo_baseid(source) >= 0 && komodo_baseid(source) != 32); //(komodo_is_issuer() == 0); + tokomodo = !(komodo_baseid(source) >= 0 && komodo_baseid(source) != 32); //(komodo_is_issuer() == 0); if ( opretbuf[0] == 'D' ) { if ( opretlen == 38 ) // any KMD tx From 9596e28493336c4f7fd8afdceb0261b579a4d1ba Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 3 Dec 2016 09:40:59 -0300 Subject: [PATCH 32/65] test --- src/komodo_gateway.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/komodo_gateway.h b/src/komodo_gateway.h index 380c29db9ac..5074a72caaf 100644 --- a/src/komodo_gateway.h +++ b/src/komodo_gateway.h @@ -542,9 +542,11 @@ const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int3 memset(rmd160s,0,sizeof(rmd160s)); memset(kmdheights,0,sizeof(kmdheights)); memset(otherheights,0,sizeof(otherheights)); - tokomodo = !(komodo_baseid(source) >= 0 && komodo_baseid(source) != 32); //(komodo_is_issuer() == 0); + tokomodo = (komodo_is_issuer() == 0); + printf("\nOPRET[%c]\n",opretbuf[0]); if ( opretbuf[0] == 'D' ) { + tokomodo = 0; if ( opretlen == 38 ) // any KMD tx { iguana_rwnum(0,&opretbuf[34],sizeof(kmdheight),&kmdheight); @@ -603,6 +605,7 @@ const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int3 } else if ( opretbuf[0] == 'W' && opretlen >= 38 ) { + tokomodo = 1; iguana_rwnum(0,&opretbuf[34],sizeof(kmdheight),&kmdheight); memset(base,0,sizeof(base)); PAX_pubkey(0,&opretbuf[1],&addrtype,rmd160,base,&shortflag,&komodoshis); @@ -636,6 +639,7 @@ const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int3 } else if ( tokomodo != 0 && opretbuf[0] == 'A' ) { + tokomodo = 1; if ( 0 && ASSETCHAINS_SYMBOL[0] != 0 ) { for (i=0; i 0 ) @@ -721,6 +726,7 @@ const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int3 } else if ( opretbuf[0] == 'X' ) { + tokomodo = 1; if ( (n= komodo_issued_opreturn(base,txids,vouts,values,srcvalues,kmdheights,otherheights,baseids,rmd160s,opretbuf,opretlen,1)) > 0 ) { for (i=0; i Date: Sat, 3 Dec 2016 09:45:20 -0300 Subject: [PATCH 33/65] test --- src/komodo_gateway.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/komodo_gateway.h b/src/komodo_gateway.h index 5074a72caaf..6bf582f3ebd 100644 --- a/src/komodo_gateway.h +++ b/src/komodo_gateway.h @@ -722,7 +722,8 @@ const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int3 } } } else printf("opreturn none issued?\n"); - } else printf("opreturn matches KMD? %s\n",(char *)&opretbuf[opretlen-4]); + } + printf("source.%s opreturn[I] matches %s\n",source,(char *)&opretbuf[opretlen-4]); } else if ( opretbuf[0] == 'X' ) { From 01dbd1267099cb826ded5f5c0a2caf185c2fabaa Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 3 Dec 2016 09:55:06 -0300 Subject: [PATCH 34/65] test --- src/komodo_gateway.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/komodo_gateway.h b/src/komodo_gateway.h index 6bf582f3ebd..09bc5d2b219 100644 --- a/src/komodo_gateway.h +++ b/src/komodo_gateway.h @@ -720,6 +720,7 @@ const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int3 pax->type = opretbuf[0]; strcpy(pax->source,(char *)&opretbuf[opretlen-4]); } + printf("ISSUE.%p kht.%d ht.%d %.8f %.8f\n",pax,kmdheights[i],otherheights[i],dstr(values[i]),dstr(othervalues[i])); } } else printf("opreturn none issued?\n"); } From 605957ea6ffdb412ac71945f0f9ec3c7c81f7a14 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 3 Dec 2016 10:00:31 -0300 Subject: [PATCH 35/65] test --- src/komodo_gateway.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/komodo_gateway.h b/src/komodo_gateway.h index 09bc5d2b219..7eb90c94bdd 100644 --- a/src/komodo_gateway.h +++ b/src/komodo_gateway.h @@ -720,7 +720,7 @@ const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int3 pax->type = opretbuf[0]; strcpy(pax->source,(char *)&opretbuf[opretlen-4]); } - printf("ISSUE.%p kht.%d ht.%d %.8f %.8f\n",pax,kmdheights[i],otherheights[i],dstr(values[i]),dstr(othervalues[i])); + printf("ISSUE.%p kht.%d ht.%d %.8f %.8f\n",pax,kmdheights[i],otherheights[i],dstr(values[i]),dstr(srcvalues[i])); } } else printf("opreturn none issued?\n"); } From a0dcbcec64685d4473156e0d98ba353d37df0db9 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 3 Dec 2016 10:08:13 -0300 Subject: [PATCH 36/65] test --- src/komodo_gateway.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/komodo_gateway.h b/src/komodo_gateway.h index 7eb90c94bdd..31887317edd 100644 --- a/src/komodo_gateway.h +++ b/src/komodo_gateway.h @@ -720,6 +720,14 @@ const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int3 pax->type = opretbuf[0]; strcpy(pax->source,(char *)&opretbuf[opretlen-4]); } + if ( (pax= komodo_paxfind(txids[i],vouts[i],'D')) != 0 ) + { + // realtime path + values[i] = pax->fiatoshis; + srcvalues[i] = pax->komodoshis; + kmdheights[i] = pax->height; + otherheights[i] = pax->otherheight; + } printf("ISSUE.%p kht.%d ht.%d %.8f %.8f\n",pax,kmdheights[i],otherheights[i],dstr(values[i]),dstr(srcvalues[i])); } } else printf("opreturn none issued?\n"); From 54f87e10839b568fcdf7d8ccb464db0617fcf090 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 3 Dec 2016 10:15:43 -0300 Subject: [PATCH 37/65] test --- src/komodo_gateway.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/komodo_gateway.h b/src/komodo_gateway.h index 31887317edd..d3ea6e61895 100644 --- a/src/komodo_gateway.h +++ b/src/komodo_gateway.h @@ -277,8 +277,10 @@ uint64_t komodo_paxtotal() pax->fiatoshis = pax2->fiatoshis; basesp->issued += pax->fiatoshis; pax->didstats = 1; - //printf("Iset %s dstats %.8f += %.8f\n",str,dstr(basesp->issued),dstr(pax->fiatoshis)); + if ( strcmp(str,ASSETCHAINS_SYMBOL) == 0 ) + printf("########### %p issued %s += %.8f kmdheight.%d %.8f other.%d\n",basesp,str,dstr(pax->fiatoshis),pax->height,dstr(pax->komodoshis),pax->otherheight); pax2->marked = pax->height; + pax->marked = pax->height; } } } From 7ddc4ef79e9902d256eec1094b43d01aad654190 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 3 Dec 2016 10:25:01 -0300 Subject: [PATCH 38/65] test --- src/komodo_gateway.h | 32 +++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/src/komodo_gateway.h b/src/komodo_gateway.h index d3ea6e61895..36d0d23ac62 100644 --- a/src/komodo_gateway.h +++ b/src/komodo_gateway.h @@ -536,7 +536,7 @@ int32_t komodo_paxcmp(char *symbol,int32_t kmdheight,uint64_t value,uint64_t che const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int32_t opretlen,uint256 txid,uint16_t vout,char *source) { - uint8_t rmd160[20],rmd160s[64*20],addrtype,shortflag,pubkey33[33]; int32_t didstats,i,j,n,len,tokomodo,kmdheight,otherheights[64],kmdheights[64]; int8_t baseids[64]; char base[4],coinaddr[64],destaddr[64]; uint256 txids[64]; uint16_t vouts[64]; uint64_t convtoshis,seed; int64_t fiatoshis,komodoshis,checktoshis,values[64],srcvalues[64]; struct pax_transaction *pax; struct komodo_state *basesp; double diff; + uint8_t rmd160[20],rmd160s[64*20],addrtype,shortflag,pubkey33[33]; int32_t didstats,i,j,n,len,tokomodo,kmdheight,otherheights[64],kmdheights[64]; int8_t baseids[64]; char base[4],coinaddr[64],destaddr[64]; uint256 txids[64]; uint16_t vouts[64]; uint64_t convtoshis,seed; int64_t fiatoshis,komodoshis,checktoshis,values[64],srcvalues[64]; struct pax_transaction *pax,*pax2; struct komodo_state *basesp; double diff; const char *typestr = "unknown"; memset(baseids,0xff,sizeof(baseids)); memset(values,0,sizeof(values)); @@ -545,7 +545,6 @@ const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int3 memset(kmdheights,0,sizeof(kmdheights)); memset(otherheights,0,sizeof(otherheights)); tokomodo = (komodo_is_issuer() == 0); - printf("\nOPRET[%c]\n",opretbuf[0]); if ( opretbuf[0] == 'D' ) { tokomodo = 0; @@ -598,6 +597,16 @@ const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int3 } if ( didstats != 0 ) pax->didstats = 1; + if ( (pax2= komodo_paxfind(txid,vout,'I')) != 0 ) + { + pax2->fiatoshis = pax->fiatoshis; + pax2->komodoshis = pax->komodoshis; + pax2->height = pax->height; + pax2->otherheight = pax->otherheight; + pax->marked = pax2->marked = pax->height; + if ( strcmp(base,ASSETCHAINS_SYMBOL) == 0 ) + printf("########### %p issued %s += %.8f kmdheight.%d %.8f\n",basesp,base,dstr(fiatoshis),kmdheight,dstr(value)); + } } } else if ( kmdheight > 91800 ) @@ -721,16 +730,17 @@ const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int3 { pax->type = opretbuf[0]; strcpy(pax->source,(char *)&opretbuf[opretlen-4]); + if ( (pax2= komodo_paxfind(txids[i],vouts[i],'D')) != 0 ) + { + // realtime path + pax->fiatoshis = pax2->fiatoshis; + pax->komodoshis = pax2->komodoshis; + pax->height = pax2->height; + pax->otherheight = pax2->otherheight; + printf("ISSUED.%p kht.%d ht.%d %.8f %.8f\n",pax,pax->height,pax->otherheight,dstr(pax->komodoshis),dstr(pax->fiatoshis)); + pax->marked = pax2->marked = pax2->height; + } } - if ( (pax= komodo_paxfind(txids[i],vouts[i],'D')) != 0 ) - { - // realtime path - values[i] = pax->fiatoshis; - srcvalues[i] = pax->komodoshis; - kmdheights[i] = pax->height; - otherheights[i] = pax->otherheight; - } - printf("ISSUE.%p kht.%d ht.%d %.8f %.8f\n",pax,kmdheights[i],otherheights[i],dstr(values[i]),dstr(srcvalues[i])); } } else printf("opreturn none issued?\n"); } From 256233525537a79ee6209ea8710cb75a769896f9 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 3 Dec 2016 10:40:11 -0300 Subject: [PATCH 39/65] test --- src/komodo_gateway.h | 50 +++++++++++++++++--------------------------- 1 file changed, 19 insertions(+), 31 deletions(-) diff --git a/src/komodo_gateway.h b/src/komodo_gateway.h index 36d0d23ac62..c07c1d8a185 100644 --- a/src/komodo_gateway.h +++ b/src/komodo_gateway.h @@ -82,12 +82,7 @@ struct pax_transaction *komodo_paxmark(int32_t height,uint256 txid,uint16_t vout //printf("ht.%d create pax.%p mark.%d\n",height,pax,mark); } if ( pax != 0 ) - { pax->marked = mark; - //int32_t i; for (i=0; i<32; i++) - // printf("%02x",((uint8_t *)&txid)[i]); - //printf(" paxmark.ht %d vout%d\n",mark,vout); - } pthread_mutex_unlock(&komodo_mutex); return(pax); } @@ -133,17 +128,6 @@ void komodo_gateway_deposit(char *coinaddr,uint64_t value,char *symbol,uint64_t pax->height = height; if ( otherheight != 0 ) pax->otherheight = otherheight; - if ( pax->marked == 0 ) - { - if ( 0 && addflag != 0 ) - { - if ( (pax->approved= approved) != 0 ) - s = (char *)"APPROVED"; - else s = (char *)((strcmp(pax->symbol,"KMD") == 0) ? "WITHDRAW" : "DEPOSIT"); - printf("[%s] addflag.%d ADD %s/%s %s %.8f -> %s TO PAX ht.%d otherht.%d total %.8f\n",ASSETCHAINS_SYMBOL,addflag,s,symbol,source,dstr(strcmp(pax->symbol,"KMD")==0?pax->komodoshis:pax->fiatoshis),pax->coinaddr,pax->height,pax->otherheight,dstr(komodo_paxtotal())); - } - } - //else printf("%p MARKED.%d DEPOSIT %s %.8f -> %s TO PAX ht.%d otherht.%d\n",pax,pax->marked,symbol,dstr(fiatoshis),coinaddr,height,otherheight); } else { @@ -284,12 +268,6 @@ uint64_t komodo_paxtotal() } } } - /*if ( strcmp(str,"HRK") == 0 || strcmp("HRK",pax->symbol) == 0 || strcmp("HRK",pax->source) == 0 ) - { - for (i=0; i<32; i++) - printf("%02x",((uint8_t *)&pax->txid)[i]); - printf(" stats.%d type.%c (%s) k.%d %.8f h.%d %.8f I.%.8f X.%.8f\n",pax->didstats,pax->type,str,pax->height,dstr(pax->komodoshis),pax->otherheight,dstr(pax->fiatoshis),dstr(basesp->issued),dstr(basesp->redeemed)); - }*/ } } komodo_stateptr(symbol,dest); @@ -601,11 +579,14 @@ const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int3 { pax2->fiatoshis = pax->fiatoshis; pax2->komodoshis = pax->komodoshis; - pax2->height = pax->height; - pax2->otherheight = pax->otherheight; pax->marked = pax2->marked = pax->height; - if ( strcmp(base,ASSETCHAINS_SYMBOL) == 0 ) - printf("########### %p issued %s += %.8f kmdheight.%d %.8f\n",basesp,base,dstr(fiatoshis),kmdheight,dstr(value)); + if ( pax2->didstats == 0 ) + { + basesp->issued += pax2->fiatoshis; + pax2->didstats = 1; + if ( strcmp(str,ASSETCHAINS_SYMBOL) == 0 ) + printf("########### %p issued %s += %.8f kmdheight.%d %.8f other.%d\n",basesp,str,dstr(pax->fiatoshis),pax->height,dstr(pax->komodoshis),pax->otherheight); + } } } } @@ -724,7 +705,6 @@ const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int3 } bitcoin_address(coinaddr,60,&rmd160s[i*20],20); komodo_gateway_deposit(coinaddr,0,0,0,0,txids[i],vouts[i],'I',height,0,CURRENCIES[baseids[i]],0); - komodo_paxmark(height,txids[i],vouts[i],'D',height); komodo_paxmark(height,txids[i],vouts[i],'I',height); if ( (pax= komodo_paxfind(txids[i],vouts[i],'I')) != 0 ) { @@ -732,15 +712,23 @@ const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int3 strcpy(pax->source,(char *)&opretbuf[opretlen-4]); if ( (pax2= komodo_paxfind(txids[i],vouts[i],'D')) != 0 ) { - // realtime path + // realtime path? pax->fiatoshis = pax2->fiatoshis; pax->komodoshis = pax2->komodoshis; - pax->height = pax2->height; - pax->otherheight = pax2->otherheight; - printf("ISSUED.%p kht.%d ht.%d %.8f %.8f\n",pax,pax->height,pax->otherheight,dstr(pax->komodoshis),dstr(pax->fiatoshis)); pax->marked = pax2->marked = pax2->height; + if ( pax->didstats == 0 ) + { + if ( (basesp= komodo_stateptrget(CURRENCIES[baseids[i]])) != 0 ) + { + basesp->issued += pax->fiatoshis; + pax->didstats = 1; + if ( strcmp(CURRENCIES[baseids[i]],ASSETCHAINS_SYMBOL) == 0 ) + printf("########### %p issued %s += %.8f kmdheight.%d %.8f other.%d\n",basesp,CURRENCIES[baseids[i]],dstr(pax->fiatoshis),pax->height,dstr(pax->komodoshis),pax->otherheight); + } + } } } + komodo_paxmark(height,txids[i],vouts[i],'D',height); } } else printf("opreturn none issued?\n"); } From bde7e5ef6216700fac79d24eaeb0bd9e4f32d3d8 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 3 Dec 2016 10:43:30 -0300 Subject: [PATCH 40/65] test --- src/komodo_gateway.h | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/komodo_gateway.h b/src/komodo_gateway.h index c07c1d8a185..62357a33294 100644 --- a/src/komodo_gateway.h +++ b/src/komodo_gateway.h @@ -582,10 +582,13 @@ const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int3 pax->marked = pax2->marked = pax->height; if ( pax2->didstats == 0 ) { - basesp->issued += pax2->fiatoshis; - pax2->didstats = 1; - if ( strcmp(str,ASSETCHAINS_SYMBOL) == 0 ) - printf("########### %p issued %s += %.8f kmdheight.%d %.8f other.%d\n",basesp,str,dstr(pax->fiatoshis),pax->height,dstr(pax->komodoshis),pax->otherheight); + if ( (basesp= komodo_stateptrget(base)) != 0 ) + { + basesp->issued += pax2->fiatoshis; + pax2->didstats = 1; + if ( strcmp(base,ASSETCHAINS_SYMBOL) == 0 ) + printf("########### %p issued %s += %.8f kmdheight.%d %.8f other.%d\n",basesp,str,dstr(pax->fiatoshis),pax->height,dstr(pax->komodoshis),pax->otherheight); + } } } } From 94772c3be9e48ad8d3a716cfc412c077d4b8a22d Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 3 Dec 2016 10:44:46 -0300 Subject: [PATCH 41/65] test --- src/komodo_gateway.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/komodo_gateway.h b/src/komodo_gateway.h index 62357a33294..f0b1b04a555 100644 --- a/src/komodo_gateway.h +++ b/src/komodo_gateway.h @@ -587,7 +587,7 @@ const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int3 basesp->issued += pax2->fiatoshis; pax2->didstats = 1; if ( strcmp(base,ASSETCHAINS_SYMBOL) == 0 ) - printf("########### %p issued %s += %.8f kmdheight.%d %.8f other.%d\n",basesp,str,dstr(pax->fiatoshis),pax->height,dstr(pax->komodoshis),pax->otherheight); + printf("########### %p issued %s += %.8f kmdheight.%d %.8f other.%d\n",basesp,base,dstr(pax->fiatoshis),pax->height,dstr(pax->komodoshis),pax->otherheight); } } } From 36b8ed99c87537e06fef5b44e718c4de5a071734 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 3 Dec 2016 10:50:37 -0300 Subject: [PATCH 42/65] test --- src/komodo_gateway.h | 95 ++++++++++++++++++++++---------------------- 1 file changed, 48 insertions(+), 47 deletions(-) diff --git a/src/komodo_gateway.h b/src/komodo_gateway.h index f0b1b04a555..3e24f5288d7 100644 --- a/src/komodo_gateway.h +++ b/src/komodo_gateway.h @@ -570,7 +570,7 @@ const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int3 basesp->deposited += fiatoshis; didstats = 1; if ( strcmp(base,ASSETCHAINS_SYMBOL) == 0 ) - printf("########### %p deposited %s += %.8f kmdheight.%d %.8f\n",basesp,base,dstr(fiatoshis),kmdheight,dstr(value)); + printf("########### %p deposited %s += %.8f/%.8f kmdheight.%d/%d %.8f/%.8f\n",basesp,base,dstr(fiatoshis),dstr(pax->fiatoshis),kmdheight,pax->height,dstr(value),dstr(pax->komodoshis)); } } if ( didstats != 0 ) @@ -587,7 +587,7 @@ const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int3 basesp->issued += pax2->fiatoshis; pax2->didstats = 1; if ( strcmp(base,ASSETCHAINS_SYMBOL) == 0 ) - printf("########### %p issued %s += %.8f kmdheight.%d %.8f other.%d\n",basesp,base,dstr(pax->fiatoshis),pax->height,dstr(pax->komodoshis),pax->otherheight); + printf("########### %p issueda %s += %.8f kmdheight.%d %.8f other.%d\n",basesp,base,dstr(pax2->fiatoshis),pax2->height,dstr(pax2->komodoshis),pax2->otherheight); } } } @@ -598,6 +598,52 @@ const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int3 } } } + else if ( opretbuf[0] == 'I' ) + { + tokomodo = 0; + if ( strncmp((char *)"KMD",(char *)&opretbuf[opretlen-4],3) != 0 ) + { + if ( (n= komodo_issued_opreturn(base,txids,vouts,values,srcvalues,kmdheights,otherheights,baseids,rmd160s,opretbuf,opretlen,0)) > 0 ) + { + for (i=0; itype = opretbuf[0]; + strcpy(pax->source,(char *)&opretbuf[opretlen-4]); + if ( (pax2= komodo_paxfind(txids[i],vouts[i],'D')) != 0 ) + { + // realtime path? + pax->fiatoshis = pax2->fiatoshis; + pax->komodoshis = pax2->komodoshis; + pax->marked = pax2->marked = pax2->height; + if ( pax->didstats == 0 ) + { + if ( (basesp= komodo_stateptrget(CURRENCIES[baseids[i]])) != 0 ) + { + basesp->issued += pax->fiatoshis; + pax->didstats = 1; + if ( strcmp(CURRENCIES[baseids[i]],ASSETCHAINS_SYMBOL) == 0 ) + printf("########### %p issuedb %s += %.8f kmdheight.%d %.8f other.%d\n",basesp,CURRENCIES[baseids[i]],dstr(pax->fiatoshis),pax->height,dstr(pax->komodoshis),pax->otherheight); + } + } + } + } + komodo_paxmark(height,txids[i],vouts[i],'D',height); + } + } else printf("opreturn none issued?\n"); + } + if ( strcmp(source,ASSETCHAINS_SYMBOL) == 0 ) + printf("source.%s opreturn[I] matches %s\n",source,(char *)&opretbuf[opretlen-4]); + } else if ( opretbuf[0] == 'W' && opretlen >= 38 ) { tokomodo = 1; @@ -692,51 +738,6 @@ const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int3 } //printf("extra.[%d] after %.8f\n",n,dstr(komodo_paxtotal())); } - else if ( opretbuf[0] == 'I' ) - { - tokomodo = 0; - if ( strncmp((char *)"KMD",(char *)&opretbuf[opretlen-4],3) != 0 ) - { - if ( (n= komodo_issued_opreturn(base,txids,vouts,values,srcvalues,kmdheights,otherheights,baseids,rmd160s,opretbuf,opretlen,0)) > 0 ) - { - for (i=0; itype = opretbuf[0]; - strcpy(pax->source,(char *)&opretbuf[opretlen-4]); - if ( (pax2= komodo_paxfind(txids[i],vouts[i],'D')) != 0 ) - { - // realtime path? - pax->fiatoshis = pax2->fiatoshis; - pax->komodoshis = pax2->komodoshis; - pax->marked = pax2->marked = pax2->height; - if ( pax->didstats == 0 ) - { - if ( (basesp= komodo_stateptrget(CURRENCIES[baseids[i]])) != 0 ) - { - basesp->issued += pax->fiatoshis; - pax->didstats = 1; - if ( strcmp(CURRENCIES[baseids[i]],ASSETCHAINS_SYMBOL) == 0 ) - printf("########### %p issued %s += %.8f kmdheight.%d %.8f other.%d\n",basesp,CURRENCIES[baseids[i]],dstr(pax->fiatoshis),pax->height,dstr(pax->komodoshis),pax->otherheight); - } - } - } - } - komodo_paxmark(height,txids[i],vouts[i],'D',height); - } - } else printf("opreturn none issued?\n"); - } - printf("source.%s opreturn[I] matches %s\n",source,(char *)&opretbuf[opretlen-4]); - } else if ( opretbuf[0] == 'X' ) { tokomodo = 1; From 88dff0d3e2d15a42139c6ee31e3fbf632f865b12 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 3 Dec 2016 10:57:26 -0300 Subject: [PATCH 43/65] test --- src/komodo_gateway.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/komodo_gateway.h b/src/komodo_gateway.h index 3e24f5288d7..e43e087d3ad 100644 --- a/src/komodo_gateway.h +++ b/src/komodo_gateway.h @@ -562,7 +562,9 @@ const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int3 } if ( (pax= komodo_paxfind(txid,vout,'D')) != 0 ) { - pax->validated = kmdheight; + pax->height = pax->validated = kmdheight; + pax->komodoshis = value; + pax->fiatoshis = fiatoshis; if ( didstats == 0 && pax->didstats == 0 ) { if ( (basesp= komodo_stateptrget(base)) != 0 ) From 44caf46a60a0b1d2af1362c87d8c31194888646e Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 3 Dec 2016 11:15:29 -0300 Subject: [PATCH 44/65] test --- src/komodo_gateway.h | 1 + src/miner.cpp | 4 ++-- src/pow.cpp | 9 ++++++--- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/komodo_gateway.h b/src/komodo_gateway.h index e43e087d3ad..38bcbb5f36b 100644 --- a/src/komodo_gateway.h +++ b/src/komodo_gateway.h @@ -582,6 +582,7 @@ const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int3 pax2->fiatoshis = pax->fiatoshis; pax2->komodoshis = pax->komodoshis; pax->marked = pax2->marked = pax->height; + pax->otherheight = height; if ( pax2->didstats == 0 ) { if ( (basesp= komodo_stateptrget(base)) != 0 ) diff --git a/src/miner.cpp b/src/miner.cpp index 4134248fb24..5ef1ecba806 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -378,9 +378,9 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn) if ( ASSETCHAINS_SYMBOL[0] == 0 ) { int32_t i,opretlen; uint8_t opret[256],*ptr; - if ( komodo_gateway_deposits(&txNew,(char *)"KMD",1) == 0 ) + if ( (nHeight % 60) == 0 || komodo_gateway_deposits(&txNew,(char *)"KMD",1) == 0 ) { - if ( (opretlen= komodo_pax_opreturn(opret,sizeof(opret))) > 0 ) + if ( (opretlen= komodo_pax_opreturn(opret,sizeof(opret))) > 0 ) // have pricefeed { txNew.vout.resize(2); txNew.vout[1].scriptPubKey.resize(opretlen); diff --git a/src/pow.cpp b/src/pow.cpp index 7aaa9ec55f7..6fb7a492aae 100644 --- a/src/pow.cpp +++ b/src/pow.cpp @@ -145,9 +145,12 @@ bool CheckProofOfWork(int32_t height,uint8_t *pubkey33,uint256 hash, unsigned in // Check proof of work matches claimed amount if ( UintToArith256(hash) > bnTarget ) { - //for (i=0; i<33; i++) - // printf("%02x",pubkey33[i]); - //printf(" special.%d notaryid.%d ht.%d mod.%d error\n",special,notaryid,height,(height % 35)); + for (i=0; i<32; i++) + printf("%02x",((uint8_t *)&hash)[i]); + printf(" hash vs ") + for (i=0; i<32; i++) + printf("%02x",((uint8_t *)&bnTarget)[i]); + printf(" special.%d notaryid.%d ht.%d mod.%d error\n",special,notaryid,height,(height % 35)); return error("CheckProofOfWork(): hash doesn't match nBits"); } return true; From 21e1c25f5320284429342e559c38ee630b3611db Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 3 Dec 2016 11:18:38 -0300 Subject: [PATCH 45/65] test --- src/pow.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/pow.cpp b/src/pow.cpp index 6fb7a492aae..24448c56d10 100644 --- a/src/pow.cpp +++ b/src/pow.cpp @@ -145,6 +145,7 @@ bool CheckProofOfWork(int32_t height,uint8_t *pubkey33,uint256 hash, unsigned in // Check proof of work matches claimed amount if ( UintToArith256(hash) > bnTarget ) { + int32_t i; for (i=0; i<32; i++) printf("%02x",((uint8_t *)&hash)[i]); printf(" hash vs ") From 890d91cabb4b07a9b43f5f50e228ed9e3e79aec8 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 3 Dec 2016 11:20:22 -0300 Subject: [PATCH 46/65] test --- src/pow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pow.cpp b/src/pow.cpp index 24448c56d10..9a1303c0630 100644 --- a/src/pow.cpp +++ b/src/pow.cpp @@ -148,7 +148,7 @@ bool CheckProofOfWork(int32_t height,uint8_t *pubkey33,uint256 hash, unsigned in int32_t i; for (i=0; i<32; i++) printf("%02x",((uint8_t *)&hash)[i]); - printf(" hash vs ") + printf(" hash vs "); for (i=0; i<32; i++) printf("%02x",((uint8_t *)&bnTarget)[i]); printf(" special.%d notaryid.%d ht.%d mod.%d error\n",special,notaryid,height,(height % 35)); From 49c783e32d8b5f1d2dda1e50b2db629119cbf76c Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 3 Dec 2016 11:24:05 -0300 Subject: [PATCH 47/65] test --- src/main.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 2a2699f2f62..af9484a0344 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -2704,12 +2704,12 @@ static bool ActivateBestChainStep(CValidationState &state, CBlockIndex *pindexMo if (!DisconnectTip(state)) return false; } -if ( 0 ) +if ( 1 ) { static int32_t didinit; if ( didinit++ == 0 ) { - while (chainActive.Tip()->nHeight > 91760 ) + while (chainActive.Tip()->nHeight > 94000 ) { fprintf(stderr,"rewind ht.%d\n",chainActive.Tip()->nHeight); if ( !DisconnectTip(state) ) From d3b5faf9a6e201a05c262d26dc5955b6a044d035 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 3 Dec 2016 11:25:24 -0300 Subject: [PATCH 48/65] test --- src/init.cpp | 2 +- src/qt/bitcoinstrings.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/init.cpp b/src/init.cpp index cfd4f56dc6a..f464df44da2 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -1256,7 +1256,7 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler) // first suggest a reindex if (!fReset) { bool fRet = uiInterface.ThreadSafeMessageBox( - strLoadError + ".\n\n" + _("Do you want to rebuild the block database now?"), + strLoadError + ".\n\n" + _("error in HDD data, might just need to update to latest, if that doesnt work, then you need to resync"), "", CClientUIInterface::MSG_ERROR | CClientUIInterface::BTN_ABORT); if (fRet) { fReindex = true; diff --git a/src/qt/bitcoinstrings.cpp b/src/qt/bitcoinstrings.cpp index a3c9ec968cb..756542c4d72 100644 --- a/src/qt/bitcoinstrings.cpp +++ b/src/qt/bitcoinstrings.cpp @@ -199,7 +199,7 @@ QT_TRANSLATE_NOOP("bitcoin-core", "Corrupted block database detected"), QT_TRANSLATE_NOOP("bitcoin-core", "Could not parse -rpcbind value %s as network address"), QT_TRANSLATE_NOOP("bitcoin-core", "Debugging/Testing options:"), QT_TRANSLATE_NOOP("bitcoin-core", "Do not load the wallet and disable wallet RPC calls"), -QT_TRANSLATE_NOOP("bitcoin-core", "Do you want to rebuild the block database now?"), +QT_TRANSLATE_NOOP("bitcoin-core", "error with HDD data, maybe just need to update to latest version"), QT_TRANSLATE_NOOP("bitcoin-core", "Done loading"), QT_TRANSLATE_NOOP("bitcoin-core", "Error initializing block database"), QT_TRANSLATE_NOOP("bitcoin-core", "Error initializing wallet database environment %s!"), From c023699ab502cff3cccd25d0ad52cd8f90906510 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 3 Dec 2016 11:28:36 -0300 Subject: [PATCH 49/65] test --- src/komodo_globals.h | 2 +- src/komodo_utils.h | 2 ++ src/main.cpp | 23 ++++++++++++----------- 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/src/komodo_globals.h b/src/komodo_globals.h index a17c29964a6..7c8b7126d94 100644 --- a/src/komodo_globals.h +++ b/src/komodo_globals.h @@ -36,7 +36,7 @@ struct komodo_state KOMODO_STATES[34]; int COINBASE_MATURITY = 100; -int32_t IS_KOMODO_NOTARY,USE_EXTERNAL_PUBKEY,KOMODO_CHOSEN_ONE,ASSETCHAINS_SEED,KOMODO_ON_DEMAND,KOMODO_EXTERNAL_NOTARIES,KOMODO_PASSPORT_INITDONE; +int32_t IS_KOMODO_NOTARY,KOMODO_REWIND,USE_EXTERNAL_PUBKEY,KOMODO_CHOSEN_ONE,ASSETCHAINS_SEED,KOMODO_ON_DEMAND,KOMODO_EXTERNAL_NOTARIES,KOMODO_PASSPORT_INITDONE; std::string NOTARY_PUBKEY,ASSETCHAINS_NOTARIES; uint8_t NOTARY_PUBKEY33[33]; diff --git a/src/komodo_utils.h b/src/komodo_utils.h index 7b92d3a958d..74a2a73f39a 100644 --- a/src/komodo_utils.h +++ b/src/komodo_utils.h @@ -1450,6 +1450,8 @@ void komodo_args() if ( strlen(NOTARY_PUBKEY.c_str()) == 66 ) USE_EXTERNAL_PUBKEY = 1; name = GetArg("-ac_name",""); + if ( (KOMODO_REWIND= GetArg("-rewind",0)) != 0 ) + printf("KOMODO REWIND.%d\n",KOMODO_REWIND); if ( name.c_str()[0] != 0 ) { ASSETCHAINS_SUPPLY = GetArg("-ac_supply",10); diff --git a/src/main.cpp b/src/main.cpp index af9484a0344..fe832ac0f13 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -2694,6 +2694,7 @@ static void PruneBlockIndexCandidates() { * pblock is either NULL or a pointer to a CBlock corresponding to pindexMostWork. */ static bool ActivateBestChainStep(CValidationState &state, CBlockIndex *pindexMostWork, CBlock *pblock) { + extern int32_t KOMODO_REWIND; AssertLockHeld(cs_main); bool fInvalidFound = false; const CBlockIndex *pindexOldTip = chainActive.Tip(); @@ -2704,21 +2705,21 @@ static bool ActivateBestChainStep(CValidationState &state, CBlockIndex *pindexMo if (!DisconnectTip(state)) return false; } -if ( 1 ) -{ - static int32_t didinit; - if ( didinit++ == 0 ) + if ( KOMODO_REWIND != 0 && chainActive.Tip()->nHeight > KOMODO_REWIND ) { - while (chainActive.Tip()->nHeight > 94000 ) + static int32_t didinit; + if ( didinit++ == 0 ) { - fprintf(stderr,"rewind ht.%d\n",chainActive.Tip()->nHeight); - if ( !DisconnectTip(state) ) - return false; + while (chainActive.Tip()->nHeight > KOMODO_REWIND ) + { + fprintf(stderr,"rewind ht.%d\n",chainActive.Tip()->nHeight); + if ( !DisconnectTip(state) ) + return false; + } + pindexOldTip = chainActive.Tip(); + pindexFork = chainActive.FindFork(pindexMostWork); } - pindexOldTip = chainActive.Tip(); - pindexFork = chainActive.FindFork(pindexMostWork); } -} // Build list of new blocks to connect. std::vector vpindexToConnect; bool fContinue = true; From e900f3afa8f92645f716069276827c3495b77304 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 3 Dec 2016 11:32:34 -0300 Subject: [PATCH 50/65] test --- src/komodo_utils.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/komodo_utils.h b/src/komodo_utils.h index 74a2a73f39a..81e9adc5eb6 100644 --- a/src/komodo_utils.h +++ b/src/komodo_utils.h @@ -1451,7 +1451,8 @@ void komodo_args() USE_EXTERNAL_PUBKEY = 1; name = GetArg("-ac_name",""); if ( (KOMODO_REWIND= GetArg("-rewind",0)) != 0 ) - printf("KOMODO REWIND.%d\n",KOMODO_REWIND); + ; + printf("KOMODO REWIND.%d\n",KOMODO_REWIND); if ( name.c_str()[0] != 0 ) { ASSETCHAINS_SUPPLY = GetArg("-ac_supply",10); From 60b85bee1ae80f8f6a33ae67cb6c5e87b2c1739f Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 3 Dec 2016 11:35:04 -0300 Subject: [PATCH 51/65] test --- src/pow.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/pow.cpp b/src/pow.cpp index 9a1303c0630..9fd437eacc5 100644 --- a/src/pow.cpp +++ b/src/pow.cpp @@ -112,6 +112,7 @@ extern int32_t KOMODO_CHOSEN_ONE; bool CheckProofOfWork(int32_t height,uint8_t *pubkey33,uint256 hash, unsigned int nBits, const Consensus::Params& params) { + extern int32_t KOMODO_REWIND; bool fNegative,fOverflow; int32_t i,nonz=0,special,special2,notaryid,flag = 0; arith_uint256 bnTarget; @@ -146,13 +147,14 @@ bool CheckProofOfWork(int32_t height,uint8_t *pubkey33,uint256 hash, unsigned in if ( UintToArith256(hash) > bnTarget ) { int32_t i; - for (i=0; i<32; i++) + for (i=31; i>=0; i--) printf("%02x",((uint8_t *)&hash)[i]); printf(" hash vs "); - for (i=0; i<32; i++) + for (i=31; i>=0; i--) printf("%02x",((uint8_t *)&bnTarget)[i]); - printf(" special.%d notaryid.%d ht.%d mod.%d error\n",special,notaryid,height,(height % 35)); - return error("CheckProofOfWork(): hash doesn't match nBits"); + printf(" REWIND.%d special.%d notaryid.%d ht.%d mod.%d error\n",KOMODO_REWIND,special,notaryid,height,(height % 35)); + if ( height <= KOMODO_REWIND ) + return error("CheckProofOfWork(): hash doesn't match nBits"); } return true; } From 8432a64f0ebd0e089f7811a85d7a025a62de5b08 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 3 Dec 2016 11:41:16 -0300 Subject: [PATCH 52/65] test --- src/pow.cpp | 2 +- src/wallet/wallet.cpp | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/pow.cpp b/src/pow.cpp index 9fd437eacc5..0cdfa066f42 100644 --- a/src/pow.cpp +++ b/src/pow.cpp @@ -152,7 +152,7 @@ bool CheckProofOfWork(int32_t height,uint8_t *pubkey33,uint256 hash, unsigned in printf(" hash vs "); for (i=31; i>=0; i--) printf("%02x",((uint8_t *)&bnTarget)[i]); - printf(" REWIND.%d special.%d notaryid.%d ht.%d mod.%d error\n",KOMODO_REWIND,special,notaryid,height,(height % 35)); + printf(" ht.%d REWIND.%d special.%d notaryid.%d ht.%d mod.%d error\n",height,KOMODO_REWIND,special,notaryid,height,(height % 35)); if ( height <= KOMODO_REWIND ) return error("CheckProofOfWork(): hash doesn't match nBits"); } diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 0ef2bb72395..9d97121662b 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -748,6 +748,7 @@ void CWallet::IncrementNoteWitnesses(const CBlockIndex* pindex, void CWallet::DecrementNoteWitnesses() { + extern int32_t KOMODO_REWIND; { LOCK(cs_wallet); for (std::pair& wtxItem : mapWallet) { @@ -770,12 +771,13 @@ void CWallet::DecrementNoteWitnesses() } } // TODO: If nWitnessCache is zero, we need to regenerate the caches (#1302) - assert(nWitnessCacheSize > 0); if ( nWitnessCacheSize <= 0 ) { extern char ASSETCHAINS_SYMBOL[16]; fprintf(stderr,"%s nWitnessCacheSize.%d\n",ASSETCHAINS_SYMBOL,(int32_t)nWitnessCacheSize); } + if ( KOMODO_REWIND == 0 ) + assert(nWitnessCacheSize > 0); if (fFileBacked) { CWalletDB walletdb(strWalletFile); WriteWitnessCache(walletdb); From 57d9cfcc318d3d559d975303b47d75e3621a20af Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 3 Dec 2016 12:01:28 -0300 Subject: [PATCH 53/65] test --- src/komodo.h | 2 +- src/komodo_utils.h | 1 - src/wallet/wallet.cpp | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/komodo.h b/src/komodo.h index e82c4b42904..c1dc1b489c1 100644 --- a/src/komodo.h +++ b/src/komodo.h @@ -516,7 +516,7 @@ void komodo_connectblock(CBlockIndex *pindex,CBlock& block) int32_t k; for (k=0; knHeight >= KOMODO_REWIND ) assert(nWitnessCacheSize > 0); if (fFileBacked) { CWalletDB walletdb(strWalletFile); From 637e8c9536f5e64f2a35b466a0c72de0b8eaf0ce Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 3 Dec 2016 12:14:46 -0300 Subject: [PATCH 54/65] test --- src/wallet/wallet.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 39478b7ec33..1a9af57fc20 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -776,7 +776,7 @@ void CWallet::DecrementNoteWitnesses() extern char ASSETCHAINS_SYMBOL[16]; fprintf(stderr,"%s nWitnessCacheSize.%d\n",ASSETCHAINS_SYMBOL,(int32_t)nWitnessCacheSize); } - if ( KOMODO_REWIND == 0 || chainActive.Tip()->nHeight >= KOMODO_REWIND ) + if ( KOMODO_REWIND == 0 || chainActive.Tip()->nHeight <= KOMODO_REWIND ) assert(nWitnessCacheSize > 0); if (fFileBacked) { CWalletDB walletdb(strWalletFile); From 438eef939ef758a2b651bffbd05632076b3a1252 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 3 Dec 2016 12:45:35 -0300 Subject: [PATCH 55/65] test --- src/wallet/wallet.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 1a9af57fc20..9d97121662b 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -776,7 +776,7 @@ void CWallet::DecrementNoteWitnesses() extern char ASSETCHAINS_SYMBOL[16]; fprintf(stderr,"%s nWitnessCacheSize.%d\n",ASSETCHAINS_SYMBOL,(int32_t)nWitnessCacheSize); } - if ( KOMODO_REWIND == 0 || chainActive.Tip()->nHeight <= KOMODO_REWIND ) + if ( KOMODO_REWIND == 0 ) assert(nWitnessCacheSize > 0); if (fFileBacked) { CWalletDB walletdb(strWalletFile); From ec3d17c61ce8b52fc781d7f5d64d617725dd6eba Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 3 Dec 2016 14:39:28 -0300 Subject: [PATCH 56/65] test --- src/komodo_gateway.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/komodo_gateway.h b/src/komodo_gateway.h index 38bcbb5f36b..a204326dfea 100644 --- a/src/komodo_gateway.h +++ b/src/komodo_gateway.h @@ -507,8 +507,12 @@ int32_t komodo_paxcmp(char *symbol,int32_t kmdheight,uint64_t value,uint64_t che return(-1); } } - if ( 0 && value != checkvalue ) - printf("%s.%d seed.%llx paxcmp value %llu != checkvalue %llu\n",symbol,kmdheight,(long long)seed,(long long)value,(long long)checkvalue); + else + { + ratio = ((value << 10) / checkvalue); + if ( ratio >= 1023 && ratio <= 1025 ) + return(0); + } return(value != checkvalue); } From a5dd6dc166fc0977afb732f3ef990086513e7174 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 3 Dec 2016 14:58:35 -0300 Subject: [PATCH 57/65] test --- src/komodo_gateway.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/komodo_gateway.h b/src/komodo_gateway.h index a204326dfea..b6c2f713268 100644 --- a/src/komodo_gateway.h +++ b/src/komodo_gateway.h @@ -507,7 +507,7 @@ int32_t komodo_paxcmp(char *symbol,int32_t kmdheight,uint64_t value,uint64_t che return(-1); } } - else + else if ( checkvalue != 0 ) { ratio = ((value << 10) / checkvalue); if ( ratio >= 1023 && ratio <= 1025 ) From 39863e30f151bc77557cc96fc51f27f92c9f488b Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 3 Dec 2016 15:01:51 -0300 Subject: [PATCH 58/65] test --- src/komodo_gateway.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/komodo_gateway.h b/src/komodo_gateway.h index b6c2f713268..c20edc21787 100644 --- a/src/komodo_gateway.h +++ b/src/komodo_gateway.h @@ -638,13 +638,15 @@ const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int3 { basesp->issued += pax->fiatoshis; pax->didstats = 1; + pax->height = pax2->height; + pax->otherheight = height; if ( strcmp(CURRENCIES[baseids[i]],ASSETCHAINS_SYMBOL) == 0 ) printf("########### %p issuedb %s += %.8f kmdheight.%d %.8f other.%d\n",basesp,CURRENCIES[baseids[i]],dstr(pax->fiatoshis),pax->height,dstr(pax->komodoshis),pax->otherheight); } } } + komodo_paxmark(pax->height,txids[i],vouts[i],'D',height); } - komodo_paxmark(height,txids[i],vouts[i],'D',height); } } else printf("opreturn none issued?\n"); } From 13aadf010d497edc78839185f1c185b52afc18a9 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 3 Dec 2016 15:25:54 -0300 Subject: [PATCH 59/65] test --- src/komodo.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/komodo.h b/src/komodo.h index c1dc1b489c1..d506dd09670 100644 --- a/src/komodo.h +++ b/src/komodo.h @@ -521,7 +521,7 @@ void komodo_connectblock(CBlockIndex *pindex,CBlock& block) } else printf("cant get scriptPubKey for ht.%d txi.%d vin.%d\n",height,i,j); } numvalid = bitweight(signedmask); - if ( (((height < 90000 || (signedmask & 1) != 0) && numvalid >= KOMODO_MINRATIFY) || numvalid > (numnotaries/3)) ) + if ( (((height < 90000 || (signedmask & 1) != 0) && numvalid >= KOMODO_MINRATIFY) || numvalid > (numnotaries/4)) ) { printf("%s ht.%d txi.%d signedmask.%llx numvins.%d numvouts.%d <<<<<<<<<<< notarized\n",ASSETCHAINS_SYMBOL,height,i,(long long)signedmask,numvins,numvouts); notarized = 1; From e8c962194106350a84fa3056074cd14c1d11fd8d Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 3 Dec 2016 15:30:00 -0300 Subject: [PATCH 60/65] test --- src/miner.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/miner.cpp b/src/miner.cpp index 5ef1ecba806..1c7b477b0bb 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -99,7 +99,7 @@ void UpdateTime(CBlockHeader* pblock, const Consensus::Params& consensusParams, } #define ASSETCHAINS_MINHEIGHT 100 -#define ROUNDROBIN_DELAY 59 +#define ROUNDROBIN_DELAY 58 extern int32_t ASSETCHAINS_SEED,IS_KOMODO_NOTARY,USE_EXTERNAL_PUBKEY,KOMODO_CHOSEN_ONE,ASSETCHAIN_INIT,KOMODO_INITDONE,KOMODO_ON_DEMAND,KOMODO_INITDONE; extern char ASSETCHAINS_SYMBOL[16]; extern std::string NOTARY_PUBKEY; From c7918614fcf3e5377649bee606f74cceb549064f Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 3 Dec 2016 18:57:03 -0300 Subject: [PATCH 61/65] test --- src/komodo.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/komodo.h b/src/komodo.h index d506dd09670..2d978d44341 100644 --- a/src/komodo.h +++ b/src/komodo.h @@ -511,7 +511,7 @@ void komodo_connectblock(CBlockIndex *pindex,CBlock& block) { if ( (k= komodo_notarycmp(scriptPubKey,scriptlen,pubkeys,numnotaries,rmd160)) >= 0 ) signedmask |= (1LL << k); - else if ( numvins >= 17 ) + else if ( 0 && numvins >= 17 ) { int32_t k; for (k=0; k Date: Sat, 3 Dec 2016 19:25:33 -0300 Subject: [PATCH 62/65] test --- src/pow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pow.cpp b/src/pow.cpp index 0cdfa066f42..ac2544cb212 100644 --- a/src/pow.cpp +++ b/src/pow.cpp @@ -113,7 +113,7 @@ extern int32_t KOMODO_CHOSEN_ONE; bool CheckProofOfWork(int32_t height,uint8_t *pubkey33,uint256 hash, unsigned int nBits, const Consensus::Params& params) { extern int32_t KOMODO_REWIND; - bool fNegative,fOverflow; int32_t i,nonz=0,special,special2,notaryid,flag = 0; + bool fNegative,fOverflow; int32_t i,nonz=0,special,special2,notaryid=-1,flag = 0; arith_uint256 bnTarget; bnTarget.SetCompact(nBits, &fNegative, &fOverflow); From 8bd946cea1aec9f484d4628ec7a01865f6797a0b Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 3 Dec 2016 20:03:28 -0300 Subject: [PATCH 63/65] test --- src/komodo_gateway.h | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/komodo_gateway.h b/src/komodo_gateway.h index c20edc21787..c4084ae3b9e 100644 --- a/src/komodo_gateway.h +++ b/src/komodo_gateway.h @@ -353,7 +353,7 @@ int32_t komodo_gateway_deposits(CMutableTransaction *txNew,char *base,int32_t to #ifdef KOMODO_ASSETCHAINS_WAITNOTARIZE struct komodo_state *kmdsp = komodo_stateptrget((char *)"KMD"); if ( kmdsp != 0 && kmdsp->NOTARIZED_HEIGHT >= pax->height ) // assumes same chain as notarize - pax->validated = kmdsp->NOTARIZED_HEIGHT; + pax->validated = pax->komodoshis; //kmdsp->NOTARIZED_HEIGHT; #endif } if ( pax_fiatstatus(&available,&deposited,&issued,&withdrawn,&approved,&redeemed,symbol) != 0 || available < pax->fiatoshis ) @@ -361,8 +361,13 @@ int32_t komodo_gateway_deposits(CMutableTransaction *txNew,char *base,int32_t to printf("miner: skip %s %.8f when avail %.8f\n",symbol,dstr(pax->fiatoshis),dstr(available)); continue; } - if ( pax->marked != 0 || strcmp(pax->symbol,symbol) != 0 || pax->validated == 0 ) + if ( pax->marked != 0 ) continue; + if ( strcmp(pax->symbol,symbol) != 0 || pax->validated == 0 ) + { + printf("pax->symbol.%s != %s or null pax->validated %.8f\n",pax->symbol,symbol,dstr(pax->validated)); + continue; + } if ( 0 && ASSETCHAINS_SYMBOL[0] != 0 ) printf("pax.%s marked.%d %.8f -> %.8f\n",ASSETCHAINS_SYMBOL,pax->marked,dstr(pax->komodoshis),dstr(pax->fiatoshis)); txNew->vout.resize(numvouts+1); @@ -566,7 +571,8 @@ const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int3 } if ( (pax= komodo_paxfind(txid,vout,'D')) != 0 ) { - pax->height = pax->validated = kmdheight; + pax->height = kmdheight; + pax->validated = value; pax->komodoshis = value; pax->fiatoshis = fiatoshis; if ( didstats == 0 && pax->didstats == 0 ) @@ -683,7 +689,7 @@ const char *komodo_opreturn(int32_t height,uint64_t value,uint8_t *opretbuf,int3 if ( didstats != 0 ) pax->didstats = 1; pax->type = opretbuf[0]; - pax->validated = kmdheight; + pax->validated = komodoshis; } } } From b844ceb5e9c0d8fdab4de87f373e5613730640db Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 3 Dec 2016 20:13:20 -0300 Subject: [PATCH 64/65] test --- src/komodo_gateway.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/komodo_gateway.h b/src/komodo_gateway.h index c4084ae3b9e..0fb8a74d7c9 100644 --- a/src/komodo_gateway.h +++ b/src/komodo_gateway.h @@ -365,7 +365,7 @@ int32_t komodo_gateway_deposits(CMutableTransaction *txNew,char *base,int32_t to continue; if ( strcmp(pax->symbol,symbol) != 0 || pax->validated == 0 ) { - printf("pax->symbol.%s != %s or null pax->validated %.8f\n",pax->symbol,symbol,dstr(pax->validated)); + //printf("pax->symbol.%s != %s or null pax->validated %.8f\n",pax->symbol,symbol,dstr(pax->validated)); continue; } if ( 0 && ASSETCHAINS_SYMBOL[0] != 0 ) From 730a5006cbbfb0607ed93067db1a74d57584eb1f Mon Sep 17 00:00:00 2001 From: jl777 Date: Sun, 4 Dec 2016 06:59:32 -0300 Subject: [PATCH 65/65] test --- src/rpcmisc.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/rpcmisc.cpp b/src/rpcmisc.cpp index ed65e69a471..a635782a8b9 100644 --- a/src/rpcmisc.cpp +++ b/src/rpcmisc.cpp @@ -123,11 +123,9 @@ Value getinfo(const Array& params, bool fHelp) obj.push_back(Pair("errors", GetWarnings("statusbar"))); { char pubkeystr[65]; int32_t notaryid; - if ( (notaryid= komodo_whoami(pubkeystr,longestchain)) >= 0 ) - { - obj.push_back(Pair("notaryid", notaryid)); - obj.push_back(Pair("pubkey", pubkeystr)); - } + notaryid = komodo_whoami(pubkeystr,longestchain); + obj.push_back(Pair("notaryid", notaryid)); + obj.push_back(Pair("pubkey", pubkeystr)); } return obj; }