Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

Minor refactor for clarity #4174

Merged
merged 3 commits into from
Jan 17, 2017
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions js/src/abi/util/address.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,13 @@ import { keccak_256 } from 'js-sha3'; // eslint-disable-line camelcase

export function isChecksumValid (_address) {
const address = _address.replace('0x', '');
const hash = keccak_256(address.toLowerCase(address));
const hash = keccak_256(address.toLowerCase());

for (let n = 0; n < 40; n++) {
const char = address[n];
const isLower = char != char.toUpperCase();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use !== (here and line below)

const isUpper = char != char.toLowerCase();
const hashval = parseInt(hash[n], 16);
const isLower = address[n].toUpperCase() !== address[n];
const isUpper = address[n].toLowerCase() !== address[n];

if ((hashval > 7 && isLower) || (hashval <= 7 && isUpper)) {
return false;
Expand Down
2 changes: 1 addition & 1 deletion js/src/views/Dapps/builtin.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"id": "0xae74ad174b95cdbd01c88ac5b73a296d33e9088fc2a200e76bcedf3a94a7815d",
"url": "localtx",
"name": "TxQueue Viewer",
"description": "Have a peak on internals of transaction queue of your node.",
"description": "Have a peek at the internals of your node's transaction queue.",
"author": "Parity Team <admin@ethcore.io>",
"version": "1.0.0",
"visible": true,
Expand Down