From c52074f24851acdff6f211bc61d2b0aa36a571a6 Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 27 Mar 2018 19:03:55 +0300 Subject: [PATCH 1/7] Test alternate block2height --- src/komodo_bitcoind.h | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/komodo_bitcoind.h b/src/komodo_bitcoind.h index 0c905e785..97d572e51 100644 --- a/src/komodo_bitcoind.h +++ b/src/komodo_bitcoind.h @@ -612,7 +612,9 @@ int32_t komodo_is_notarytx(const CTransaction& tx) int32_t komodo_block2height(CBlock *block) { - int32_t i,n,height = 0; uint8_t *ptr; + int32_t i,n,height2=-1,height = 0; uint8_t *ptr; CBlockIndex *pindex; + if ( (pindex= mapBlockIndex[block->GetHash()]) != 0 ) + height2 = (int32_t)pindex->nHeight; if ( block->vtx[0].vin.size() > 0 ) { #ifdef KOMODO_ZCASH @@ -635,6 +637,13 @@ int32_t komodo_block2height(CBlock *block) } //komodo_init(height); } + if ( height > 0 && height2 >= 0 ) + { + static uint32_t match,mismatch; + if ( height != height2 || ((match+mismatch) % 1000) == 999 ) + mismatch++, printf("block2height height.%d vs height2.%d, match.%d mismatch.%d\n",height,height2,match,mismatch); + else match++; + } return(height); } @@ -866,7 +875,7 @@ int32_t komodo_MoM(int32_t *notarized_heightp,uint256 *MoMp,uint256 *kmdtxidp,in int32_t komodo_checkpoint(int32_t *notarized_heightp,int32_t nHeight,uint256 hash) { - int32_t notarized_height,MoMdepth; uint256 MoM,notarized_hash,notarized_desttxid; CBlockIndex *notary; CBlockIndex *pindex; + int32_t notarized_height,MoMdepth; uint256 MoM,notarized_hash,notarized_desttxid; CBlockIndex *notary,*pindex; if ( (pindex= chainActive.Tip()) == 0 ) return(-1); notarized_height = komodo_notarizeddata(pindex->nHeight,¬arized_hash,¬arized_desttxid); From f9b1c78a0264357cb995c7b895db4aa58a7bbc05 Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 27 Mar 2018 19:08:48 +0300 Subject: [PATCH 2/7] 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 97d572e51..5e0db61ab 100644 --- a/src/komodo_bitcoind.h +++ b/src/komodo_bitcoind.h @@ -641,7 +641,7 @@ int32_t komodo_block2height(CBlock *block) { static uint32_t match,mismatch; if ( height != height2 || ((match+mismatch) % 1000) == 999 ) - mismatch++, printf("block2height height.%d vs height2.%d, match.%d mismatch.%d\n",height,height2,match,mismatch); + mismatch++, fprintf(stderr,"block2height height.%d vs height2.%d, match.%d mismatch.%d\n",height,height2,match,mismatch); else match++; } return(height); From f717835b84984722d4912bd9a339e167ff654cf2 Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 27 Mar 2018 19:20:06 +0300 Subject: [PATCH 3/7] Test --- src/komodo_bitcoind.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/komodo_bitcoind.h b/src/komodo_bitcoind.h index 5e0db61ab..e23119eaa 100644 --- a/src/komodo_bitcoind.h +++ b/src/komodo_bitcoind.h @@ -640,8 +640,11 @@ int32_t komodo_block2height(CBlock *block) if ( height > 0 && height2 >= 0 ) { static uint32_t match,mismatch; - if ( height != height2 || ((match+mismatch) % 1000) == 999 ) + if ( height != height2 || ((match+mismatch) % 10) == 9 ) + { mismatch++, fprintf(stderr,"block2height height.%d vs height2.%d, match.%d mismatch.%d\n",height,height2,match,mismatch); + height = height2; + } else match++; } return(height); From d4cc6fc35a24da804cdb37b60ae0b1d98c564f92 Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 27 Mar 2018 19:29:30 +0300 Subject: [PATCH 4/7] Test --- src/komodo_bitcoind.h | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/komodo_bitcoind.h b/src/komodo_bitcoind.h index e23119eaa..8a3577941 100644 --- a/src/komodo_bitcoind.h +++ b/src/komodo_bitcoind.h @@ -637,16 +637,14 @@ int32_t komodo_block2height(CBlock *block) } //komodo_init(height); } - if ( height > 0 && height2 >= 0 ) + if ( height != height2 ) { static uint32_t match,mismatch; - if ( height != height2 || ((match+mismatch) % 10) == 9 ) - { - mismatch++, fprintf(stderr,"block2height height.%d vs height2.%d, match.%d mismatch.%d\n",height,height2,match,mismatch); + fprintf(stderr,"block2height height.%d vs height2.%d, match.%d mismatch.%d\n",height,height2,match,mismatch); + mismatch++; + if ( height2 >= 0 ) height = height2; - } - else match++; - } + } else match++; return(height); } From e1501755a4a7976364dce641e3ed617b0ff59b4c Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 27 Mar 2018 19:30:33 +0300 Subject: [PATCH 5/7] 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 8a3577941..4edaa76de 100644 --- a/src/komodo_bitcoind.h +++ b/src/komodo_bitcoind.h @@ -612,6 +612,7 @@ int32_t komodo_is_notarytx(const CTransaction& tx) int32_t komodo_block2height(CBlock *block) { + static uint32_t match,mismatch; int32_t i,n,height2=-1,height = 0; uint8_t *ptr; CBlockIndex *pindex; if ( (pindex= mapBlockIndex[block->GetHash()]) != 0 ) height2 = (int32_t)pindex->nHeight; @@ -639,7 +640,6 @@ int32_t komodo_block2height(CBlock *block) } if ( height != height2 ) { - static uint32_t match,mismatch; fprintf(stderr,"block2height height.%d vs height2.%d, match.%d mismatch.%d\n",height,height2,match,mismatch); mismatch++; if ( height2 >= 0 ) From 8a0b06f603ad336b5098ea4950a6f15ff02614bf Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 27 Mar 2018 20:22:23 +0300 Subject: [PATCH 6/7] Test --- src/komodo_bitcoind.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/komodo_bitcoind.h b/src/komodo_bitcoind.h index 4edaa76de..6f8357985 100644 --- a/src/komodo_bitcoind.h +++ b/src/komodo_bitcoind.h @@ -615,7 +615,11 @@ int32_t komodo_block2height(CBlock *block) static uint32_t match,mismatch; int32_t i,n,height2=-1,height = 0; uint8_t *ptr; CBlockIndex *pindex; if ( (pindex= mapBlockIndex[block->GetHash()]) != 0 ) + { height2 = (int32_t)pindex->nHeight; + if ( height2 >= 0 ) + return(height2); + } if ( block->vtx[0].vin.size() > 0 ) { #ifdef KOMODO_ZCASH From 1d5c7ffa2925999e314b92b99c25548d5de1f337 Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 28 Mar 2018 14:22:39 +0300 Subject: [PATCH 7/7] -googlemock --- depends/packages/packages.mk | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/depends/packages/packages.mk b/depends/packages/packages.mk index 199c69d0c..3c9eabc88 100644 --- a/depends/packages/packages.mk +++ b/depends/packages/packages.mk @@ -3,9 +3,9 @@ rust_packages := rust librustzcash proton_packages := proton zcash_packages := libgmp libsodium ifeq ($(host_os),linux) - packages := boost openssl libevent zeromq $(zcash_packages) googletest googlemock + packages := boost openssl libevent zeromq $(zcash_packages) googletest #googlemock else - packages := boost openssl libevent zeromq $(zcash_packages) googletest googlemock libcurl + packages := boost openssl libevent zeromq $(zcash_packages) libcurl googletest #googlemock endif native_packages := native_ccache