Browse Source

address validation kmd multisig edge case

custom-ac-example
pbca26 7 years ago
parent
commit
2ef6b45b66
  1. 8
      routes/shepherd/electrum/keys.js

8
routes/shepherd/electrum/keys.js

@ -21,6 +21,7 @@ module.exports = (shepherd) => {
shepherd.seedToWif = (seed, network, iguana) => { shepherd.seedToWif = (seed, network, iguana) => {
let bytes; let bytes;
// legacy seed edge case
if (process.argv.indexOf('spvold=true') > -1) { if (process.argv.indexOf('spvold=true') > -1) {
bytes = buggySha256(seed, { asBytes: true }); bytes = buggySha256(seed, { asBytes: true });
} else { } else {
@ -142,7 +143,7 @@ module.exports = (shepherd) => {
} else { } else {
return 'Unable to find matching coin version'; return 'Unable to find matching coin version';
} }
} catch(e) { } catch (e) {
return 'Invalid pub address'; return 'Invalid pub address';
} }
}; };
@ -153,12 +154,13 @@ module.exports = (shepherd) => {
try { try {
const _b58check = shepherd.isZcash(network.toLowerCase()) ? bitcoinZcash.address.fromBase58Check(address) : bitcoin.address.fromBase58Check(address); const _b58check = shepherd.isZcash(network.toLowerCase()) ? bitcoinZcash.address.fromBase58Check(address) : bitcoin.address.fromBase58Check(address);
if (_b58check.version === _network.pubKeyHash) { if (_b58check.version === _network.pubKeyHash ||
(address[0] === 'b' && shepherd.getNetworkData(network.toLowerCase()).pubKeyHash === 60)) { // kmd multisig edge case
return true; return true;
} else { } else {
return false; return false;
} }
} catch(e) { } catch (e) {
return 'Invalid pub address'; return 'Invalid pub address';
} }
}; };

Loading…
Cancel
Save