From 21205542c1c01988d6d968d52905ae7355732f0f Mon Sep 17 00:00:00 2001 From: Alex Step Date: Tue, 14 Nov 2017 15:21:13 +0200 Subject: [PATCH] fix signHash --- src/model/Eth/Wallet.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/model/Eth/Wallet.js b/src/model/Eth/Wallet.js index 551eba8..80f3f91 100644 --- a/src/model/Eth/Wallet.js +++ b/src/model/Eth/Wallet.js @@ -258,7 +258,15 @@ export default class Wallet { signHash(hash){ if (!_privkey) return false - return signHash(hash, _privkey) + + hash = Utils.add0x(hash) + if (this.web3.utils.isHexStrict(hash)) { + console.log(hash+' is not correct hex') + console.log('Use DCLib.Utils.makeSeed or Utils.soliditySHA3(your_args) to create valid hash') + throw new Error('invalid hash') + } + + return signHash(hash, Utils.add0x(_privkey)) } }