diff --git a/src/komodo_gateway.h b/src/komodo_gateway.h index 8cf3c880c..5cdf8548a 100644 --- a/src/komodo_gateway.h +++ b/src/komodo_gateway.h @@ -690,14 +690,12 @@ 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 ) { - //for (i=0; i= 235300 ) return(-1); @@ -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 ) @@ -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 == 0 || pax->fiatoshis == block.vtx[0].vout[i].nValue)) || (opcode == 'X' && (pax->komodoshis == 0 || pax->komodoshis == block.vtx[0].vout[i].nValue))) ) + if ( pax->fiatoshis == block.vtx[0].vout[i].nValue ) { if ( pax->marked != 0 && height >= 80820 ) { 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); diff --git a/src/main.cpp b/src/main.cpp index 1a92bcd91..825088d76 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -2769,16 +2769,25 @@ 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 ) + //static int32_t didinit; + //if ( didinit++ == 0 ) + if ( chainActive.Tip()->nHeight == KOMODO_REWIND+1 ) + { + fprintf(stderr,"reached rewind.%d, best to do: ./komodo-cli stop\n",KOMODO_REWIND); + sleep(3); + return(false); + } { while (chainActive.Tip()->nHeight > KOMODO_REWIND ) { 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);