Fixes variable redeclarations
This commit is contained in:
parent
ed137a3b9d
commit
87453f1828
3 changed files with 15 additions and 10 deletions
10
src/eckey.js
10
src/eckey.js
|
@ -63,7 +63,7 @@ ECKey.prototype.getPub = function(compressed) {
|
|||
* @deprecated Reserved keyword, factory pattern. Use toHex, toBytes, etc.
|
||||
*/
|
||||
ECKey.prototype['export'] = function(format) {
|
||||
format || (format = 'hex')
|
||||
var format = format || 'hex'
|
||||
return this['to' + format.substr(0, 1).toUpperCase() + format.substr(1)]()
|
||||
}
|
||||
|
||||
|
@ -77,7 +77,7 @@ ECKey.version_bytes = {
|
|||
}
|
||||
|
||||
ECKey.prototype.toWif = function(version) {
|
||||
var version = version || Network.mainnet.addressVersion;
|
||||
version = version || Network.mainnet.addressVersion;
|
||||
|
||||
return base58.checkEncode(this.toBytes(), ECKey.version_bytes[version])
|
||||
}
|
||||
|
@ -147,7 +147,7 @@ ECPubKey.prototype.multiply = function(key) {
|
|||
}
|
||||
|
||||
ECPubKey.prototype['export'] = function(format) {
|
||||
format || (format = 'hex')
|
||||
var format = format || 'hex';
|
||||
return this['to' + format.substr(0, 1).toUpperCase() + format.substr(1)]()
|
||||
}
|
||||
|
||||
|
@ -165,7 +165,7 @@ ECPubKey.prototype.toBin = function() {
|
|||
}
|
||||
|
||||
ECPubKey.prototype.toWif = function(version) {
|
||||
var version = version || Network.mainnet.addressVersion;
|
||||
version = version || Network.mainnet.addressVersion;
|
||||
|
||||
return base58.checkEncode(this.toBytes(), version)
|
||||
}
|
||||
|
@ -173,7 +173,7 @@ ECPubKey.prototype.toWif = function(version) {
|
|||
ECPubKey.prototype.toString = ECPubKey.prototype.toHex
|
||||
|
||||
ECPubKey.prototype.getAddress = function(version) {
|
||||
var version = version || Network.mainnet.addressVersion;
|
||||
version = version || Network.mainnet.addressVersion;
|
||||
|
||||
return new Address(util.sha256ripe160(this.toBytes()), version);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
Opcode = {
|
||||
var Opcode = {
|
||||
map: {
|
||||
// push value
|
||||
OP_0 : 0,
|
||||
|
|
|
@ -60,8 +60,9 @@ Transaction.prototype.addInput = function (tx, outIndex) {
|
|||
return this.addInput(args[0], args[1]);
|
||||
}
|
||||
else {
|
||||
var hash = typeof tx === "string" ? tx : tx.hash
|
||||
var hash = Array.isArray(hash) ? convert.bytesToHex(hash) : hash
|
||||
var hash = typeof tx === "string" ? tx : tx.hash;
|
||||
hash = Array.isArray(hash) ? convert.bytesToHex(hash) : hash;
|
||||
|
||||
this.ins.push(new TransactionIn({
|
||||
outpoint: {
|
||||
hash: hash,
|
||||
|
@ -269,7 +270,9 @@ Transaction.deserialize = function(buffer) {
|
|||
}
|
||||
obj.version = readAsInt(4);
|
||||
var ins = readVarInt();
|
||||
for (var i = 0; i < ins; i++) {
|
||||
var i;
|
||||
|
||||
for (i = 0; i < ins; i++) {
|
||||
obj.ins.push({
|
||||
outpoint: {
|
||||
hash: convert.bytesToHex(readBytes(32).reverse()),
|
||||
|
@ -280,12 +283,14 @@ Transaction.deserialize = function(buffer) {
|
|||
});
|
||||
}
|
||||
var outs = readVarInt();
|
||||
for (var i = 0; i < outs; i++) {
|
||||
|
||||
for (i = 0; i < outs; i++) {
|
||||
obj.outs.push({
|
||||
value: convert.bytesToNum(readBytes(8)),
|
||||
script: new Script(readVarString())
|
||||
});
|
||||
}
|
||||
|
||||
obj.locktime = readAsInt(4);
|
||||
|
||||
return new Transaction(obj);
|
||||
|
|
Loading…
Add table
Reference in a new issue