diff options
author | Dan Finlay <dan@danfinlay.com> | 2017-03-07 08:33:33 +0800 |
---|---|---|
committer | Dan Finlay <dan@danfinlay.com> | 2017-03-07 08:33:33 +0800 |
commit | e66e755766ef318c38277c184d2670cc2179d37a (patch) | |
tree | 9989fe06bc29295925d2b4a8e492848bcecf1c50 | |
parent | 26ea5993a9dffa687b50446bbffd0d2310a796bc (diff) | |
download | tangerine-wallet-browser-e66e755766ef318c38277c184d2670cc2179d37a.tar tangerine-wallet-browser-e66e755766ef318c38277c184d2670cc2179d37a.tar.gz tangerine-wallet-browser-e66e755766ef318c38277c184d2670cc2179d37a.tar.bz2 tangerine-wallet-browser-e66e755766ef318c38277c184d2670cc2179d37a.tar.lz tangerine-wallet-browser-e66e755766ef318c38277c184d2670cc2179d37a.tar.xz tangerine-wallet-browser-e66e755766ef318c38277c184d2670cc2179d37a.tar.zst tangerine-wallet-browser-e66e755766ef318c38277c184d2670cc2179d37a.zip |
Fix normalizeMsgData function to always return hex prefixed
-rw-r--r-- | app/scripts/lib/personal-message-manager.js | 2 | ||||
-rw-r--r-- | test/unit/personal-message-manager-test.js | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/app/scripts/lib/personal-message-manager.js b/app/scripts/lib/personal-message-manager.js index 04dba4a90..bbc978446 100644 --- a/app/scripts/lib/personal-message-manager.js +++ b/app/scripts/lib/personal-message-manager.js @@ -112,7 +112,7 @@ module.exports = class PersonalMessageManager extends EventEmitter{ try { const stripped = ethUtil.stripHexPrefix(data) if (stripped.match(hexRe)) { - return stripped + return ethUtil.addHexPrefix(stripped) } } catch (e) { log.debug(`Message was not hex encoded, interpreting as utf8.`) diff --git a/test/unit/personal-message-manager-test.js b/test/unit/personal-message-manager-test.js index 5ee03726f..77e1656c5 100644 --- a/test/unit/personal-message-manager-test.js +++ b/test/unit/personal-message-manager-test.js @@ -97,13 +97,13 @@ describe('Personal Message Manager', function() { it('tolerates a hex prefix', function() { var input = '0x12' var output = messageManager.normalizeMsgData(input) - assert.equal(output, '12', 'un modified') + assert.equal(output, '0x12', 'un modified') }) it('tolerates normal hex', function() { var input = '12' var output = messageManager.normalizeMsgData(input) - assert.equal(output, '12', 'adds prefix') + assert.equal(output, '0x12', 'adds prefix') }) }) |