Merge pull request #306 from jl777/dev

Dev
This commit is contained in:
jl777
2017-03-18 09:40:45 +02:00
committed by GitHub
3 changed files with 22 additions and 11 deletions

View File

@@ -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<opretlen; i++)
// printf("%02x",script[i]);
//printf(" height.%d checkdeposit n.%d [%02x] [%c] %d vs %d\n",height,n,script[0],script[offset],script[offset],'X');
for (i=0; i<opretlen; i++)
printf("%02x",script[i]);
printf(" height.%d checkdeposit n.%d [%02x] [%c] %d vs %d\n",height,n,script[0],script[offset],script[offset],'X');
opcode = 'X';
if ( height >= 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 )
{

View File

@@ -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);

View File

@@ -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);