Merge pull request #369 from jl777/dev

Dev
This commit is contained in:
jl777
2017-03-24 06:24:01 +02:00
committed by GitHub

View File

@@ -381,14 +381,14 @@ void UpdateBlockAvailability(NodeId nodeid, const uint256 &hash) {
CNodeState *state = State(nodeid);
assert(state != NULL);
ProcessBlockAvailability(nodeid);
/*ProcessBlockAvailability(nodeid);
BlockMap::iterator it = mapBlockIndex.find(hash);
if (it->second != 0 && it != mapBlockIndex.end() && it->second->nChainWork > 0) {
if (it != mapBlockIndex.end() && it->second->nChainWork > 0) {
// An actually better block was announced.
if (state->pindexBestKnownBlock == NULL || it->second->nChainWork >= state->pindexBestKnownBlock->nChainWork)
state->pindexBestKnownBlock = it->second;
} else
} else*/
{
// An unknown block was announced; just assume that the latest one is the best one.
state->hashLastUnknownBlock = hash;
@@ -723,17 +723,23 @@ int32_t komodo_validate_interest(uint32_t *expiredp,const CTransaction& tx,int32
if ( (pindex= mapBlockIndex[hashBlock]) != 0 )
{
txheight = pindex->nHeight;
prevblocktime = pindex->nTime;
if ( (previndex= pindex->pprev) != 0 )
prevblocktime = previndex->nTime;
}
}
if ( prevblocktime != 0 )
cmptime = prevblocktime + 600;
else if ( txheight > 246748 )
if ( prevblocktime == 0 )
{
//fprintf(stderr,"couldnt get cmptime for [%d] t%u\n",txheight,prevblocktime);
return(-1);
} else return(0);
if ( chainActive.Tip() != 0 && txheight == chainActive.Tip()->nHeight+1 )
prevblocktime = chainActive.Tip()->nTime;
else
{
prevblocktime = chainActive.Tip()->nTime;
fprintf(stderr,"couldnt get prevblocktime for [%d] use tiptime.%u\n",txheight,prevblocktime);
//return(-1);
}
}
cmptime = prevblocktime + 600;
/* uint32_t prevblocktime=0,cmptime=0,txheighttime=0,tiptime=0,locktime=0;
prevblocktime = 0;
locktime = komodo_interest_args(&txheighttime,&txheight,&tiptime,&value,tx.GetHash(),0);