core/vm: address review concerns

This commit is contained in:
Martin Holst Swende 2018-10-04 13:31:32 +02:00
parent f616a39b6a
commit 8f04ccdb8a
No known key found for this signature in database
GPG key ID: 683B438C05A5DDF0

View file

@ -92,16 +92,14 @@ func (c *Contract) validJumpdest(dest *big.Int) bool {
if OpCode(c.Code[udest]) != JUMPDEST {
return false
}
var analysis bitvec
// Do we have a contract hash already?
if c.CodeHash != (common.Hash{}) {
var exist bool
// Does parent context have the analysis?
analysis, exist = c.jumpdests[c.CodeHash]
analysis, exist := c.jumpdests[c.CodeHash]
if !exist {
// Do the analysis
// Do the analysis and save in parent context
// We do not need to store it in c.analysis
analysis = codeBitmap(c.Code)
// Save in parent context
c.jumpdests[c.CodeHash] = analysis
}
return analysis.codeSegment(udest)