From 373f668562fedede73ec46c017d4bbc2b5e059fb Mon Sep 17 00:00:00 2001 From: Daniel Cousens Date: Fri, 28 Mar 2014 16:20:46 +1100 Subject: [PATCH] Adds version support to Message.verifyMessage --- src/message.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/message.js b/src/message.js index 84d3b43..998c751 100644 --- a/src/message.js +++ b/src/message.js @@ -1,8 +1,9 @@ /// Implements Bitcoin's feature for signing arbitrary messages. -var SHA256 = require('crypto-js/sha256') -var ecdsa = require('./ecdsa') +var Address = require('./address') var convert = require('./convert') +var ecdsa = require('./ecdsa') +var SHA256 = require('crypto-js/sha256') var Message = {} @@ -59,7 +60,8 @@ Message.verifyMessage = function (address, sig, message) { pubKey.compressed = isCompressed // Compare address to expected address - return address === pubKey.getAddress().toString() + address = new Address(address) + return address.toString() === pubKey.getAddress(address.version).toString() } module.exports = Message