From 7f81f5f6ffd44e01b30007c6882eb81b7d6cb16a Mon Sep 17 00:00:00 2001 From: jl777 Date: Sun, 31 Mar 2019 21:44:27 -1100 Subject: [PATCH 01/42] Allow 0 price for earlyblocks --- 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 d863c8a27..2eac0e7f4 100644 --- a/src/komodo_gateway.h +++ b/src/komodo_gateway.h @@ -1618,7 +1618,7 @@ int32_t komodo_pricecmp(int32_t nHeight,int32_t n,int32_t *maxflagp,uint32_t *pr *maxflagp = 0; for (i=1; i newprice.%u out of tolerance maxflag.%d\n",nHeight,i,n,pricebitsB[i],pricebitsA[i],newprice,*maxflagp); return(-1); From dc1b504b980b606e5a60f158335aab71db618466 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sun, 31 Mar 2019 21:48:54 -1100 Subject: [PATCH 02/42] Latch prevbits if new is 0 --- src/komodo_gateway.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/komodo_gateway.h b/src/komodo_gateway.h index 2eac0e7f4..1cc899f1a 100644 --- a/src/komodo_gateway.h +++ b/src/komodo_gateway.h @@ -1714,6 +1714,9 @@ int32_t komodo_opretvalidate(int32_t nHeight,CScript scriptPubKey) fprintf(stderr,"ht.%d: lag.%d %.4f USD, %.4f GBP, %.4f EUR, GBPUSD %.6f, EURUSD %.6f, EURGBP %.6f [%d]\n",nHeight,lag,btcusd,btcgbp,btceur,btcusd/btcgbp,btcusd/btceur,btcgbp/btceur,lag2); if ( komodo_heightpricebits(prevbits,nHeight-1) == 0 ) { + for (i=0; i Date: Sun, 31 Mar 2019 21:53:31 -1100 Subject: [PATCH 03/42] +print --- src/komodo_gateway.h | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/komodo_gateway.h b/src/komodo_gateway.h index 1cc899f1a..4d84fa19f 100644 --- a/src/komodo_gateway.h +++ b/src/komodo_gateway.h @@ -1590,7 +1590,7 @@ uint32_t komodo_pricenew(int32_t *maxflagp,uint32_t price,uint32_t refprice,int6 lowprice--; if ( price >= highprice ) { - //fprintf(stderr,"high %u vs h%llu l%llu tolerance.%llu\n",price,(long long)highprice,(long long)lowprice,(long long)tolerance); + fprintf(stderr,"high %u vs h%llu l%llu tolerance.%llu\n",price,(long long)highprice,(long long)lowprice,(long long)tolerance); if ( price > highprice ) // return non-zero only if we violate the tolerance { *maxflagp = 2; @@ -1618,7 +1618,7 @@ int32_t komodo_pricecmp(int32_t nHeight,int32_t n,int32_t *maxflagp,uint32_t *pr *maxflagp = 0; for (i=1; i= 500 || pricebitsB[i] != 0) && (newprice= komodo_pricenew(maxflagp,pricebitsA[i],pricebitsB[i],tolerance)) != 0 ) { fprintf(stderr,"ht.%d i.%d/%d %u vs %u -> newprice.%u out of tolerance maxflag.%d\n",nHeight,i,n,pricebitsB[i],pricebitsA[i],newprice,*maxflagp); return(-1); @@ -1714,9 +1714,12 @@ int32_t komodo_opretvalidate(int32_t nHeight,CScript scriptPubKey) fprintf(stderr,"ht.%d: lag.%d %.4f USD, %.4f GBP, %.4f EUR, GBPUSD %.6f, EURUSD %.6f, EURGBP %.6f [%d]\n",nHeight,lag,btcusd,btcgbp,btceur,btcusd/btcgbp,btcusd/btceur,btcgbp/btceur,lag2); if ( komodo_heightpricebits(prevbits,nHeight-1) == 0 ) { - for (i=0; i Date: Sun, 31 Mar 2019 21:56:44 -1100 Subject: [PATCH 04/42] 339 exemption --- 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 4d84fa19f..8fad25202 100644 --- a/src/komodo_gateway.h +++ b/src/komodo_gateway.h @@ -1720,7 +1720,7 @@ int32_t komodo_opretvalidate(int32_t nHeight,CScript scriptPubKey) if ( pricebits[i] == 0 ) pricebits[i] = prevbits[i]; } - if ( komodo_pricecmp(nHeight,n,&maxflag,pricebits,prevbits,PRICES_MAXCHANGE) < 0 ) + if ( nHeight != 339 && komodo_pricecmp(nHeight,n,&maxflag,pricebits,prevbits,PRICES_MAXCHANGE) < 0 ) { for (i=1; i Date: Sun, 31 Mar 2019 21:58:47 -1100 Subject: [PATCH 05/42] 340 --- 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 8fad25202..4aab886b5 100644 --- a/src/komodo_gateway.h +++ b/src/komodo_gateway.h @@ -1720,7 +1720,7 @@ int32_t komodo_opretvalidate(int32_t nHeight,CScript scriptPubKey) if ( pricebits[i] == 0 ) pricebits[i] = prevbits[i]; } - if ( nHeight != 339 && komodo_pricecmp(nHeight,n,&maxflag,pricebits,prevbits,PRICES_MAXCHANGE) < 0 ) + if ( nHeight != 340 && komodo_pricecmp(nHeight,n,&maxflag,pricebits,prevbits,PRICES_MAXCHANGE) < 0 ) { for (i=1; i Date: Sun, 31 Mar 2019 22:02:28 -1100 Subject: [PATCH 06/42] Skip first 500 --- 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 4aab886b5..c8a3d3c9f 100644 --- a/src/komodo_gateway.h +++ b/src/komodo_gateway.h @@ -1720,7 +1720,7 @@ int32_t komodo_opretvalidate(int32_t nHeight,CScript scriptPubKey) if ( pricebits[i] == 0 ) pricebits[i] = prevbits[i]; } - if ( nHeight != 340 && komodo_pricecmp(nHeight,n,&maxflag,pricebits,prevbits,PRICES_MAXCHANGE) < 0 ) + if ( nHeight < 500 && komodo_pricecmp(nHeight,n,&maxflag,pricebits,prevbits,PRICES_MAXCHANGE) < 0 ) { for (i=1; i Date: Sun, 31 Mar 2019 22:06:51 -1100 Subject: [PATCH 07/42] 500 --- src/komodo_gateway.h | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/komodo_gateway.h b/src/komodo_gateway.h index c8a3d3c9f..26bf2fcc3 100644 --- a/src/komodo_gateway.h +++ b/src/komodo_gateway.h @@ -1618,7 +1618,7 @@ int32_t komodo_pricecmp(int32_t nHeight,int32_t n,int32_t *maxflagp,uint32_t *pr *maxflagp = 0; for (i=1; i= 500 || pricebitsB[i] != 0) && (newprice= komodo_pricenew(maxflagp,pricebitsA[i],pricebitsB[i],tolerance)) != 0 ) + if ( (newprice= komodo_pricenew(maxflagp,pricebitsA[i],pricebitsB[i],tolerance)) != 0 ) { fprintf(stderr,"ht.%d i.%d/%d %u vs %u -> newprice.%u out of tolerance maxflag.%d\n",nHeight,i,n,pricebitsB[i],pricebitsA[i],newprice,*maxflagp); return(-1); @@ -1693,6 +1693,8 @@ int32_t komodo_opretvalidate(int32_t nHeight,CScript scriptPubKey) std::vector vopret; double btcusd,btcgbp,btceur; uint32_t localbits[8192],pricebits[8192],prevbits[8192],newprice; int32_t i,lag,lag2,n,maxflag=0; uint32_t now = (uint32_t)time(NULL); if ( ASSETCHAINS_CBOPRET != 0 ) { + if ( nHeight < 500 ) + return(0); GetOpReturnData(scriptPubKey,vopret); if ( vopret.size() >= PRICES_SIZEBIT0 ) { @@ -1714,13 +1716,13 @@ int32_t komodo_opretvalidate(int32_t nHeight,CScript scriptPubKey) fprintf(stderr,"ht.%d: lag.%d %.4f USD, %.4f GBP, %.4f EUR, GBPUSD %.6f, EURUSD %.6f, EURGBP %.6f [%d]\n",nHeight,lag,btcusd,btcgbp,btceur,btcusd/btcgbp,btcusd/btceur,btcgbp/btceur,lag2); if ( komodo_heightpricebits(prevbits,nHeight-1) == 0 ) { - if ( nHeight < 500 ) + /*if ( nHeight < 500 ) { for (i=0; i Date: Sun, 31 Mar 2019 22:09:36 -1100 Subject: [PATCH 08/42] 600 --- 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 26bf2fcc3..66a6f2515 100644 --- a/src/komodo_gateway.h +++ b/src/komodo_gateway.h @@ -1693,7 +1693,7 @@ int32_t komodo_opretvalidate(int32_t nHeight,CScript scriptPubKey) std::vector vopret; double btcusd,btcgbp,btceur; uint32_t localbits[8192],pricebits[8192],prevbits[8192],newprice; int32_t i,lag,lag2,n,maxflag=0; uint32_t now = (uint32_t)time(NULL); if ( ASSETCHAINS_CBOPRET != 0 ) { - if ( nHeight < 500 ) + if ( nHeight < 600 ) return(0); GetOpReturnData(scriptPubKey,vopret); if ( vopret.size() >= PRICES_SIZEBIT0 ) From 6e25432673f5cd2a9f8a00c64ec0ea9aef7e8a80 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sun, 31 Mar 2019 22:13:44 -1100 Subject: [PATCH 09/42] Fetch data first --- src/komodo_gateway.h | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/komodo_gateway.h b/src/komodo_gateway.h index 66a6f2515..e71b8cd4d 100644 --- a/src/komodo_gateway.h +++ b/src/komodo_gateway.h @@ -1691,9 +1691,11 @@ CScript komodo_mineropret(int32_t nHeight) int32_t komodo_opretvalidate(int32_t nHeight,CScript scriptPubKey) { std::vector vopret; double btcusd,btcgbp,btceur; uint32_t localbits[8192],pricebits[8192],prevbits[8192],newprice; int32_t i,lag,lag2,n,maxflag=0; uint32_t now = (uint32_t)time(NULL); - if ( ASSETCHAINS_CBOPRET != 0 ) + if ( ASSETCHAINS_CBOPRET != 0 && nHeight > 0 ) { - if ( nHeight < 600 ) + if ( komodo_heightpricebits(prevbits,nHeight-1) < 0 ) + return(-1); + if ( nHeight < 350 ) return(0); GetOpReturnData(scriptPubKey,vopret); if ( vopret.size() >= PRICES_SIZEBIT0 ) @@ -1714,7 +1716,7 @@ int32_t komodo_opretvalidate(int32_t nHeight,CScript scriptPubKey) btcgbp = (double)pricebits[2]/10000; btceur = (double)pricebits[3]/10000; fprintf(stderr,"ht.%d: lag.%d %.4f USD, %.4f GBP, %.4f EUR, GBPUSD %.6f, EURUSD %.6f, EURGBP %.6f [%d]\n",nHeight,lag,btcusd,btcgbp,btceur,btcusd/btcgbp,btcusd/btceur,btcgbp/btceur,lag2); - if ( komodo_heightpricebits(prevbits,nHeight-1) == 0 ) + //if ( komodo_heightpricebits(prevbits,nHeight-1) == 0 ) { /*if ( nHeight < 500 ) { @@ -1734,7 +1736,7 @@ int32_t komodo_opretvalidate(int32_t nHeight,CScript scriptPubKey) fprintf(stderr,"vs prev maxflag.%d cmp error\n",maxflag); return(-1); } // else this is the good case we hope to happen - } else return(-1); + } //else return(-1); if ( lag < ASSETCHAINS_BLOCKTIME && Mineropret.size() >= PRICES_SIZEBIT0 ) { memcpy(localbits,Mineropret.data(),Mineropret.size()); From 6d7828d809f684ac31ad5c8c2a5f4c42bbe86682 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sun, 31 Mar 2019 22:17:45 -1100 Subject: [PATCH 10/42] Test --- src/komodo_gateway.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/komodo_gateway.h b/src/komodo_gateway.h index e71b8cd4d..65487219d 100644 --- a/src/komodo_gateway.h +++ b/src/komodo_gateway.h @@ -1693,10 +1693,6 @@ int32_t komodo_opretvalidate(int32_t nHeight,CScript scriptPubKey) std::vector vopret; double btcusd,btcgbp,btceur; uint32_t localbits[8192],pricebits[8192],prevbits[8192],newprice; int32_t i,lag,lag2,n,maxflag=0; uint32_t now = (uint32_t)time(NULL); if ( ASSETCHAINS_CBOPRET != 0 && nHeight > 0 ) { - if ( komodo_heightpricebits(prevbits,nHeight-1) < 0 ) - return(-1); - if ( nHeight < 350 ) - return(0); GetOpReturnData(scriptPubKey,vopret); if ( vopret.size() >= PRICES_SIZEBIT0 ) { @@ -1704,6 +1700,10 @@ int32_t komodo_opretvalidate(int32_t nHeight,CScript scriptPubKey) memcpy(pricebits,vopret.data(),Mineropret.size()); if ( nHeight > 1 ) { + if ( komodo_heightpricebits(prevbits,nHeight-1) < 0 ) + return(-1); + if ( nHeight < 350 ) + return(0); lag = (int32_t)(now - pricebits[0]); lag2 = (int32_t)(komodo_heightstamp(nHeight-1) - pricebits[0]); if ( lag < -60 ) // avoid data from future From 5479c8ae392e69d861a23b2494a548c97dd51311 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sun, 31 Mar 2019 22:25:10 -1100 Subject: [PATCH 11/42] Test --- src/komodo_gateway.h | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/komodo_gateway.h b/src/komodo_gateway.h index 65487219d..fc410d5ad 100644 --- a/src/komodo_gateway.h +++ b/src/komodo_gateway.h @@ -1698,12 +1698,8 @@ int32_t komodo_opretvalidate(int32_t nHeight,CScript scriptPubKey) { n = (int32_t)(vopret.size() / sizeof(uint32_t)); memcpy(pricebits,vopret.data(),Mineropret.size()); - if ( nHeight > 1 ) + if ( nHeight > 1 && vopret.size() == Mineropret.size() ) { - if ( komodo_heightpricebits(prevbits,nHeight-1) < 0 ) - return(-1); - if ( nHeight < 350 ) - return(0); lag = (int32_t)(now - pricebits[0]); lag2 = (int32_t)(komodo_heightstamp(nHeight-1) - pricebits[0]); if ( lag < -60 ) // avoid data from future @@ -1769,6 +1765,8 @@ int32_t komodo_opretvalidate(int32_t nHeight,CScript scriptPubKey) } } } + else if ( nHeight > 500 ) + return(-1); return(0); } else fprintf(stderr,"wrong size %d vs %d, scriptPubKey size %d [%02x]\n",(int32_t)vopret.size(),(int32_t)Mineropret.size(),(int32_t)scriptPubKey.size(),scriptPubKey[0]); return(-1); From 0cba720dbd3fec82618add4880adaa6b0a0b6ac7 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sun, 31 Mar 2019 22:28:30 -1100 Subject: [PATCH 12/42] Test --- src/komodo_gateway.h | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/komodo_gateway.h b/src/komodo_gateway.h index fc410d5ad..f5149d473 100644 --- a/src/komodo_gateway.h +++ b/src/komodo_gateway.h @@ -1698,7 +1698,7 @@ int32_t komodo_opretvalidate(int32_t nHeight,CScript scriptPubKey) { n = (int32_t)(vopret.size() / sizeof(uint32_t)); memcpy(pricebits,vopret.data(),Mineropret.size()); - if ( nHeight > 1 && vopret.size() == Mineropret.size() ) + if ( nHeight > 1 ) { lag = (int32_t)(now - pricebits[0]); lag2 = (int32_t)(komodo_heightstamp(nHeight-1) - pricebits[0]); @@ -1712,14 +1712,14 @@ int32_t komodo_opretvalidate(int32_t nHeight,CScript scriptPubKey) btcgbp = (double)pricebits[2]/10000; btceur = (double)pricebits[3]/10000; fprintf(stderr,"ht.%d: lag.%d %.4f USD, %.4f GBP, %.4f EUR, GBPUSD %.6f, EURUSD %.6f, EURGBP %.6f [%d]\n",nHeight,lag,btcusd,btcgbp,btceur,btcusd/btcgbp,btcusd/btceur,btcgbp/btceur,lag2); - //if ( komodo_heightpricebits(prevbits,nHeight-1) == 0 ) + if ( komodo_heightpricebits(prevbits,nHeight-1) == 0 ) { - /*if ( nHeight < 500 ) + if ( nHeight < 500 ) { for (i=0; i 500 ) - return(-1); return(0); } else fprintf(stderr,"wrong size %d vs %d, scriptPubKey size %d [%02x]\n",(int32_t)vopret.size(),(int32_t)Mineropret.size(),(int32_t)scriptPubKey.size(),scriptPubKey[0]); return(-1); From 485376098a763386dab77d14039412d2f8623f85 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sun, 31 Mar 2019 22:32:03 -1100 Subject: [PATCH 13/42] 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 f5149d473..06ed31474 100644 --- a/src/komodo_gateway.h +++ b/src/komodo_gateway.h @@ -1730,7 +1730,8 @@ int32_t komodo_opretvalidate(int32_t nHeight,CScript scriptPubKey) fprintf(stderr," newprices.%d\n",nHeight); fprintf(stderr,"vs prev maxflag.%d cmp error\n",maxflag); - return(-1); + if ( nHeight != 339 ) + return(-1); } // else this is the good case we hope to happen } //else return(-1); if ( lag < ASSETCHAINS_BLOCKTIME && Mineropret.size() >= PRICES_SIZEBIT0 ) From dd851e864413a33986ef3b3b8dda7dd7bdbcfeee Mon Sep 17 00:00:00 2001 From: jl777 Date: Sun, 31 Mar 2019 22:37:49 -1100 Subject: [PATCH 14/42] 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 06ed31474..86d1ab541 100644 --- a/src/komodo_gateway.h +++ b/src/komodo_gateway.h @@ -1730,7 +1730,7 @@ int32_t komodo_opretvalidate(int32_t nHeight,CScript scriptPubKey) fprintf(stderr," newprices.%d\n",nHeight); fprintf(stderr,"vs prev maxflag.%d cmp error\n",maxflag); - if ( nHeight != 339 ) + if ( nHeight != 339 && nHeight != 340 ) return(-1); } // else this is the good case we hope to happen } //else return(-1); From 46d59bf1d71ee46449971b469b0a3896d53f8cd0 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sun, 31 Mar 2019 22:39:42 -1100 Subject: [PATCH 15/42] 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 86d1ab541..79b6642e5 100644 --- a/src/komodo_gateway.h +++ b/src/komodo_gateway.h @@ -1730,7 +1730,7 @@ int32_t komodo_opretvalidate(int32_t nHeight,CScript scriptPubKey) fprintf(stderr," newprices.%d\n",nHeight); fprintf(stderr,"vs prev maxflag.%d cmp error\n",maxflag); - if ( nHeight != 339 && nHeight != 340 ) + if ( nHeight != 339 && nHeight != 340 && nHeight != 341 ) return(-1); } // else this is the good case we hope to happen } //else return(-1); From 7291a4fc73eef6d59654ca875d7b261c7b718c75 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sun, 31 Mar 2019 22:41:25 -1100 Subject: [PATCH 16/42] 500 --- 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 79b6642e5..5f8c6d134 100644 --- a/src/komodo_gateway.h +++ b/src/komodo_gateway.h @@ -1730,7 +1730,7 @@ int32_t komodo_opretvalidate(int32_t nHeight,CScript scriptPubKey) fprintf(stderr," newprices.%d\n",nHeight); fprintf(stderr,"vs prev maxflag.%d cmp error\n",maxflag); - if ( nHeight != 339 && nHeight != 340 && nHeight != 341 ) + if ( nHeight > 500 ) return(-1); } // else this is the good case we hope to happen } //else return(-1); From 1ee8042e98fb12215121fcb5b61edeb5ac69965e Mon Sep 17 00:00:00 2001 From: jl777 Date: Sun, 31 Mar 2019 22:43:38 -1100 Subject: [PATCH 17/42] Test --- src/komodo_gateway.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/komodo_gateway.h b/src/komodo_gateway.h index 5f8c6d134..be262b24f 100644 --- a/src/komodo_gateway.h +++ b/src/komodo_gateway.h @@ -1714,12 +1714,12 @@ int32_t komodo_opretvalidate(int32_t nHeight,CScript scriptPubKey) fprintf(stderr,"ht.%d: lag.%d %.4f USD, %.4f GBP, %.4f EUR, GBPUSD %.6f, EURUSD %.6f, EURGBP %.6f [%d]\n",nHeight,lag,btcusd,btcgbp,btceur,btcusd/btcgbp,btcusd/btceur,btcgbp/btceur,lag2); if ( komodo_heightpricebits(prevbits,nHeight-1) == 0 ) { - if ( nHeight < 500 ) + /*if ( nHeight < 500 ) { for (i=0; i 500 ) + //if ( nHeight > 500 ) return(-1); } // else this is the good case we hope to happen } //else return(-1); From 0792e959c86a4cf3f635c5af02d20346685cb0c3 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sun, 31 Mar 2019 22:54:42 -1100 Subject: [PATCH 18/42] CBOPRET reconsider --- src/main.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index b73a31856..bac0def5d 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -4120,7 +4120,14 @@ bool static ConnectTip(CValidationState &state, CBlockIndex *pindexNew, CBlock * GetMainSignals().BlockChecked(*pblock, state); if (!rv) { if (state.IsInvalid()) + { InvalidBlockFound(pindexNew, state); + if ( ASSETCHAINS_CBOPRET != 0 ) + { + pindex->nStatus &= ~BLOCK_FAILED_MASK; + fprinf(stderr,"reconsiderblock %d\n",(int32_t)pindex->nHeight); + } + } return error("ConnectTip(): ConnectBlock %s failed", pindexNew->GetBlockHash().ToString()); } mapBlockSource.erase(pindexNew->GetBlockHash()); @@ -5211,7 +5218,7 @@ bool AcceptBlockHeader(int32_t *futureblockp,const CBlockHeader& block, CValidat miSelf->second = pindex = AddToBlockIndex(block); if (ppindex) *ppindex = pindex; - if ( pindex != 0 && pindex->nStatus & BLOCK_FAILED_MASK ) + if ( pindex != 0 && (pindex->nStatus & BLOCK_FAILED_MASK) != 0 ) { if ( ASSETCHAINS_CC == 0 )//&& (ASSETCHAINS_PRIVATE == 0 || KOMODO_INSYNC >= Params().GetConsensus().vUpgrades[Consensus::UPGRADE_SAPLING].nActivationHeight) ) return state.Invalid(error("%s: block is marked invalid", __func__), 0, "duplicate"); From f7a881d1b3a0b411cf522951a9e4b14fb4609093 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sun, 31 Mar 2019 22:55:46 -1100 Subject: [PATCH 19/42] pindexNew --- src/main.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index bac0def5d..8a139c247 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -4124,8 +4124,8 @@ bool static ConnectTip(CValidationState &state, CBlockIndex *pindexNew, CBlock * InvalidBlockFound(pindexNew, state); if ( ASSETCHAINS_CBOPRET != 0 ) { - pindex->nStatus &= ~BLOCK_FAILED_MASK; - fprinf(stderr,"reconsiderblock %d\n",(int32_t)pindex->nHeight); + pindexNew->nStatus &= ~BLOCK_FAILED_MASK; + fprinf(stderr,"reconsiderblock %d\n",(int32_t)pindexNew->nHeight); } } return error("ConnectTip(): ConnectBlock %s failed", pindexNew->GetBlockHash().ToString()); From baacd254e3abef202f9c8674b8363f6407f3412c Mon Sep 17 00:00:00 2001 From: jl777 Date: Sun, 31 Mar 2019 22:56:55 -1100 Subject: [PATCH 20/42] fprinTf --- src/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index 8a139c247..e8e1e554c 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -4125,7 +4125,7 @@ bool static ConnectTip(CValidationState &state, CBlockIndex *pindexNew, CBlock * if ( ASSETCHAINS_CBOPRET != 0 ) { pindexNew->nStatus &= ~BLOCK_FAILED_MASK; - fprinf(stderr,"reconsiderblock %d\n",(int32_t)pindexNew->nHeight); + fprintf(stderr,"reconsiderblock %d\n",(int32_t)pindexNew->nHeight); } } return error("ConnectTip(): ConnectBlock %s failed", pindexNew->GetBlockHash().ToString()); From 1af4f989ac9c1fa7f91198bf1685d208d1fa6940 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sun, 31 Mar 2019 22:58:52 -1100 Subject: [PATCH 21/42] GetHeight() --- src/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index e8e1e554c..be516c25d 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -4125,7 +4125,7 @@ bool static ConnectTip(CValidationState &state, CBlockIndex *pindexNew, CBlock * if ( ASSETCHAINS_CBOPRET != 0 ) { pindexNew->nStatus &= ~BLOCK_FAILED_MASK; - fprintf(stderr,"reconsiderblock %d\n",(int32_t)pindexNew->nHeight); + fprintf(stderr,"reconsiderblock %d\n",(int32_t)pindexNew->GetHeight()); } } return error("ConnectTip(): ConnectBlock %s failed", pindexNew->GetBlockHash().ToString()); From 6b7f7d91aeb6a51d716f6aee0fcb39728d81bd5d Mon Sep 17 00:00:00 2001 From: jl777 Date: Sun, 31 Mar 2019 23:01:10 -1100 Subject: [PATCH 22/42] Test --- src/main.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index be516c25d..1036670d6 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -4122,11 +4122,11 @@ bool static ConnectTip(CValidationState &state, CBlockIndex *pindexNew, CBlock * if (state.IsInvalid()) { InvalidBlockFound(pindexNew, state); - if ( ASSETCHAINS_CBOPRET != 0 ) + /*if ( ASSETCHAINS_CBOPRET != 0 ) { pindexNew->nStatus &= ~BLOCK_FAILED_MASK; fprintf(stderr,"reconsiderblock %d\n",(int32_t)pindexNew->GetHeight()); - } + }*/ } return error("ConnectTip(): ConnectBlock %s failed", pindexNew->GetBlockHash().ToString()); } From 7a739655e4b616ae4436559c5bf35718e6c35855 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sun, 31 Mar 2019 23:07:55 -1100 Subject: [PATCH 23/42] 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 be262b24f..60bf83006 100644 --- a/src/komodo_gateway.h +++ b/src/komodo_gateway.h @@ -1687,6 +1687,10 @@ CScript komodo_mineropret(int32_t nHeight) The only way komodo_opretvalidate() doesnt return an error is if maxflag is set or it is within tolerance of both the prior block and the local data. The local data validation only happens if it is a recent block and not a block from the past as the local node is only getting the current price data. */ +// reconsiderblock 002aca768b09dfcf36bd934ab34b23983148b116e12cb0b6e1a3f895d1db63aa +// and +// reconsiderblock 0034cf582018eacc0b4ae001491ce460113514cb1a3f217567ef4a2207de361a +// are needed to sync past initial blocks with different data set int32_t komodo_opretvalidate(int32_t nHeight,CScript scriptPubKey) { @@ -1714,12 +1718,12 @@ int32_t komodo_opretvalidate(int32_t nHeight,CScript scriptPubKey) fprintf(stderr,"ht.%d: lag.%d %.4f USD, %.4f GBP, %.4f EUR, GBPUSD %.6f, EURUSD %.6f, EURGBP %.6f [%d]\n",nHeight,lag,btcusd,btcgbp,btceur,btcusd/btcgbp,btcusd/btceur,btcgbp/btceur,lag2); if ( komodo_heightpricebits(prevbits,nHeight-1) == 0 ) { - /*if ( nHeight < 500 ) + if ( nHeight < 500 ) { for (i=0; i 500 ) - return(-1); + return(-1); } // else this is the good case we hope to happen } //else return(-1); if ( lag < ASSETCHAINS_BLOCKTIME && Mineropret.size() >= PRICES_SIZEBIT0 ) From 31580754dbd6b13c1c1bdfac909061ff33bb2674 Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 1 Apr 2019 02:30:27 -1100 Subject: [PATCH 24/42] Always do the clamp check --- src/komodo_gateway.h | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/src/komodo_gateway.h b/src/komodo_gateway.h index 60bf83006..c964f19ee 100644 --- a/src/komodo_gateway.h +++ b/src/komodo_gateway.h @@ -1577,7 +1577,7 @@ int32_t komodo_heightpricebits(uint32_t prevbits[4],int32_t nHeight) /* komodo_pricenew() is passed in a reference price, the change tolerance and the proposed price. it needs to return a clipped price if it is too big and also set a flag if it is at or above the limit */ -uint32_t komodo_pricenew(int32_t *maxflagp,uint32_t price,uint32_t refprice,int64_t tolerance) +uint32_t komodo_pricenew(char *maxflagp,uint32_t price,uint32_t refprice,int64_t tolerance) { uint64_t highprice,lowprice; if ( refprice < 2 ) @@ -1612,13 +1612,12 @@ uint32_t komodo_pricenew(int32_t *maxflagp,uint32_t price,uint32_t refprice,int6 } // komodo_pricecmp() returns -1 if any of the prices are beyond the tolerance -int32_t komodo_pricecmp(int32_t nHeight,int32_t n,int32_t *maxflagp,uint32_t *pricebitsA,uint32_t *pricebitsB,int64_t tolerance) +int32_t komodo_pricecmp(int32_t nHeight,int32_t n,char *maxflags,uint32_t *pricebitsA,uint32_t *pricebitsB,int64_t tolerance) { int32_t i; uint32_t newprice; - *maxflagp = 0; for (i=1; i newprice.%u out of tolerance maxflag.%d\n",nHeight,i,n,pricebitsB[i],pricebitsA[i],newprice,*maxflagp); return(-1); @@ -1646,7 +1645,7 @@ int32_t komodo_priceclamp(int32_t n,uint32_t *pricebits,uint32_t *refprices,int6 // komodo_mineropret() returns a valid pricedata to add to the coinbase opreturn for nHeight CScript komodo_mineropret(int32_t nHeight) { - CScript opret; uint32_t pricebits[8192],prevbits[8192]; int32_t maxflag,i,n,numzero=0; + CScript opret; char maxflags[8192]; uint32_t pricebits[8192],prevbits[8192]; int32_t maxflag,i,n,numzero=0; if ( Mineropret.size() >= PRICES_SIZEBIT0 ) { n = (int32_t)(Mineropret.size() / sizeof(uint32_t)); @@ -1663,7 +1662,8 @@ CScript komodo_mineropret(int32_t nHeight) if ( komodo_heightpricebits(prevbits,nHeight-1) == 0 ) { memcpy(pricebits,Mineropret.data(),Mineropret.size()); - if ( komodo_pricecmp(0,n,&maxflag,pricebits,prevbits,PRICES_MAXCHANGE) < 0 ) + memset(maxflags,0,sizeof(maxflags)); + if ( komodo_pricecmp(0,n,maxflags,pricebits,prevbits,PRICES_MAXCHANGE) < 0 ) { // if the new prices are outside tolerance, update Mineropret with clamped prices komodo_priceclamp(n,pricebits,prevbits,PRICES_MAXCHANGE); @@ -1690,11 +1690,12 @@ CScript komodo_mineropret(int32_t nHeight) // reconsiderblock 002aca768b09dfcf36bd934ab34b23983148b116e12cb0b6e1a3f895d1db63aa // and // reconsiderblock 0034cf582018eacc0b4ae001491ce460113514cb1a3f217567ef4a2207de361a +// reconsiderbloc 000abf51c023b64af327c50c1b060797b8cb281c696d30ab92fd002a8b8c9aea // are needed to sync past initial blocks with different data set int32_t komodo_opretvalidate(int32_t nHeight,CScript scriptPubKey) { - std::vector vopret; double btcusd,btcgbp,btceur; uint32_t localbits[8192],pricebits[8192],prevbits[8192],newprice; int32_t i,lag,lag2,n,maxflag=0; uint32_t now = (uint32_t)time(NULL); + std::vector vopret; char maxflags[8192]; double btcusd,btcgbp,btceur; uint32_t localbits[8192],pricebits[8192],prevbits[8192],newprice; int32_t i,lag,lag2,n; uint32_t now = (uint32_t)time(NULL); if ( ASSETCHAINS_CBOPRET != 0 && nHeight > 0 ) { GetOpReturnData(scriptPubKey,vopret); @@ -1702,6 +1703,7 @@ int32_t komodo_opretvalidate(int32_t nHeight,CScript scriptPubKey) { n = (int32_t)(vopret.size() / sizeof(uint32_t)); memcpy(pricebits,vopret.data(),Mineropret.size()); + memset(maxflags,0,sizeof(maxflags)); if ( nHeight > 1 ) { lag = (int32_t)(now - pricebits[0]); @@ -1724,7 +1726,7 @@ int32_t komodo_opretvalidate(int32_t nHeight,CScript scriptPubKey) if ( pricebits[i] == 0 ) pricebits[i] = prevbits[i]; } - if ( komodo_pricecmp(nHeight,n,&maxflag,pricebits,prevbits,PRICES_MAXCHANGE) < 0 ) + if ( komodo_pricecmp(nHeight,n,maxflags,pricebits,prevbits,PRICES_MAXCHANGE) < 0 ) { for (i=1; i Date: Mon, 1 Apr 2019 02:32:20 -1100 Subject: [PATCH 25/42] Maxflag --- src/komodo_gateway.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/komodo_gateway.h b/src/komodo_gateway.h index c964f19ee..d90016ee4 100644 --- a/src/komodo_gateway.h +++ b/src/komodo_gateway.h @@ -1619,7 +1619,7 @@ int32_t komodo_pricecmp(int32_t nHeight,int32_t n,char *maxflags,uint32_t *price { if ( (newprice= komodo_pricenew(&maxflags[i],pricebitsA[i],pricebitsB[i],tolerance)) != 0 ) { - fprintf(stderr,"ht.%d i.%d/%d %u vs %u -> newprice.%u out of tolerance maxflag.%d\n",nHeight,i,n,pricebitsB[i],pricebitsA[i],newprice,*maxflagp); + fprintf(stderr,"ht.%d i.%d/%d %u vs %u -> newprice.%u out of tolerance maxflag.%d\n",nHeight,i,n,pricebitsB[i],pricebitsA[i],newprice,maxflags[i]); return(-1); } } @@ -1695,7 +1695,7 @@ CScript komodo_mineropret(int32_t nHeight) int32_t komodo_opretvalidate(int32_t nHeight,CScript scriptPubKey) { - std::vector vopret; char maxflags[8192]; double btcusd,btcgbp,btceur; uint32_t localbits[8192],pricebits[8192],prevbits[8192],newprice; int32_t i,lag,lag2,n; uint32_t now = (uint32_t)time(NULL); + std::vector vopret; char maxflags[8192]; double btcusd,btcgbp,btceur; uint32_t localbits[8192],pricebits[8192],prevbits[8192],newprice; int32_t i,maxflag,lag,lag2,n; uint32_t now = (uint32_t)time(NULL); if ( ASSETCHAINS_CBOPRET != 0 && nHeight > 0 ) { GetOpReturnData(scriptPubKey,vopret); From a3c6ea84f9e14db1be10281f124d2f822f8b7525 Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 1 Apr 2019 02:34:02 -1100 Subject: [PATCH 26/42] 2048 --- src/komodo_gateway.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/komodo_gateway.h b/src/komodo_gateway.h index d90016ee4..0b94ccda4 100644 --- a/src/komodo_gateway.h +++ b/src/komodo_gateway.h @@ -1629,10 +1629,10 @@ int32_t komodo_pricecmp(int32_t nHeight,int32_t n,char *maxflags,uint32_t *price // komodo_priceclamp() clamps any price that is beyond tolerance int32_t komodo_priceclamp(int32_t n,uint32_t *pricebits,uint32_t *refprices,int64_t tolerance) { - int32_t i,maxflag; uint32_t newprice; + int32_t i; uint32_t newprice; char maxflags[2048]; + memset(maxflags,0,sizeof(maxflags)); for (i=1; i %u\n",i,n,refprices[i],pricebits[i],newprice); @@ -1645,7 +1645,7 @@ int32_t komodo_priceclamp(int32_t n,uint32_t *pricebits,uint32_t *refprices,int6 // komodo_mineropret() returns a valid pricedata to add to the coinbase opreturn for nHeight CScript komodo_mineropret(int32_t nHeight) { - CScript opret; char maxflags[8192]; uint32_t pricebits[8192],prevbits[8192]; int32_t maxflag,i,n,numzero=0; + CScript opret; char maxflags[2048]; uint32_t pricebits[2048],prevbits[2048]; int32_t maxflag,i,n,numzero=0; if ( Mineropret.size() >= PRICES_SIZEBIT0 ) { n = (int32_t)(Mineropret.size() / sizeof(uint32_t)); @@ -1695,7 +1695,7 @@ CScript komodo_mineropret(int32_t nHeight) int32_t komodo_opretvalidate(int32_t nHeight,CScript scriptPubKey) { - std::vector vopret; char maxflags[8192]; double btcusd,btcgbp,btceur; uint32_t localbits[8192],pricebits[8192],prevbits[8192],newprice; int32_t i,maxflag,lag,lag2,n; uint32_t now = (uint32_t)time(NULL); + std::vector vopret; char maxflags[2048]; double btcusd,btcgbp,btceur; uint32_t localbits[2048],pricebits[2048],prevbits[2048],newprice; int32_t i,maxflag,lag,lag2,n; uint32_t now = (uint32_t)time(NULL); if ( ASSETCHAINS_CBOPRET != 0 && nHeight > 0 ) { GetOpReturnData(scriptPubKey,vopret); From 32c65f4686d999b11a419cf9a37ff6b25de90b04 Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 1 Apr 2019 02:35:07 -1100 Subject: [PATCH 27/42] &maxflags[I] --- 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 0b94ccda4..22952230e 100644 --- a/src/komodo_gateway.h +++ b/src/komodo_gateway.h @@ -1633,7 +1633,7 @@ int32_t komodo_priceclamp(int32_t n,uint32_t *pricebits,uint32_t *refprices,int6 memset(maxflags,0,sizeof(maxflags)); for (i=1; i %u\n",i,n,refprices[i],pricebits[i],newprice); pricebits[i] = newprice; From 16eddc774c639f755a0f58497ddee700557958ec Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 1 Apr 2019 03:06:38 -1100 Subject: [PATCH 28/42] Cleanup code --- src/komodo_gateway.h | 36 +++++++++++++----------------------- 1 file changed, 13 insertions(+), 23 deletions(-) diff --git a/src/komodo_gateway.h b/src/komodo_gateway.h index 22952230e..2f5dfc5c5 100644 --- a/src/komodo_gateway.h +++ b/src/komodo_gateway.h @@ -1738,36 +1738,26 @@ int32_t komodo_opretvalidate(int32_t nHeight,CScript scriptPubKey) fprintf(stderr,"vs prev maxflag.%d cmp error\n",maxflag); return(-1); } // else this is the good case we hope to happen - } //else return(-1); + } else return(-1); if ( lag < ASSETCHAINS_BLOCKTIME && Mineropret.size() >= PRICES_SIZEBIT0 ) { memcpy(localbits,Mineropret.data(),Mineropret.size()); - for (i=0; i 0 && localbits[i] < prevbits[i] ) - return(-1); - else if ( maxflag < 0 && localbits[i] > prevbits[i] ) - return(-1); - } + // make sure local price is moving in right direction + fprintf(stderr,"maxflag.%d i.%d localbits.%u vs pricebits.%u\n",maxflag,i,localbits[i],pricebits[i]); + if ( maxflag > 0 && localbits[i] < prevbits[i] ) + return(-1); + else if ( maxflag < 0 && localbits[i] > prevbits[i] ) + return(-1); } } } From 19f067493995ba4e8f864de7ac52dc03c62df9b5 Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 1 Apr 2019 04:22:00 -1100 Subject: [PATCH 29/42] Tweak print --- 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 2f5dfc5c5..932efd051 100644 --- a/src/komodo_gateway.h +++ b/src/komodo_gateway.h @@ -1692,6 +1692,8 @@ CScript komodo_mineropret(int32_t nHeight) // reconsiderblock 0034cf582018eacc0b4ae001491ce460113514cb1a3f217567ef4a2207de361a // reconsiderbloc 000abf51c023b64af327c50c1b060797b8cb281c696d30ab92fd002a8b8c9aea // are needed to sync past initial blocks with different data set +// pass in blockhash and nTime, latch if it is rejected due to local price, then if localprice changes in a way that would validate then issue reconsiderblock +// add rpc call for extracting rawprices int32_t komodo_opretvalidate(int32_t nHeight,CScript scriptPubKey) { @@ -1753,7 +1755,7 @@ int32_t komodo_opretvalidate(int32_t nHeight,CScript scriptPubKey) if ( (maxflag= maxflags[i]) != 0 ) { // make sure local price is moving in right direction - fprintf(stderr,"maxflag.%d i.%d localbits.%u vs pricebits.%u\n",maxflag,i,localbits[i],pricebits[i]); + fprintf(stderr,"maxflag.%d i.%d localbits.%u vs pricebits.%u prevbits.%u\n",maxflag,i,localbits[i],pricebits[i],prevbits[i]); if ( maxflag > 0 && localbits[i] < prevbits[i] ) return(-1); else if ( maxflag < 0 && localbits[i] > prevbits[i] ) From cf38e77da5fa12dc252f0f34ed930d2deae0a443 Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 1 Apr 2019 05:36:21 -1100 Subject: [PATCH 30/42] Change to 150000 activation --- 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 38f9041c1..eefccd32a 100644 --- a/src/komodo_bitcoind.h +++ b/src/komodo_bitcoind.h @@ -1237,7 +1237,7 @@ uint64_t komodo_commission(const CBlock *pblock,int32_t height) n = pblock->vtx[i].vout.size(); for (j=0; j 100000 && ASSETCHAINS_STAKED != 0 && txn_count > 1 && i == txn_count-1 && j == n-1 ) + if ( height > 150000 && ASSETCHAINS_STAKED != 0 && txn_count > 1 && i == txn_count-1 && j == n-1 ) break; //fprintf(stderr,"(%d %.8f).%d ",i,dstr(pblock->vtx[i].vout[j].nValue),j); if ( i != 0 || j != 1 ) From fc12fd86d332edca0dfdd8cd36e9baad04945250 Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 1 Apr 2019 05:39:46 -1100 Subject: [PATCH 31/42] 225k activation --- 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 eefccd32a..e537df018 100644 --- a/src/komodo_bitcoind.h +++ b/src/komodo_bitcoind.h @@ -1237,7 +1237,7 @@ uint64_t komodo_commission(const CBlock *pblock,int32_t height) n = pblock->vtx[i].vout.size(); for (j=0; j 150000 && ASSETCHAINS_STAKED != 0 && txn_count > 1 && i == txn_count-1 && j == n-1 ) + if ( height > 225000 && ASSETCHAINS_STAKED != 0 && txn_count > 1 && i == txn_count-1 && j == n-1 ) break; //fprintf(stderr,"(%d %.8f).%d ",i,dstr(pblock->vtx[i].vout[j].nValue),j); if ( i != 0 || j != 1 ) From ddc0fb6de14f2f866c26175ba56ed650f42dc4f3 Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 1 Apr 2019 20:09:38 -1100 Subject: [PATCH 32/42] Check for lag2 --- src/komodo_gateway.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/komodo_gateway.h b/src/komodo_gateway.h index 932efd051..10c8718d9 100644 --- a/src/komodo_gateway.h +++ b/src/komodo_gateway.h @@ -1712,7 +1712,12 @@ int32_t komodo_opretvalidate(int32_t nHeight,CScript scriptPubKey) lag2 = (int32_t)(komodo_heightstamp(nHeight-1) - pricebits[0]); if ( lag < -60 ) // avoid data from future { - fprintf(stderr,"now.%u htstamp.%u - pricebits[0] %u -> lag.%d\n",now,komodo_heightstamp(nHeight-1),pricebits[0],lag2); + fprintf(stderr,"now.%u htstamp.%u - pricebits[0] %u -> lag.%d\n",now,komodo_heightstamp(nHeight-1),pricebits[0],lag); + return(-1); + } + if ( lag2 < 0 ) + { + fprintf(stderr,"now.%u htstamp.%u - pricebits[0] %u -> lag2.%d\n",now,komodo_heightstamp(nHeight-1),pricebits[0],lag2); return(-1); } // else need to check against current blocktime to prevent pricebits[0] games From 5150bed539d194da8212b8e863b669341e6b03fa Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 1 Apr 2019 20:16:42 -1100 Subject: [PATCH 33/42] Skip block 1 --- src/komodo_gateway.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/komodo_gateway.h b/src/komodo_gateway.h index 10c8718d9..b8a62792a 100644 --- a/src/komodo_gateway.h +++ b/src/komodo_gateway.h @@ -1706,7 +1706,7 @@ int32_t komodo_opretvalidate(int32_t nHeight,CScript scriptPubKey) n = (int32_t)(vopret.size() / sizeof(uint32_t)); memcpy(pricebits,vopret.data(),Mineropret.size()); memset(maxflags,0,sizeof(maxflags)); - if ( nHeight > 1 ) + if ( nHeight > 2 ) { lag = (int32_t)(now - pricebits[0]); lag2 = (int32_t)(komodo_heightstamp(nHeight-1) - pricebits[0]); @@ -1720,7 +1720,6 @@ int32_t komodo_opretvalidate(int32_t nHeight,CScript scriptPubKey) fprintf(stderr,"now.%u htstamp.%u - pricebits[0] %u -> lag2.%d\n",now,komodo_heightstamp(nHeight-1),pricebits[0],lag2); return(-1); } - // else need to check against current blocktime to prevent pricebits[0] games btcusd = (double)pricebits[1]/10000; btcgbp = (double)pricebits[2]/10000; btceur = (double)pricebits[3]/10000; From 5d1010c35ada8b091291814bc6a77fb974fdab78 Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 1 Apr 2019 20:28:33 -1100 Subject: [PATCH 34/42] Test --- src/komodo_gateway.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/komodo_gateway.h b/src/komodo_gateway.h index b8a62792a..e8b33c073 100644 --- a/src/komodo_gateway.h +++ b/src/komodo_gateway.h @@ -1712,12 +1712,12 @@ int32_t komodo_opretvalidate(int32_t nHeight,CScript scriptPubKey) lag2 = (int32_t)(komodo_heightstamp(nHeight-1) - pricebits[0]); if ( lag < -60 ) // avoid data from future { - fprintf(stderr,"now.%u htstamp.%u - pricebits[0] %u -> lag.%d\n",now,komodo_heightstamp(nHeight-1),pricebits[0],lag); + fprintf(stderr,"ht.%d now.%u htstamp.%u - pricebits[0] %u -> lag.%d\n",nHeight,now,komodo_heightstamp(nHeight-1),pricebits[0],lag); return(-1); } if ( lag2 < 0 ) { - fprintf(stderr,"now.%u htstamp.%u - pricebits[0] %u -> lag2.%d\n",now,komodo_heightstamp(nHeight-1),pricebits[0],lag2); + fprintf(stderr,"ht.%d now.%u htstamp.%u - pricebits[0] %u -> lag2.%d\n",nHeight,now,komodo_heightstamp(nHeight-1),pricebits[0],lag2); return(-1); } btcusd = (double)pricebits[1]/10000; From 8a9eaea869704f6407855833989bf420e83254ec Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 1 Apr 2019 20:40:26 -1100 Subject: [PATCH 35/42] Pass through block and previndex --- src/komodo_gateway.h | 19 +++++++++++++------ src/main.cpp | 12 ++++++------ src/main.h | 2 +- 3 files changed, 20 insertions(+), 13 deletions(-) diff --git a/src/komodo_gateway.h b/src/komodo_gateway.h index e8b33c073..724525795 100644 --- a/src/komodo_gateway.h +++ b/src/komodo_gateway.h @@ -1695,9 +1695,9 @@ CScript komodo_mineropret(int32_t nHeight) // pass in blockhash and nTime, latch if it is rejected due to local price, then if localprice changes in a way that would validate then issue reconsiderblock // add rpc call for extracting rawprices -int32_t komodo_opretvalidate(int32_t nHeight,CScript scriptPubKey) +int32_t komodo_opretvalidate(const CBlock *block,CBlockIndex * const previndex,int32_t nHeight,CScript scriptPubKey) { - std::vector vopret; char maxflags[2048]; double btcusd,btcgbp,btceur; uint32_t localbits[2048],pricebits[2048],prevbits[2048],newprice; int32_t i,maxflag,lag,lag2,n; uint32_t now = (uint32_t)time(NULL); + std::vector vopret; char maxflags[2048]; double btcusd,btcgbp,btceur; uint32_t localbits[2048],pricebits[2048],prevbits[2048],newprice; int32_t i,prevtime,maxflag,lag,lag2,lag3,n; uint32_t now = (uint32_t)time(NULL); if ( ASSETCHAINS_CBOPRET != 0 && nHeight > 0 ) { GetOpReturnData(scriptPubKey,vopret); @@ -1708,16 +1708,23 @@ int32_t komodo_opretvalidate(int32_t nHeight,CScript scriptPubKey) memset(maxflags,0,sizeof(maxflags)); if ( nHeight > 2 ) { + prevtime = previndex->nTime; lag = (int32_t)(now - pricebits[0]); - lag2 = (int32_t)(komodo_heightstamp(nHeight-1) - pricebits[0]); + lag2 = (int32_t)(pricebits[0] - prevtime); + lag3 = (int32_t)(block->nTime - pricebits[0]); if ( lag < -60 ) // avoid data from future { - fprintf(stderr,"ht.%d now.%u htstamp.%u - pricebits[0] %u -> lag.%d\n",nHeight,now,komodo_heightstamp(nHeight-1),pricebits[0],lag); + fprintf(stderr,"ht.%d now.%u htstamp.%u %u - pricebits[0] %u -> lags.%d %d %d\n",nHeight,now,prevtime,block->nTime,pricebits[0],lag,lag2,lag3); return(-1); } - if ( lag2 < 0 ) + if ( lag2 < 0 ) // must be after last block timestamp { - fprintf(stderr,"ht.%d now.%u htstamp.%u - pricebits[0] %u -> lag2.%d\n",nHeight,now,komodo_heightstamp(nHeight-1),pricebits[0],lag2); + fprintf(stderr,"ht.%d now.%u htstamp.%u - pricebits[0] %u -> lags.%d %d %d\n",nHeight,now,prevtime,block->nTime,pricebits[0],lag,lag2,lag3); + return(-1); + } + if ( lag3 < -60 || lag > ASSETCHAINS_BLOCKTIME ) + { + fprintf(stderr,"ht.%d now.%u htstamp.%u - pricebits[0] %u -> lags.%d %d %d\n",nHeight,now,prevtime,block->nTime,pricebits[0],lag,lag2,lag3); return(-1); } btcusd = (double)pricebits[1]/10000; diff --git a/src/main.cpp b/src/main.cpp index 1036670d6..a037bd828 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -977,7 +977,7 @@ unsigned int GetP2SHSigOpCount(const CTransaction& tx, const CCoinsViewCache& in * Ensure that a coinbase transaction is structured according to the consensus rules of the * chain */ -bool ContextualCheckCoinbaseTransaction(const CTransaction& tx, const int nHeight) +bool ContextualCheckCoinbaseTransaction(const CBlock *block,CBlockIndex * const previndex,const CTransaction& tx, const int nHeight) { // if time locks are on, ensure that this coin base is time locked exactly as it should be if (((uint64_t)(tx.GetValueOut()) >= ASSETCHAINS_TIMELOCKGTE) || @@ -1020,7 +1020,7 @@ bool ContextualCheckCoinbaseTransaction(const CTransaction& tx, const int nHeigh } else if ( ASSETCHAINS_CBOPRET != 0 && nHeight > 0 && tx.vout.size() > 0 ) { - if ( komodo_opretvalidate(nHeight,tx.vout[tx.vout.size()-1].scriptPubKey) < 0 ) + if ( komodo_opretvalidate(block,previndex,nHeight,tx.vout[tx.vout.size()-1].scriptPubKey) < 0 ) return(false); } return(true); @@ -1035,7 +1035,7 @@ bool ContextualCheckCoinbaseTransaction(const CTransaction& tx, const int nHeigh * and ContextualCheckBlock (which calls this function). * 3. The isInitBlockDownload argument is only to assist with testing. */ -bool ContextualCheckTransaction( +bool ContextualCheckTransaction(const CBlock *block, CBlockIndex * const previndex, const CTransaction& tx, CValidationState &state, const int nHeight, @@ -1171,7 +1171,7 @@ bool ContextualCheckTransaction( if (tx.IsCoinBase()) { - if (!ContextualCheckCoinbaseTransaction(tx, nHeight)) + if (!ContextualCheckCoinbaseTransaction(block,previndex,tx, nHeight)) return state.DoS(100, error("CheckTransaction(): invalid script data for coinbase time lock"), REJECT_INVALID, "bad-txns-invalid-script-data-for-coinbase-time-lock"); } @@ -1679,7 +1679,7 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa } // DoS level set to 10 to be more forgiving. // Check transaction contextually against the set of consensus rules which apply in the next block to be mined. - if (!fSkipExpiry && !ContextualCheckTransaction(tx, state, nextBlockHeight, (dosLevel == -1) ? 10 : dosLevel)) + if (!fSkipExpiry && !ContextualCheckTransaction(0,0,tx, state, nextBlockHeight, (dosLevel == -1) ? 10 : dosLevel)) { return error("AcceptToMemoryPool: ContextualCheckTransaction failed"); } @@ -5173,7 +5173,7 @@ bool ContextualCheckBlock(const CBlock& block, CValidationState& state, CBlockIn const CTransaction& tx = block.vtx[i]; // Check transaction contextually against consensus rules at block height - if (!ContextualCheckTransaction(tx, state, nHeight, 100)) { + if (!ContextualCheckTransaction(&block,pindexPrev,tx, state, nHeight, 100)) { return false; // Failure reason has been set in validation state object } diff --git a/src/main.h b/src/main.h index f12bcb8cd..0cdb0b7a8 100644 --- a/src/main.h +++ b/src/main.h @@ -706,7 +706,7 @@ bool ContextualCheckInputs(const CTransaction& tx, CValidationState &state, cons std::vector *pvChecks = NULL); /** Check a transaction contextually against a set of consensus rules */ -bool ContextualCheckTransaction(const CTransaction& tx, CValidationState &state, int nHeight, int dosLevel, +bool ContextualCheckTransaction(const CBlock *block, CBlockIndex * const pindexPrev,const CTransaction& tx, CValidationState &state, int nHeight, int dosLevel, bool (*isInitBlockDownload)() = IsInitialBlockDownload); /** Apply the effects of this transaction on the UTXO set represented by view */ From c8d70aa804dbaf58dee13fd01f5bc7fdd586c1ee Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 1 Apr 2019 20:49:11 -1100 Subject: [PATCH 36/42] Test --- src/komodo_gateway.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/komodo_gateway.h b/src/komodo_gateway.h index 724525795..1661e3225 100644 --- a/src/komodo_gateway.h +++ b/src/komodo_gateway.h @@ -1714,17 +1714,17 @@ int32_t komodo_opretvalidate(const CBlock *block,CBlockIndex * const previndex,i lag3 = (int32_t)(block->nTime - pricebits[0]); if ( lag < -60 ) // avoid data from future { - fprintf(stderr,"ht.%d now.%u htstamp.%u %u - pricebits[0] %u -> lags.%d %d %d\n",nHeight,now,prevtime,block->nTime,pricebits[0],lag,lag2,lag3); + fprintf(stderr,"A ht.%d now.%u htstamp.%u %u - pricebits[0] %u -> lags.%d %d %d\n",nHeight,now,prevtime,block->nTime,pricebits[0],lag,lag2,lag3); return(-1); } if ( lag2 < 0 ) // must be after last block timestamp { - fprintf(stderr,"ht.%d now.%u htstamp.%u - pricebits[0] %u -> lags.%d %d %d\n",nHeight,now,prevtime,block->nTime,pricebits[0],lag,lag2,lag3); + fprintf(stderr,"B ht.%d now.%u htstamp.%u %u - pricebits[0] %u -> lags.%d %d %d\n",nHeight,now,prevtime,block->nTime,pricebits[0],lag,lag2,lag3); return(-1); } if ( lag3 < -60 || lag > ASSETCHAINS_BLOCKTIME ) { - fprintf(stderr,"ht.%d now.%u htstamp.%u - pricebits[0] %u -> lags.%d %d %d\n",nHeight,now,prevtime,block->nTime,pricebits[0],lag,lag2,lag3); + fprintf(stderr,"C ht.%d now.%u htstamp.%u %u - pricebits[0] %u -> lags.%d %d %d\n",nHeight,now,prevtime,block->nTime,pricebits[0],lag,lag2,lag3); return(-1); } btcusd = (double)pricebits[1]/10000; From b1e8644e050a35b3f1a0a4ab703d0d28b520cdee Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 1 Apr 2019 21:30:32 -1100 Subject: [PATCH 37/42] testchain_exemption = 500 --- src/komodo_gateway.h | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/komodo_gateway.h b/src/komodo_gateway.h index 1661e3225..847c50248 100644 --- a/src/komodo_gateway.h +++ b/src/komodo_gateway.h @@ -1697,6 +1697,7 @@ CScript komodo_mineropret(int32_t nHeight) int32_t komodo_opretvalidate(const CBlock *block,CBlockIndex * const previndex,int32_t nHeight,CScript scriptPubKey) { + int32_t testchain_exemption = 500; std::vector vopret; char maxflags[2048]; double btcusd,btcgbp,btceur; uint32_t localbits[2048],pricebits[2048],prevbits[2048],newprice; int32_t i,prevtime,maxflag,lag,lag2,lag3,n; uint32_t now = (uint32_t)time(NULL); if ( ASSETCHAINS_CBOPRET != 0 && nHeight > 0 ) { @@ -1720,9 +1721,10 @@ int32_t komodo_opretvalidate(const CBlock *block,CBlockIndex * const previndex,i if ( lag2 < 0 ) // must be after last block timestamp { fprintf(stderr,"B ht.%d now.%u htstamp.%u %u - pricebits[0] %u -> lags.%d %d %d\n",nHeight,now,prevtime,block->nTime,pricebits[0],lag,lag2,lag3); - return(-1); + if ( nHeight > testchain_exemption ) + return(-1); } - if ( lag3 < -60 || lag > ASSETCHAINS_BLOCKTIME ) + if ( lag3 < -60 || lag3 > ASSETCHAINS_BLOCKTIME ) { fprintf(stderr,"C ht.%d now.%u htstamp.%u %u - pricebits[0] %u -> lags.%d %d %d\n",nHeight,now,prevtime,block->nTime,pricebits[0],lag,lag2,lag3); return(-1); @@ -1733,7 +1735,7 @@ int32_t komodo_opretvalidate(const CBlock *block,CBlockIndex * const previndex,i fprintf(stderr,"ht.%d: lag.%d %.4f USD, %.4f GBP, %.4f EUR, GBPUSD %.6f, EURUSD %.6f, EURGBP %.6f [%d]\n",nHeight,lag,btcusd,btcgbp,btceur,btcusd/btcgbp,btcusd/btceur,btcgbp/btceur,lag2); if ( komodo_heightpricebits(prevbits,nHeight-1) == 0 ) { - if ( nHeight < 500 ) + if ( nHeight < testchain_exemption ) { for (i=0; i= PRICES_SIZEBIT0 ) { memcpy(localbits,Mineropret.data(),Mineropret.size()); - if ( nHeight < 500 ) + if ( nHeight < testchain_exemption ) { for (i=0; i Date: Mon, 1 Apr 2019 21:33:39 -1100 Subject: [PATCH 38/42] if ( nHeight > testchain_exemption ) --- 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 847c50248..100dd2a57 100644 --- a/src/komodo_gateway.h +++ b/src/komodo_gateway.h @@ -1727,7 +1727,8 @@ int32_t komodo_opretvalidate(const CBlock *block,CBlockIndex * const previndex,i if ( lag3 < -60 || lag3 > ASSETCHAINS_BLOCKTIME ) { fprintf(stderr,"C ht.%d now.%u htstamp.%u %u - pricebits[0] %u -> lags.%d %d %d\n",nHeight,now,prevtime,block->nTime,pricebits[0],lag,lag2,lag3); - return(-1); + if ( nHeight > testchain_exemption ) + return(-1); } btcusd = (double)pricebits[1]/10000; btcgbp = (double)pricebits[2]/10000; From 034479cf780eedac9f53774dffdd2832d0482592 Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 1 Apr 2019 21:37:18 -1100 Subject: [PATCH 39/42] 506 --- 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 100dd2a57..3f90b4b60 100644 --- a/src/komodo_gateway.h +++ b/src/komodo_gateway.h @@ -1697,7 +1697,7 @@ CScript komodo_mineropret(int32_t nHeight) int32_t komodo_opretvalidate(const CBlock *block,CBlockIndex * const previndex,int32_t nHeight,CScript scriptPubKey) { - int32_t testchain_exemption = 500; + int32_t testchain_exemption = 506; std::vector vopret; char maxflags[2048]; double btcusd,btcgbp,btceur; uint32_t localbits[2048],pricebits[2048],prevbits[2048],newprice; int32_t i,prevtime,maxflag,lag,lag2,lag3,n; uint32_t now = (uint32_t)time(NULL); if ( ASSETCHAINS_CBOPRET != 0 && nHeight > 0 ) { From 244c924fe1343dcba2cf26e565a146e86db7db60 Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 1 Apr 2019 21:49:56 -1100 Subject: [PATCH 40/42] Allow more variance from prev timestamp --- src/komodo_gateway.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/komodo_gateway.h b/src/komodo_gateway.h index 3f90b4b60..9452b62ed 100644 --- a/src/komodo_gateway.h +++ b/src/komodo_gateway.h @@ -1697,7 +1697,7 @@ CScript komodo_mineropret(int32_t nHeight) int32_t komodo_opretvalidate(const CBlock *block,CBlockIndex * const previndex,int32_t nHeight,CScript scriptPubKey) { - int32_t testchain_exemption = 506; + int32_t testchain_exemption = 350; std::vector vopret; char maxflags[2048]; double btcusd,btcgbp,btceur; uint32_t localbits[2048],pricebits[2048],prevbits[2048],newprice; int32_t i,prevtime,maxflag,lag,lag2,lag3,n; uint32_t now = (uint32_t)time(NULL); if ( ASSETCHAINS_CBOPRET != 0 && nHeight > 0 ) { @@ -1718,7 +1718,7 @@ int32_t komodo_opretvalidate(const CBlock *block,CBlockIndex * const previndex,i fprintf(stderr,"A ht.%d now.%u htstamp.%u %u - pricebits[0] %u -> lags.%d %d %d\n",nHeight,now,prevtime,block->nTime,pricebits[0],lag,lag2,lag3); return(-1); } - if ( lag2 < 0 ) // must be after last block timestamp + if ( lag2 < -ASSETCHAINS_BLOCKTIME ) // must be close to last block timestamp { fprintf(stderr,"B ht.%d now.%u htstamp.%u %u - pricebits[0] %u -> lags.%d %d %d\n",nHeight,now,prevtime,block->nTime,pricebits[0],lag,lag2,lag3); if ( nHeight > testchain_exemption ) From 698ea547d0351caa20f63ac5a8c712cd3bbf92bc Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 1 Apr 2019 21:53:49 -1100 Subject: [PATCH 41/42] +print --- 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 9452b62ed..3ed1cab49 100644 --- a/src/komodo_gateway.h +++ b/src/komodo_gateway.h @@ -1720,7 +1720,7 @@ int32_t komodo_opretvalidate(const CBlock *block,CBlockIndex * const previndex,i } if ( lag2 < -ASSETCHAINS_BLOCKTIME ) // must be close to last block timestamp { - fprintf(stderr,"B ht.%d now.%u htstamp.%u %u - pricebits[0] %u -> lags.%d %d %d\n",nHeight,now,prevtime,block->nTime,pricebits[0],lag,lag2,lag3); + fprintf(stderr,"B ht.%d now.%u htstamp.%u %u - pricebits[0] %u -> lags.%d %d %d vs %d cmp.%d\n",nHeight,now,prevtime,block->nTime,pricebits[0],lag,lag2,lag3,ASSETCHAINS_BLOCKTIME,lag2<-ASSETCHAINS_BLOCKTIME); if ( nHeight > testchain_exemption ) return(-1); } From 3a9b1492000f316135b6f46fd508e85b967c7f89 Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 1 Apr 2019 21:57:23 -1100 Subject: [PATCH 42/42] int32_t --- src/bitcoind.cpp | 2 +- src/chainparams.cpp | 2 +- src/komodo_defs.h | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/bitcoind.cpp b/src/bitcoind.cpp index 0afb47894..b65fcf1a9 100644 --- a/src/bitcoind.cpp +++ b/src/bitcoind.cpp @@ -59,7 +59,7 @@ static bool fDaemon; #include "komodo_defs.h" #define KOMODO_ASSETCHAIN_MAXLEN 65 extern char ASSETCHAINS_SYMBOL[KOMODO_ASSETCHAIN_MAXLEN]; -extern uint32_t ASSETCHAINS_BLOCKTIME; +extern int32_t ASSETCHAINS_BLOCKTIME; extern uint64_t ASSETCHAINS_CBOPRET; void komodo_passport_iteration(); uint64_t komodo_interestsum(); diff --git a/src/chainparams.cpp b/src/chainparams.cpp index 6bfcc0e5c..26e29d9de 100644 --- a/src/chainparams.cpp +++ b/src/chainparams.cpp @@ -91,7 +91,7 @@ static CBlock CreateGenesisBlock(uint32_t nTime, const uint256& nNonce, const st */ void *chainparams_commandline(void *ptr); #include "komodo_defs.h" -uint32_t ASSETCHAINS_BLOCKTIME = 60; +int32_t ASSETCHAINS_BLOCKTIME = 60; const arith_uint256 maxUint = UintToArith256(uint256S("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff")); diff --git a/src/komodo_defs.h b/src/komodo_defs.h index 0f053f6ca..b0f618e93 100644 --- a/src/komodo_defs.h +++ b/src/komodo_defs.h @@ -42,8 +42,8 @@ extern uint8_t ASSETCHAINS_TXPOW,ASSETCHAINS_PUBLIC; int32_t MAX_BLOCK_SIZE(int32_t height); extern char ASSETCHAINS_SYMBOL[KOMODO_ASSETCHAIN_MAXLEN]; extern uint16_t ASSETCHAINS_P2PPORT,ASSETCHAINS_RPCPORT; -extern uint32_t ASSETCHAIN_INIT, ASSETCHAINS_MAGIC,ASSETCHAINS_BLOCKTIME; -extern int32_t VERUS_BLOCK_POSUNITS, ASSETCHAINS_LWMAPOS, ASSETCHAINS_SAPLING, ASSETCHAINS_OVERWINTER; +extern uint32_t ASSETCHAIN_INIT, ASSETCHAINS_MAGIC; +extern int32_t VERUS_BLOCK_POSUNITS, ASSETCHAINS_LWMAPOS, ASSETCHAINS_SAPLING, ASSETCHAINS_OVERWINTER,ASSETCHAINS_BLOCKTIME; extern uint64_t ASSETCHAINS_SUPPLY, ASSETCHAINS_FOUNDERS_REWARD; extern uint64_t ASSETCHAINS_TIMELOCKGTE;