Skip to content

Commit

Permalink
Merge pull request #4452 from chenyukang/yukang-skip-zero-cycles-for-…
Browse files Browse the repository at this point in the history
…disable-script

Skip storing all zero cycles in db when disable script
  • Loading branch information
zhangsoledad authored May 10, 2024
2 parents 18b746e + 3c9a637 commit cc11673
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion chain/src/chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -802,11 +802,20 @@ impl ChainService {
mmr.push(b.digest())
.map_err(|e| InternalErrorKind::MMR.other(e))?;

// when `disable_script` is true, `cache_entries` is a array with all `0`
// there is no need to store them in db
let verify_entries: Option<&[Completed]> =
if switch.disable_script() {
None
} else {
Some(&cache_entries)
};

self.insert_ok_ext(
&txn,
&b.header().hash(),
ext.clone(),
Some(&cache_entries),
verify_entries,
Some(txs_sizes),
)?;

Expand Down

0 comments on commit cc11673

Please sign in to comment.