fixes and minor style changes
This commit is contained in:
parent
ea9af49f4b
commit
87eea1e398
@ -475,7 +475,7 @@ Peer.prototype._handleHeaders = function handleHeaders(headers) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
Peer.prototype.loadHeaders = function loadBlocks(hashes, stop) {
|
Peer.prototype.loadHeaders = function loadHeaders(hashes, stop) {
|
||||||
this._write(this.framer.getHeaders(hashes, stop));
|
this._write(this.framer.getHeaders(hashes, stop));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -201,7 +201,7 @@ Framer.prototype.filterClear = function filterClear() {
|
|||||||
return this.packet('filterclear', []);
|
return this.packet('filterclear', []);
|
||||||
};
|
};
|
||||||
|
|
||||||
Framer.prototype.getHeaders = function getBlocks(hashes, stop) {
|
Framer.prototype.getHeaders = function getHeaders(hashes, stop) {
|
||||||
return this._getBlocks('getheaders', hashes, stop);
|
return this._getBlocks('getheaders', hashes, stop);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -235,14 +235,14 @@ TX.prototype.verify = function verify(index, force) {
|
|||||||
}, this);
|
}, this);
|
||||||
};
|
};
|
||||||
|
|
||||||
TX.prototype.signature = function signature(tx, key, index, sighash) {
|
TX.prototype.signature = function signature(key, index, sighash) {
|
||||||
if (typeof index !== 'number') {
|
if (typeof index !== 'number') {
|
||||||
index = tx.inputs.indexOf(index);
|
index = tx.inputs.indexOf(index);
|
||||||
if (index === -1) return;
|
if (index === -1) return;
|
||||||
}
|
}
|
||||||
var input = tx.inputs[index];
|
var input = this.inputs[index];
|
||||||
var subscript = input.out.tx.getSubscript(input.out.index);
|
var subscript = input.out.tx.getSubscript(input.out.index);
|
||||||
var hash = tx.subscriptHash(input, subscript, sighash);
|
var hash = this.subscriptHash(input, subscript, sighash);
|
||||||
var signature = bcoin.ecdsa.sign(hash, key).toDER();
|
var signature = bcoin.ecdsa.sign(hash, key).toDER();
|
||||||
signature = signature.concat(bcoin.protocol.constants.hashType[sighash]);
|
signature = signature.concat(bcoin.protocol.constants.hashType[sighash]);
|
||||||
return signature;
|
return signature;
|
||||||
|
|||||||
@ -487,7 +487,7 @@ Wallet.prototype.getP2SH = function(redeem) {
|
|||||||
var hash = utils.ripasha(redemption);
|
var hash = utils.ripasha(redemption);
|
||||||
return {
|
return {
|
||||||
hash: hash,
|
hash: hash,
|
||||||
address: bcoin.wallet.hash2addr(hash, 'p2sh'),
|
address: Wallet.hash2addr(hash, 'p2sh'),
|
||||||
redemption: redemption
|
redemption: redemption
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@ -495,7 +495,7 @@ Wallet.prototype.getP2SH = function(redeem) {
|
|||||||
Wallet.prototype._createMultisigRedemption = function() {
|
Wallet.prototype._createMultisigRedemption = function() {
|
||||||
var publicKeys = this.publicKeys;
|
var publicKeys = this.publicKeys;
|
||||||
var mcode = constants.opcodes['1'] + (this.m - 1);
|
var mcode = constants.opcodes['1'] + (this.m - 1);
|
||||||
var ncode = script.push(constants.opcodes['1'] + (this.n - 1));
|
var ncode = constants.opcodes['1'] + (this.n - 1);
|
||||||
var redemption = [];
|
var redemption = [];
|
||||||
redemption.push(mcode);
|
redemption.push(mcode);
|
||||||
this.publicKeys.forEach(function(pubkey) {
|
this.publicKeys.forEach(function(pubkey) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user