remove wallet.signEmpty and tx.signature for now.
This commit is contained in:
parent
c8e04d8552
commit
acbe4d0c2e
@ -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;
|
||||
};
|
||||
|
||||
@ -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);
|
||||
};
|
||||
|
||||
Loading…
Reference in New Issue
Block a user