Skip to content

Commit

Permalink
fix(meter): use process.env not process.environment
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelfig committed Feb 4, 2022
1 parent 8374f94 commit c703d07
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions packages/SwingSet/src/kernel/kernel.js
Original file line number Diff line number Diff line change
Expand Up @@ -457,16 +457,17 @@ export default function buildKernel(
assert.typeof(consumed, 'number');
used = BigInt(consumed);
policyInput = ['crank', { computrons: used }];
}
if (useMeter && metering !== null && meterID) {
// If we have a Meter, and the manager reported a non-null value, use it.
assert(used !== undefined);
const underflow = deductMeter(meterID, used, true);
if (underflow) {
console.log(`meter ${meterID} underflow, terminating vat ${vatID}`);
const err = makeError('meter underflow, vat terminated');
setTerminationTrigger(vatID, true, true, err);
return harden(['crank-failed', {}]);
if (useMeter && meterID) {
// If we have a Meter and we want to use it, do so.
const underflow = deductMeter(meterID, used, true);
if (underflow) {
console.log(
`meter ${meterID} underflow, terminating vat ${vatID}`,
);
const err = makeError('meter underflow, vat terminated');
setTerminationTrigger(vatID, true, true, err);
return harden(['crank-failed', {}]);
}
}
}
}
Expand Down

0 comments on commit c703d07

Please sign in to comment.