From affeea86e6856bb99a1d01b4073b57a9e4a5962a Mon Sep 17 00:00:00 2001 From: pbca26 Date: Thu, 5 Apr 2018 16:53:36 +0300 Subject: [PATCH] multisig address validation fix --- package.json | 4 ++-- routes/shepherd/electrum/keys.js | 11 ++++++++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 4e54ee5..a05927e 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "agama-app", "productName": "Agama", - "version": "0.2.30", + "version": "0.2.32", "description": "Agama Wallet Desktop App", "main": "main.js", "scripts": { @@ -32,7 +32,7 @@ "async": "^2.6.0", "bigi": "^1.4.2", "bip39": "^2.4.0", - "bitcoinforksjs-lib": "git://github.com/bitcoinjs/bitcoinjs-lib#opt-in-bitcoincash-sighash", + "bitcoinforksjs-lib": "git://github.com/SuperNETorg/bitcoinjs-lib#opt-in-bitcoincash-sighash", "bitcoinjs-lib": "git://github.com/SuperNETorg/bitcoinjs-lib", "bitcoinjs-lib-zcash": "git://github.com/pbca26/bitcoinjs-lib#zcash", "bitcoinjs-lib-pos": "git://github.com/KomodoPlatform/bitcoinjs-lib-pos", diff --git a/routes/shepherd/electrum/keys.js b/routes/shepherd/electrum/keys.js index fda562b..229056c 100644 --- a/routes/shepherd/electrum/keys.js +++ b/routes/shepherd/electrum/keys.js @@ -155,7 +155,7 @@ module.exports = (shepherd) => { const _b58check = shepherd.isZcash(network.toLowerCase()) ? bitcoinZcash.address.fromBase58Check(address) : bitcoin.address.fromBase58Check(address); if (_b58check.version === _network.pubKeyHash || - (address[0] === 'b' && shepherd.getNetworkData(network.toLowerCase()).pubKeyHash === 60)) { // kmd multisig edge case + _b58check.version === _network.scriptHash) { return true; } else { return false; @@ -165,6 +165,15 @@ module.exports = (shepherd) => { } }; + shepherd.get('/electrum/keys/validateaddress', (req, res, next) => { + const successObj = { + msg: 'success', + result: shepherd.addressVersionCheck(req.query.network, req.query.address), + }; + + res.end(JSON.stringify(successObj)); + }); + shepherd.post('/electrum/keys', (req, res, next) => { if (shepherd.checkToken(req.body.token)) { let _matchingKeyPairs = 0;