Skip to content

Commit

Permalink
style(SwingSet): Add behavior-clarifying comments in buildCrankBuffer
Browse files Browse the repository at this point in the history
  • Loading branch information
gibson042 committed May 6, 2022
1 parent 45406c6 commit 80afe86
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/SwingSet/src/kernel/state/storageWrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,13 @@ export function buildCrankBuffer(
const crankhash = crankhasher.finish();
resetCrankhash();

// Digest the old activityhash and new crankhash into the new activityhash.
// Get the old activityhash directly from (unbuffered) backing storage.
let oldActivityhash = kvStore.get('activityhash');
if (oldActivityhash === undefined) {
oldActivityhash = '';
}

// Digest the old activityhash and new crankhash into the new activityhash.
const hasher = createSHA256();
hasher.add('activityhash');
hasher.add('\n');
Expand All @@ -91,7 +93,7 @@ export function buildCrankBuffer(
hasher.add(crankhash);
hasher.add('\n');

// Store the new activityhash.
// Store the new activityhash directly into (unbuffered) backing storage.
const activityhash = hasher.finish();
kvStore.set('activityhash', activityhash);

Expand Down

0 comments on commit 80afe86

Please sign in to comment.