Browse Source

Test

pull/4/head
jl777 7 years ago
parent
commit
7d44d3dddd
  1. 27
      src/komodo_bitcoind.h
  2. 12
      src/main.cpp

27
src/komodo_bitcoind.h

@ -594,6 +594,25 @@ int32_t komodo_blockload(CBlock& block,CBlockIndex *pindex)
return(0);
}
CBlockIndex *komodo_chainactive(int32_t height)
{
if ( chainActive.Tip() != 0 && height <= chainActive.Tip()->nHeight )
{
return(chainActive[height]);
} else return(0);
}
uint32_t komodo_heightstamp(int32_t height)
{
CBlock block; CBlockIndex *ptr;
if ( (ptr= komodo_chainactive(height)) != 0 )
{
if ( komodo_blockload(block,ptr) == 0 && komodo_block2height(&block) == height )
return(block.nTime);
}
return(0);
}
void komodo_index2pubkey33(uint8_t *pubkey33,CBlockIndex *pindex,int32_t height)
{
CBlock block;
@ -618,14 +637,6 @@ void komodo_connectpindex(CBlockIndex *pindex)
komodo_connectblock(pindex,block);
}
CBlockIndex *komodo_chainactive(int32_t height)
{
if ( chainActive.Tip() != 0 && height <= chainActive.Tip()->nHeight )
{
return(chainActive[height]);
} else return(0);
}
int32_t komodo_notaries(uint8_t pubkeys[64][33],int32_t height);
int32_t komodo_electednotary(uint8_t *pubkey33,int32_t height);

12
src/main.cpp

@ -708,6 +708,8 @@ bool IsStandardTx(const CTransaction& tx, string& reason)
return true;
}
uint32_t komodo_heightstamp(int32_t height);
int32_t komodo_validate_interest(uint32_t *expiredp,const CTransaction& tx,int32_t txheightarg)
{
int32_t i; uint32_t cmptime; uint64_t value=0; CBlockIndex *prev;
@ -759,9 +761,13 @@ int32_t komodo_validate_interest(uint32_t *expiredp,const CTransaction& tx,int32
} else fprintf(stderr,"validateinterest grandfather.%d locktime %u vs txheighttime.%u tiptime.%u txb.%u cmp.%u\n",(int32_t)txheight,tx.nLockTime,txheighttime,tiptime,txblocktime,cmptime);
}
}*/
if ( (prev= komodo_chainactive(txheightarg-1)) != 0 )
cmptime = prev->nTime + 600;
else fprintf(stderr,"couldnt get prev.[%d]\n",txheightarg-1);
if ( (cmptime= komodo_heightstamp(txheightarg-1)) == 0 )
{
cmptime = chainActive.Tip()->nTime;
fprintf(stderr,"couldnt get prev.[%d] use tiptime.%u\n",txheightarg-1,cmptime);
}
//if ( (prev= komodo_chainactive(txheightarg-1)) != 0 )
// cmptime = prev->nTime + 600;
if ( cmptime > 0 && txheightarg > 246748 )
{
if ( txheightarg < 247205 )

Loading…
Cancel
Save