From acbe4d0c2e471f6501084035a602573b551be91a Mon Sep 17 00:00:00 2001 From: Christopher Jeffrey Date: Sat, 5 Dec 2015 00:01:59 -0800 Subject: [PATCH] remove wallet.signEmpty and tx.signature for now. --- lib/bcoin/tx.js | 13 ------------- lib/bcoin/wallet.js | 30 ------------------------------ 2 files changed, 43 deletions(-) diff --git a/lib/bcoin/tx.js b/lib/bcoin/tx.js index 198ed593..ff56709d 100644 --- a/lib/bcoin/tx.js +++ b/lib/bcoin/tx.js @@ -235,19 +235,6 @@ TX.prototype.verify = function verify(index, force) { }, this); }; -TX.prototype.signature = function signature(key, index, sighash) { - if (typeof index !== 'number') { - index = tx.inputs.indexOf(index); - if (index === -1) return; - } - var input = this.inputs[index]; - var subscript = input.out.tx.getSubscript(input.out.index); - var hash = this.subscriptHash(input, subscript, sighash); - var signature = bcoin.ecdsa.sign(hash, key).toDER(); - signature = signature.concat(bcoin.protocol.constants.hashType[sighash]); - return signature; -}; - TX.prototype.isCoinbase = function isCoinbase() { return this.inputs.length === 1 && +this.inputs[0].out.hash === 0; }; diff --git a/lib/bcoin/wallet.js b/lib/bcoin/wallet.js index 6f4d0faf..ffab83e2 100644 --- a/lib/bcoin/wallet.js +++ b/lib/bcoin/wallet.js @@ -271,8 +271,6 @@ Wallet.prototype.sign = function sign(tx, type, inputs, off) { if (!type) type = 'all'; - // assert.equal(type, 'all'); - if (!off) off = 0; @@ -323,34 +321,6 @@ Wallet.prototype.sign = function sign(tx, type, inputs, off) { return inputs.length; }; -Wallet.prototype.signEmpty = function sign(tx, type, inputs, off) { - if (!type) - type = 'all'; - - // assert.equal(type, 'all'); - - if (!off) - off = 0; - - var pub = this.getPublicKey(); - inputs = inputs || tx.inputs; - - // Add signature script to each input - inputs = inputs.filter(function(input, i) { - // Filter inputs that this wallet own - if (!input.out.tx || !this.ownOutput(input.out.tx)) - return false; - - var signature = [0x30, 0, 0x02, 0, 0, 0x02, 0, 0]; - signature = signature.concat(bcoin.protocol.constants.hashType[type]); - - input.script = [ signature, pub ]; - return true; - }, this); - - return inputs.length; -}; - Wallet.prototype.addTX = function addTX(tx, block) { return this.tx.add(tx); };