diff --git a/lib/primitives/mtx.js b/lib/primitives/mtx.js index b6c1f744..6040f522 100644 --- a/lib/primitives/mtx.js +++ b/lib/primitives/mtx.js @@ -10,7 +10,6 @@ module.exports = MTX; var utils = require('../utils/utils'); -var crypto = require('../crypto/crypto'); var assert = require('assert'); var constants = require('../protocol/constants'); var Network = require('../protocol/network'); @@ -482,13 +481,12 @@ MTX.prototype.signInput = function signInput(index, ring, type) { */ MTX.prototype.signVector = function signVector(prev, vector, sig, ring) { - var pub = ring.publicKey; var i, m, n, keys, keyIndex, total; // P2PK if (prev.isPubkey()) { // Make sure the pubkey is ours. - if (!utils.equal(pub, prev.get(0))) + if (!utils.equal(ring.keyHash, prev.get(0))) return false; // Already signed. @@ -507,7 +505,7 @@ MTX.prototype.signVector = function signVector(prev, vector, sig, ring) { // P2PKH if (prev.isPubkeyhash()) { // Make sure the pubkey hash is ours. - if (!utils.equal(crypto.hash160(pub), prev.get(2))) + if (!utils.equal(ring.keyHash, prev.get(2))) return false; // Already signed. @@ -563,7 +561,7 @@ MTX.prototype.signVector = function signVector(prev, vector, sig, ring) { // Find the key index so we can place // the signature in the same index. - keyIndex = utils.indexOf(keys, pub); + keyIndex = utils.indexOf(keys, ring.publicKey); // Our public key is not in the prev_out // script. We tried to sign a transaction