Change mapblockindex[] into function calls with guards

This commit is contained in:
jl777
2019-04-21 02:33:31 -11:00
parent 06bed214f9
commit 564da3c982
3 changed files with 6 additions and 6 deletions

View File

@@ -314,10 +314,10 @@ bool PaymentsValidate(struct CCcontract_info *cp,Eval* eval,const CTransaction &
}
}
// check the chain depth vs locked blocks requirement.
CBlockIndex* pblockindex = mapBlockIndex[blockhash];
if ( pblockindex->GetHeight() > ht-lockedblocks )
CBlockIndex* pblockindex = komodo_blockindex(blockhash);
if ( pblockindex == 0 || pblockindex->GetHeight() > ht-lockedblocks )
{
fprintf(stderr, "vin.%i is not elegible to be spent yet height.%i vs elegible_ht.%i\n", i, pblockindex->GetHeight(), ht-lockedblocks);
fprintf(stderr, "vin.%i is not elegible to be spent yet height.%i vs elegible_ht.%i\n", i, pblockindex!=0?pblockindex->GetHeight():0, ht-lockedblocks);
return(eval->Invalid("vin not elegible"));
}
} else return(eval->Invalid("cant get vin transaction"));