Skip to content

Commit

Permalink
Pass address in Database.ContractCode()
Browse files Browse the repository at this point in the history
  • Loading branch information
profMagija committed Sep 9, 2024
1 parent 6881ff8 commit 48f0d1c
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions arbos/programs/programs.go
Original file line number Diff line number Diff line change
Expand Up @@ -425,15 +425,17 @@ func (p Programs) SetProgramCached(
if err != nil {
return err
}
if cache {
// Not passing in an address is supported pre-Verkle, as in Blockchain's ContractCodeWithPrefix method.
code, err := db.Database().ContractCode(common.Address{}, codeHash)
if err != nil {
return err
if address != (common.Address{}) {
if cache {
// Not passing in an address is supported pre-Verkle, as in Blockchain's ContractCodeWithPrefix method.
code, err := db.Database().ContractCode(address, codeHash)
if err != nil {
return err
}
cacheProgram(db, moduleHash, program, address, code, codeHash, params, debug, time, runMode)
} else {
evictProgram(db, moduleHash, program.version, debug, runMode, expired)
}
cacheProgram(db, moduleHash, program, address, code, codeHash, params, debug, time, runMode)
} else {
evictProgram(db, moduleHash, program.version, debug, runMode, expired)
}
program.cached = cache
return p.setProgram(codeHash, program)
Expand Down

0 comments on commit 48f0d1c

Please sign in to comment.