Skip to content

Commit

Permalink
ethash: apply strict-boolean-expressions
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrocheleau committed Jul 9, 2022
1 parent 7622960 commit a0a60ab
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions packages/ethash/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import {
bufArrToArr,
bufferToBigInt,
setLengthLeft,
isTruthy,
isFalsy,
} from '@ethereumjs/util'
import { RLP } from 'rlp'
import {
Expand Down Expand Up @@ -133,7 +135,7 @@ export class Miner {
}, 0)
})

if (solution) {
if (isTruthy(solution)) {
return <Solution>solution
}
}
Expand Down Expand Up @@ -203,10 +205,10 @@ export class Ethash {
}

run(val: Buffer, nonce: Buffer, fullSize?: number) {
if (!fullSize && this.fullSize) {
if (isFalsy(fullSize) && isTruthy(this.fullSize)) {
fullSize = this.fullSize
}
if (!fullSize) {
if (isFalsy(fullSize)) {
throw new Error('fullSize needed')
}
const n = Math.floor(fullSize / params.HASH_BYTES)
Expand Down

0 comments on commit a0a60ab

Please sign in to comment.