From 6401fd9fd1d6223888f4a6fbd4592092c44df6b2 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 18 Mar 2017 08:30:44 +0200 Subject: [PATCH 01/11] 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 8cf3c880c..995da7a0b 100644 --- a/src/komodo_gateway.h +++ b/src/komodo_gateway.h @@ -695,9 +695,9 @@ int32_t komodo_check_deposit(int32_t height,const CBlock& block) // verify above offset += komodo_scriptitemlen(&opretlen,&script[offset]); if ( ASSETCHAINS_SYMBOL[0] == 0 ) { - //for (i=0; i= 235300 ) return(-1); From f8413078852633764e6545af38069ee7210fb643 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 18 Mar 2017 08:35:35 +0200 Subject: [PATCH 02/11] 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 995da7a0b..b84d63772 100644 --- a/src/komodo_gateway.h +++ b/src/komodo_gateway.h @@ -737,7 +737,7 @@ int32_t komodo_check_deposit(int32_t height,const CBlock& block) // verify above printf("checkdeposit.[%s]: skip %s %.8f when avail %.8f deposited %.8f, issued %.8f withdrawn %.8f approved %.8f redeemed %.8f\n",ASSETCHAINS_SYMBOL,symbol,dstr(pax->fiatoshis),dstr(available),dstr(deposited),dstr(issued),dstr(withdrawn),dstr(approved),dstr(redeemed)); continue; } - if ( ((opcode == 'I' && (pax->fiatoshis == 0 || pax->fiatoshis == block.vtx[0].vout[i].nValue)) || (opcode == 'X' && (pax->komodoshis == 0 || pax->komodoshis == block.vtx[0].vout[i].nValue))) ) + if ( ((opcode == 'I' && (pax->fiatoshis == block.vtx[0].vout[i].nValue) || (opcode == 'X' && pax->komodoshis == block.vtx[0].vout[i].nValue)) ) { if ( pax->marked != 0 && height >= 80820 ) { From 951bb1bbfb5e101a5eb22dd23314fe726afd833f Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 18 Mar 2017 08:41:09 +0200 Subject: [PATCH 03/11] 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 b84d63772..36b14168b 100644 --- a/src/komodo_gateway.h +++ b/src/komodo_gateway.h @@ -735,9 +735,9 @@ int32_t komodo_check_deposit(int32_t height,const CBlock& block) // verify above if ( opcode == 'I' && (pax_fiatstatus(&available,&deposited,&issued,&withdrawn,&approved,&redeemed,symbol) != 0 || available < pax->fiatoshis) ) { printf("checkdeposit.[%s]: skip %s %.8f when avail %.8f deposited %.8f, issued %.8f withdrawn %.8f approved %.8f redeemed %.8f\n",ASSETCHAINS_SYMBOL,symbol,dstr(pax->fiatoshis),dstr(available),dstr(deposited),dstr(issued),dstr(withdrawn),dstr(approved),dstr(redeemed)); - continue; + return(-1); } - if ( ((opcode == 'I' && (pax->fiatoshis == block.vtx[0].vout[i].nValue) || (opcode == 'X' && pax->komodoshis == block.vtx[0].vout[i].nValue)) ) + if ( pax->fiatoshis == block.vtx[0].vout[i].nValue ) { if ( pax->marked != 0 && height >= 80820 ) { From 4476ddfa8110305c6e706e244a765c4dbfa06c41 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 18 Mar 2017 08:50:35 +0200 Subject: [PATCH 04/11] Test --- src/komodo_utils.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/komodo_utils.h b/src/komodo_utils.h index d66eecaff..7c99aa4b2 100644 --- a/src/komodo_utils.h +++ b/src/komodo_utils.h @@ -1464,7 +1464,9 @@ void komodo_args() } else KOMODO_PAX = GetArg("-pax",0); 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); From 25d3af9a82206be5a70511077c994d79905fcbaf Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 18 Mar 2017 08:55:20 +0200 Subject: [PATCH 05/11] 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 36b14168b..5cdf8548a 100644 --- a/src/komodo_gateway.h +++ b/src/komodo_gateway.h @@ -690,8 +690,6 @@ int32_t komodo_check_deposit(int32_t height,const CBlock& block) // verify above } //fprintf(stderr,"ht.%d n.%d nValue %.8f (%d %d %d)\n",height,n,dstr(block.vtx[0].vout[1].nValue),KOMODO_PAX,komodo_isrealtime(&ht),KOMODO_PASSPORT_INITDONE); - if ( komodo_isrealtime(&ht) == 0 || KOMODO_PASSPORT_INITDONE == 0 ) //KOMODO_PAX == 0 || - return(0); offset += komodo_scriptitemlen(&opretlen,&script[offset]); if ( ASSETCHAINS_SYMBOL[0] == 0 ) { @@ -717,6 +715,8 @@ int32_t komodo_check_deposit(int32_t height,const CBlock& block) // verify above return(0); } } + if ( komodo_isrealtime(&ht) == 0 || KOMODO_PASSPORT_INITDONE == 0 ) //KOMODO_PAX == 0 || + return(0); if ( script[offset] == opcode && opretlen < block.vtx[0].vout[n-1].scriptPubKey.size() ) { if ( (num= komodo_issued_opreturn(base,txids,vouts,values,srcvalues,kmdheights,otherheights,baseids,rmd160s,&script[offset],opretlen,opcode == 'X')) > 0 ) From d21ce6a7460f65f14ac1d7f0cf4ee1fc2e186368 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 18 Mar 2017 09:13:20 +0200 Subject: [PATCH 06/11] Test --- src/main.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 1a92bcd91..bb6bc54d5 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -2771,8 +2771,8 @@ static bool ActivateBestChainStep(CValidationState &state, CBlockIndex *pindexMo } if ( KOMODO_REWIND != 0 && chainActive.Tip()->nHeight > KOMODO_REWIND ) { - static int32_t didinit; - if ( didinit++ == 0 ) + //static int32_t didinit; + //if ( didinit++ == 0 ) { while (chainActive.Tip()->nHeight > KOMODO_REWIND ) { From 67d2b8b9966de9c792e28d4008f855a1cf4edd2b Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 18 Mar 2017 09:18:23 +0200 Subject: [PATCH 07/11] Test --- src/main.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index bb6bc54d5..c4cb908cf 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -2769,10 +2769,16 @@ static bool ActivateBestChainStep(CValidationState &state, CBlockIndex *pindexMo if (!DisconnectTip(state)) return false; } - if ( KOMODO_REWIND != 0 && chainActive.Tip()->nHeight > KOMODO_REWIND ) + if ( KOMODO_REWIND != 0 && chainActive.Tip()->nHeight >= KOMODO_REWIND ) { //static int32_t didinit; //if ( didinit++ == 0 ) + if ( chainActive.Tip()->nHeight == KOMODO_REWIND ) + { + fprintf(stderr,"reached rewind.%d, ./komodo-cli stop now\n"); + sleep(3); + return(false); + } { while (chainActive.Tip()->nHeight > KOMODO_REWIND ) { From 4ce30f9076796dad5d6dfc3cb9dee75a423255a9 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 18 Mar 2017 09:19:54 +0200 Subject: [PATCH 08/11] Test --- src/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index c4cb908cf..3b16b0da1 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -2775,7 +2775,7 @@ static bool ActivateBestChainStep(CValidationState &state, CBlockIndex *pindexMo //if ( didinit++ == 0 ) if ( chainActive.Tip()->nHeight == KOMODO_REWIND ) { - fprintf(stderr,"reached rewind.%d, ./komodo-cli stop now\n"); + fprintf(stderr,"reached rewind.%d, ./komodo-cli stop now\n",KOMODO_REWIND); sleep(3); return(false); } From 4f7720b3928b847ed3ccadc804c2fc1c0e1bccdc Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 18 Mar 2017 09:22:37 +0200 Subject: [PATCH 09/11] Test --- src/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index 3b16b0da1..d8fb9f35e 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -2773,7 +2773,7 @@ static bool ActivateBestChainStep(CValidationState &state, CBlockIndex *pindexMo { //static int32_t didinit; //if ( didinit++ == 0 ) - if ( chainActive.Tip()->nHeight == KOMODO_REWIND ) + if ( chainActive.Tip()->nHeight == KOMODO_REWIND+1 ) { fprintf(stderr,"reached rewind.%d, ./komodo-cli stop now\n",KOMODO_REWIND); sleep(3); From 1e3c97ba6999ba6f82f4c94543e76ff8879a96be Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 18 Mar 2017 09:31:54 +0200 Subject: [PATCH 10/11] Test --- src/main.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index d8fb9f35e..209437dec 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -2775,7 +2775,7 @@ static bool ActivateBestChainStep(CValidationState &state, CBlockIndex *pindexMo //if ( didinit++ == 0 ) if ( chainActive.Tip()->nHeight == KOMODO_REWIND+1 ) { - fprintf(stderr,"reached rewind.%d, ./komodo-cli stop now\n",KOMODO_REWIND); + fprintf(stderr,"reached rewind.%d, best to do: ./komodo-cli stop\n",KOMODO_REWIND); sleep(3); return(false); } @@ -2784,7 +2784,10 @@ static bool ActivateBestChainStep(CValidationState &state, CBlockIndex *pindexMo { fprintf(stderr,"rewind ht.%d\n",chainActive.Tip()->nHeight); if ( !DisconnectTip(state) ) + { + InvalidateBlock(state,chainActive.Tip()) return false; + } } pindexOldTip = chainActive.Tip(); pindexFork = chainActive.FindFork(pindexMostWork); From 6cce41a5c27bd0eb5ca564f40cc19b705defe308 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 18 Mar 2017 09:32:28 +0200 Subject: [PATCH 11/11] Test --- src/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index 209437dec..825088d76 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -2785,7 +2785,7 @@ static bool ActivateBestChainStep(CValidationState &state, CBlockIndex *pindexMo fprintf(stderr,"rewind ht.%d\n",chainActive.Tip()->nHeight); if ( !DisconnectTip(state) ) { - InvalidateBlock(state,chainActive.Tip()) + InvalidateBlock(state,chainActive.Tip()); return false; } }