wallet: refactor variable names.

This commit is contained in:
Christopher Jeffrey 2016-08-17 05:12:20 -07:00
parent d0c4ea008b
commit 2c0aacf426
No known key found for this signature in database
GPG Key ID: 8962AB9DE6666BBD
4 changed files with 149 additions and 148 deletions

View File

@ -211,13 +211,13 @@ MTX.prototype.addOutput = function addOutput(options, value) {
* Build input script (or witness) templates (with
* OP_0 in place of signatures).
* @param {Number} index - Input index.
* @param {KeyRing} addr - Address used to build. The address
* @param {KeyRing} ring - Address used to build. The address
* must be able to redeem the coin.
* @returns {Boolean} Whether the script was able to be built.
* @throws on unavailable coins.
*/
MTX.prototype.scriptInput = function scriptInput(index, addr) {
MTX.prototype.scriptInput = function scriptInput(index, ring) {
var input, prev, n, i, vector, redeemScript, witnessScript;
if (typeof index !== 'number')
@ -240,7 +240,7 @@ MTX.prototype.scriptInput = function scriptInput(index, addr) {
// address map to avoid unnecessary calculation.
// A hash table lookup may be faster than all
// the nonsense below.
if (!addr.ownOutput(input.coin))
if (!ring.ownOutput(input.coin))
return false;
// Get the previous output's script
@ -250,26 +250,26 @@ MTX.prototype.scriptInput = function scriptInput(index, addr) {
// with segwit: figuring out where the redeem script and witness
// redeem scripts go.
if (prev.isScripthash()) {
if (addr.program && utils.equal(prev.get(1), addr.programHash)) {
if (ring.program && utils.equal(prev.get(1), ring.programHash)) {
// Witness program nested in regular P2SH.
redeemScript = addr.program.toRaw();
redeemScript = ring.program.toRaw();
vector = input.witness;
if (addr.program.isWitnessScripthash()) {
if (ring.program.isWitnessScripthash()) {
// P2WSH nested within pay-to-scripthash
// (it had to be this complicated, didn't it?)
witnessScript = addr.script.toRaw();
prev = addr.script;
} else if (addr.program.isWitnessPubkeyhash()) {
witnessScript = ring.script.toRaw();
prev = ring.script;
} else if (ring.program.isWitnessPubkeyhash()) {
// P2WPKH nested within pay-to-scripthash.
prev = Script.fromPubkeyhash(addr.keyHash);
prev = Script.fromPubkeyhash(ring.keyHash);
} else {
assert(false, 'Unknown program.');
}
} else if (addr.script && utils.equal(prev.get(1), addr.scriptHash160)) {
} else if (ring.script && utils.equal(prev.get(1), ring.scriptHash160)) {
// Regular P2SH.
redeemScript = addr.script.toRaw();
redeemScript = ring.script.toRaw();
vector = input.script;
prev = addr.script;
prev = ring.script;
} else {
return false;
}
@ -279,14 +279,14 @@ MTX.prototype.scriptInput = function scriptInput(index, addr) {
if (prev.isWitnessScripthash()) {
// Bare P2WSH.
if (!addr.script || !utils.equal(prev.get(1), addr.scriptHash256))
if (!ring.script || !utils.equal(prev.get(1), ring.scriptHash256))
return false;
witnessScript = addr.script.toRaw();
prev = addr.script;
witnessScript = ring.script.toRaw();
prev = ring.script;
} else if (prev.isWitnessPubkeyhash()) {
// Bare P2WPKH.
if (!utils.equal(prev.get(1), addr.keyHash))
if (!utils.equal(prev.get(1), ring.keyHash))
return false;
prev = Script.fromPubkeyhash(prev.get(1));
@ -301,7 +301,7 @@ MTX.prototype.scriptInput = function scriptInput(index, addr) {
if (prev.isPubkey()) {
// P2PK
if (!utils.equal(prev.get(1), addr.publicKey))
if (!utils.equal(prev.get(1), ring.publicKey))
return false;
// Already has a script template (at least)
@ -311,7 +311,7 @@ MTX.prototype.scriptInput = function scriptInput(index, addr) {
vector.set(0, opcodes.OP_0);
} else if (prev.isPubkeyhash()) {
// P2PKH
if (!utils.equal(prev.get(2), addr.keyHash))
if (!utils.equal(prev.get(2), ring.keyHash))
return false;
// Already has a script template (at least)
@ -319,10 +319,10 @@ MTX.prototype.scriptInput = function scriptInput(index, addr) {
return true;
vector.set(0, opcodes.OP_0);
vector.set(1, addr.publicKey);
vector.set(1, ring.publicKey);
} else if (prev.isMultisig()) {
// Multisig
if (prev.indexOf(addr.publicKey) === -1)
if (prev.indexOf(ring.publicKey) === -1)
return false;
// Already has a script template (at least)
@ -341,7 +341,7 @@ MTX.prototype.scriptInput = function scriptInput(index, addr) {
for (i = 0; i < n; i++)
vector.set(i + 1, opcodes.OP_0);
} else {
if (prev.indexOf(addr.publicKey) === -1)
if (prev.indexOf(ring.publicKey) === -1)
return false;
// Already has a script template (at least)
@ -411,7 +411,7 @@ MTX.prototype.createSignature = function createSignature(index, prev, key, type,
/**
* Sign an input.
* @param {Number} index - Index of input being signed.
* @param {KeyRing} addr - Address used to sign. The address
* @param {KeyRing} ring - Address used to sign. The address
* must be able to redeem the coin.
* @param {HDPrivateKey|KeyPair|Buffer} key - Private key.
* @param {SighashType} type
@ -419,7 +419,7 @@ MTX.prototype.createSignature = function createSignature(index, prev, key, type,
* @throws on unavailable coins.
*/
MTX.prototype.signInput = function signInput(index, addr, key, type) {
MTX.prototype.signInput = function signInput(index, ring, key, type) {
var input, prev, signature, keyIndex, signatures, i;
var len, m, n, keys, vector, version;
@ -479,7 +479,7 @@ MTX.prototype.signInput = function signInput(index, addr, key, type) {
return true;
// Make sure the pubkey is ours.
if (!utils.equal(addr.publicKey, prev.get(0)))
if (!utils.equal(ring.publicKey, prev.get(0)))
return false;
if (vector.getSmall(0) !== 0)
@ -498,7 +498,7 @@ MTX.prototype.signInput = function signInput(index, addr, key, type) {
return true;
// Make sure the pubkey hash is ours.
if (!utils.equal(addr.keyHash, prev.get(2)))
if (!utils.equal(ring.keyHash, prev.get(2)))
return false;
if (!Script.isKey(vector.get(1)))
@ -572,7 +572,7 @@ MTX.prototype.signInput = function signInput(index, addr, key, type) {
// Find the key index so we can place
// the signature in the same index.
keyIndex = utils.indexOf(keys, addr.publicKey);
keyIndex = utils.indexOf(keys, ring.publicKey);
// Our public key is not in the prev_out
// script. We tried to sign a transaction
@ -703,7 +703,7 @@ MTX.prototype.isSigned = function isSigned() {
/**
* Built input scripts (or witnesses) and sign the inputs.
* @param {Number} index - Index of input being signed.
* @param {KeyRing} addr - Address used to sign. The address
* @param {KeyRing} ring - Address used to sign. The address
* must be able to redeem the coin.
* @param {HDPrivateKey|KeyPair|Buffer} key - Private key.
* @param {SighashType} type
@ -711,7 +711,7 @@ MTX.prototype.isSigned = function isSigned() {
* @throws on unavailable coins.
*/
MTX.prototype.sign = function sign(index, addr, key, type) {
MTX.prototype.sign = function sign(index, ring, key, type) {
var input;
if (index && typeof index === 'object')
@ -721,11 +721,11 @@ MTX.prototype.sign = function sign(index, addr, key, type) {
assert(input);
// Build script for input
if (!this.scriptInput(index, addr))
if (!this.scriptInput(index, ring))
return false;
// Sign input
if (!this.signInput(index, addr, key, type))
if (!this.signInput(index, ring, key, type))
return false;
return true;

View File

@ -1030,8 +1030,8 @@ Wallet.prototype.resend = function resend(callback) {
Wallet.prototype.deriveInputs = function deriveInputs(tx, callback) {
var self = this;
var addresses = [];
var address;
var rings = [];
var ring;
this.getInputPaths(tx, function(err, paths) {
if (err)
@ -1045,8 +1045,8 @@ Wallet.prototype.deriveInputs = function deriveInputs(tx, callback) {
if (!account)
return next();
address = account.deriveAddress(path.change, path.index);
addresses.push(address);
ring = account.deriveAddress(path.change, path.index);
rings.push(ring);
return next();
});
@ -1054,7 +1054,7 @@ Wallet.prototype.deriveInputs = function deriveInputs(tx, callback) {
if (err)
return callback(err);
return callback(null, addresses);
return callback(null, rings);
});
});
};
@ -1068,7 +1068,7 @@ Wallet.prototype.deriveInputs = function deriveInputs(tx, callback) {
Wallet.prototype.getKeyring = function getKeyring(address, callback) {
var self = this;
var hash = bcoin.address.getHash(address, 'hex');
var address;
var ring;
if (!hash)
return callback();
@ -1087,9 +1087,9 @@ Wallet.prototype.getKeyring = function getKeyring(address, callback) {
if (!account)
return callback();
address = account.deriveAddress(path.change, path.index);
ring = account.deriveAddress(path.change, path.index);
return callback(null, address);
return callback(null, ring);
});
});
};
@ -1326,7 +1326,7 @@ Wallet.prototype.handleTX = function handleTX(info, callback) {
Wallet.prototype.getRedeem = function getRedeem(hash, callback) {
var self = this;
var address;
var ring;
if (typeof hash === 'string')
hash = new Buffer(hash, 'hex');
@ -1345,14 +1345,14 @@ Wallet.prototype.getRedeem = function getRedeem(hash, callback) {
if (!account)
return callback();
address = account.deriveAddress(path.change, path.index);
ring = account.deriveAddress(path.change, path.index);
if (address.program && hash.length === 20) {
if (utils.equal(hash, address.programHash))
return callback(null, address.program);
if (ring.program && hash.length === 20) {
if (utils.equal(hash, ring.programHash))
return callback(null, ring.program);
}
return callback(null, address.script);
return callback(null, ring.script);
});
});
};
@ -1372,12 +1372,12 @@ Wallet.prototype.scriptInputs = function scriptInputs(tx, callback) {
var total = 0;
var i;
this.deriveInputs(tx, function(err, addresses) {
this.deriveInputs(tx, function(err, rings) {
if (err)
return callback(err);
for (i = 0; i < addresses.length; i++)
total += addresses[i].scriptInputs(tx);
for (i = 0; i < rings.length; i++)
total += rings[i].scriptInputs(tx);
return callback(null, total);
});
@ -1406,7 +1406,7 @@ Wallet.prototype.sign = function sign(tx, options, callback) {
if (typeof options === 'string' || Buffer.isBuffer(options))
options = { passphrase: options };
this.deriveInputs(tx, function(err, addresses) {
this.deriveInputs(tx, function(err, rings) {
if (err)
return callback(err);
@ -1414,29 +1414,29 @@ Wallet.prototype.sign = function sign(tx, options, callback) {
if (err)
return callback(err);
self._sign(addresses, master, tx, options.index, options.type, callback);
self._sign(rings, master, tx, options.index, options.type, callback);
});
});
};
/**
* Sign a transaction.
* @param {KeyRing[]} addresses
* @param {KeyRing[]} rings
* @param {HDPrivateKey} master
* @param {MTX} tx
* @param {Number?} index
* @param {SighashType?} type
*/
Wallet.sign = function sign(addresses, master, tx, index, type) {
Wallet.sign = function sign(rings, master, tx, index, type) {
var total = 0;
var i, address, key;
var i, ring, key;
for (i = 0; i < addresses.length; i++) {
address = addresses[i];
key = address.derive(master);
assert(utils.equal(key.getPublicKey(), address.key));
total += address.sign(tx, key, index, type);
for (i = 0; i < rings.length; i++) {
ring = rings[i];
key = ring.derive(master);
assert(utils.equal(key.getPublicKey(), ring.key));
total += ring.sign(tx, key, index, type);
}
return total;
@ -1444,7 +1444,7 @@ Wallet.sign = function sign(addresses, master, tx, index, type) {
/**
* Sign a transaction asynchronously.
* @param {KeyRing[]} addresses
* @param {KeyRing[]} rings
* @param {HDPrivateKey} master
* @param {MTX} tx
* @param {Number?} index
@ -1453,20 +1453,20 @@ Wallet.sign = function sign(addresses, master, tx, index, type) {
* of inputs scripts built and signed).
*/
Wallet.prototype._sign = function _sign(addresses, master, tx, index, type, callback) {
Wallet.prototype._sign = function _sign(rings, master, tx, index, type, callback) {
var result;
if (!this.workerPool) {
callback = utils.asyncify(callback);
try {
result = Wallet.sign(addresses, master, tx, index, type);
result = Wallet.sign(rings, master, tx, index, type);
} catch (e) {
return callback(e);
}
return callback(null, result);
}
this.workerPool.sign(addresses, master, tx, index, type, callback);
this.workerPool.sign(rings, master, tx, index, type, callback);
};
/**
@ -2390,11 +2390,11 @@ Account.prototype.addKey = function addKey(key, callback) {
return callback(e);
}
this._checkKeys(function(err, has) {
this._checkKeys(function(err, exists) {
if (err)
return callback(err);
if (has) {
if (exists) {
self.spliceKey(key);
return callback(new Error('Cannot add a key from another account.'));
}
@ -2417,7 +2417,7 @@ Account.prototype.addKey = function addKey(key, callback) {
Account.prototype._checkKeys = function _checkKeys(callback) {
var self = this;
var address;
var ring, hash;
if (this.initialized || this.type !== keyTypes.MULTISIG)
return callback(null, false);
@ -2425,9 +2425,10 @@ Account.prototype._checkKeys = function _checkKeys(callback) {
if (this.keys.length !== this.n)
return callback(null, false);
address = this.deriveReceive(0).getScriptAddress();
ring = this.deriveReceive(0);
hash = ring.getScriptHash('hex');
this.db.getAddressPaths(address.getHash('hex'), function(err, paths) {
this.db.getAddressPaths(hash, function(err, paths) {
if (err)
return callback(err);
@ -2485,32 +2486,32 @@ Account.prototype.createChange = function createChange(callback) {
Account.prototype.createAddress = function createAddress(change, callback) {
var self = this;
var address, lookahead;
var ring, lookahead;
if (typeof change === 'function') {
callback = change;
change = null;
change = false;
}
if (change) {
address = this.deriveChange(this.changeDepth);
ring = this.deriveChange(this.changeDepth);
lookahead = this.deriveChange(this.changeDepth + this.lookahead);
this.changeDepth++;
this.changeAddress = address;
this.changeAddress = ring;
} else {
address = this.deriveReceive(this.receiveDepth);
ring = this.deriveReceive(this.receiveDepth);
lookahead = this.deriveReceive(this.receiveDepth + this.lookahead);
this.receiveDepth++;
this.receiveAddress = address;
this.receiveAddress = ring;
}
this.saveAddress([address, lookahead], function(err) {
this.saveAddress([ring, lookahead], function(err) {
if (err)
return callback(err);
self.save();
return callback(null, address);
return callback(null, ring);
});
};
@ -2570,12 +2571,12 @@ Account.prototype.save = function save() {
/**
* Save addresses to path map.
* @param {KeyRing[]} address
* @param {KeyRing[]} rings
* @param {Function} callback
*/
Account.prototype.saveAddress = function saveAddress(address, callback) {
return this.db.saveAddress(this.wid, address, callback);
Account.prototype.saveAddress = function saveAddress(rings, callback) {
return this.db.saveAddress(this.wid, rings, callback);
};
/**
@ -2588,17 +2589,17 @@ Account.prototype.saveAddress = function saveAddress(address, callback) {
Account.prototype.setDepth = function setDepth(receiveDepth, changeDepth, callback) {
var self = this;
var addresses = [];
var rings = [];
var i, receive, change;
if (receiveDepth > this.receiveDepth) {
for (i = this.receiveDepth; i < receiveDepth; i++) {
receive = this.deriveReceive(i);
addresses.push(receive);
rings.push(receive);
}
for (i = receiveDepth; i < receiveDepth + this.lookahead; i++)
addresses.push(this.deriveReceive(i));
rings.push(this.deriveReceive(i));
this.receiveAddress = receive;
this.receiveDepth = receiveDepth;
@ -2607,20 +2608,20 @@ Account.prototype.setDepth = function setDepth(receiveDepth, changeDepth, callba
if (changeDepth > this.changeDepth) {
for (i = this.changeDepth; i < changeDepth; i++) {
change = this.deriveChange(i);
addresses.push(change);
rings.push(change);
}
for (i = changeDepth; i < changeDepth + this.lookahead; i++)
addresses.push(this.deriveChange(i));
rings.push(this.deriveChange(i));
this.changeAddress = change;
this.changeDepth = changeDepth;
}
if (addresses.length === 0)
if (rings.length === 0)
return callback();
this.saveAddress(addresses, function(err) {
this.saveAddress(rings, function(err) {
if (err)
return callback(err);

View File

@ -400,18 +400,18 @@ WalletDB.prototype.loadFilter = function loadFilter(callback) {
/**
* Test the bloom filter against an array of address hashes.
* @private
* @param {Hash[]} addresses
* @param {Hash[]} hashes
* @returns {Boolean}
*/
WalletDB.prototype.testFilter = function testFilter(addresses) {
WalletDB.prototype.testFilter = function testFilter(hashes) {
var i;
if (!this.filter)
return true;
for (i = 0; i < addresses.length; i++) {
if (this.filter.test(addresses[i], 'hex'))
for (i = 0; i < hashes.length; i++) {
if (this.filter.test(hashes[i], 'hex'))
return true;
}
@ -907,35 +907,35 @@ WalletDB.prototype.hasAccount = function hasAccount(wid, account, callback) {
* The path map exists in the form of:
* `p/[address-hash] -> {walletid1=path1, walletid2=path2, ...}`
* @param {WalletID} wid
* @param {KeyRing[]} addresses
* @param {KeyRing[]} rings
* @param {Function} callback
*/
WalletDB.prototype.saveAddress = function saveAddress(wid, addresses, callback) {
WalletDB.prototype.saveAddress = function saveAddress(wid, rings, callback) {
var self = this;
var items = [];
var batch = this.batch(wid);
var i, address, path;
var i, ring, path;
for (i = 0; i < addresses.length; i++) {
address = addresses[i];
path = Path.fromKeyRing(address);
for (i = 0; i < rings.length; i++) {
ring = rings[i];
path = Path.fromKeyRing(ring);
items.push([address.getAddress(), path]);
items.push([ring.getAddress(), path]);
if (address.witness)
items.push([address.getProgramAddress(), path]);
if (ring.witness)
items.push([ring.getProgramAddress(), path]);
}
utils.forEachSerial(items, function(item, next) {
var address = item[0];
var ring = item[0];
var path = item[1];
var hash = address.getHash('hex');
var hash = ring.getHash('hex');
if (self.filter)
self.filter.add(hash, 'hex');
self.emit('save address', address, path);
self.emit('save address', ring, path);
self.getAddressPaths(hash, function(err, paths) {
if (err)
@ -995,12 +995,12 @@ WalletDB.prototype.getAddressPaths = function getAddressPaths(hash, callback) {
* Test whether an address hash exists in the
* path map and is relevant to the wallet id.
* @param {WalletID} wid
* @param {Hash} address
* @param {Hash} hash
* @param {Function} callback
*/
WalletDB.prototype.hasAddress = function hasAddress(wid, address, callback) {
this.getAddressPaths(address, function(err, paths) {
WalletDB.prototype.hasAddress = function hasAddress(wid, hash, callback) {
this.getAddressPaths(hash, function(err, paths) {
if (err)
return callback(err);
@ -1133,13 +1133,13 @@ WalletDB.prototype.fetchWallet = function fetchWallet(wid, callback, handler) {
WalletDB.prototype.mapWallets = function mapWallets(tx, callback) {
var self = this;
var addresses = tx.getHashes('hex');
var hashes = tx.getHashes('hex');
var wallets;
if (!this.testFilter(addresses))
if (!this.testFilter(hashes))
return callback();
this.getTable(addresses, function(err, table) {
this.getTable(hashes, function(err, table) {
if (err)
return callback(err);
@ -1160,10 +1160,10 @@ WalletDB.prototype.mapWallets = function mapWallets(tx, callback) {
WalletDB.prototype.getPathInfo = function getPathInfo(wallet, tx, callback) {
var self = this;
var addresses = tx.getHashes('hex');
var hashes = tx.getHashes('hex');
var info;
this.getTable(addresses, function(err, table) {
this.getTable(hashes, function(err, table) {
if (err)
return callback(err);
@ -1179,24 +1179,24 @@ WalletDB.prototype.getPathInfo = function getPathInfo(wallet, tx, callback) {
/**
* Map address hashes to paths.
* @param {Hash[]} address - Address hashes.
* @param {Hash[]} hashes - Address hashes.
* @param {Function} callback - Returns [Error, {@link AddressTable}].
*/
WalletDB.prototype.getTable = function getTable(addresses, callback) {
WalletDB.prototype.getTable = function getTable(hashes, callback) {
var self = this;
var table = {};
var count = 0;
var i, keys, values;
utils.forEachSerial(addresses, function(address, next) {
self.getAddressPaths(address, function(err, paths) {
utils.forEachSerial(hashes, function(hash, next) {
self.getAddressPaths(hash, function(err, paths) {
if (err)
return next(err);
if (!paths) {
assert(!table[address]);
table[address] = [];
assert(!table[hash]);
table[hash] = [];
return next();
}
@ -1206,8 +1206,8 @@ WalletDB.prototype.getTable = function getTable(addresses, callback) {
for (i = 0; i < keys.length; i++)
values.push(paths[keys[i]]);
assert(!table[address]);
table[address] = values;
assert(!table[hash]);
table[hash] = values;
count += values.length;
return next();
@ -1523,12 +1523,12 @@ WalletDB.prototype.addTX = function addTX(tx, callback, force) {
/**
* Get the corresponding path for an address hash.
* @param {WalletID} wid
* @param {Hash} address
* @param {Hash} hash
* @param {Function} callback
*/
WalletDB.prototype.getAddressPath = function getAddressPath(wid, address, callback) {
this.getAddressPaths(address, function(err, paths) {
WalletDB.prototype.getAddressPath = function getAddressPath(wid, hash, callback) {
this.getAddressPaths(hash, function(err, paths) {
if (err)
return callback(err);
@ -1629,21 +1629,21 @@ Path.prototype.toRaw = function toRaw(writer) {
* Inject properties from keyring.
* @private
* @param {WalletID} wid
* @param {KeyRing} address
* @param {KeyRing} ring
*/
Path.prototype.fromKeyRing = function fromKeyRing(address) {
this.wid = address.wid;
this.name = address.name;
this.account = address.account;
this.change = address.change;
this.index = address.index;
Path.prototype.fromKeyRing = function fromKeyRing(ring) {
this.wid = ring.wid;
this.name = ring.name;
this.account = ring.account;
this.change = ring.change;
this.index = ring.index;
this.version = address.witness ? 0 : -1;
this.type = address.getScriptType();
this.version = ring.witness ? 0 : -1;
this.type = ring.getScriptType();
this.id = address.id;
this.hash = address.getHash('hex');
this.id = ring.id;
this.hash = ring.getHash('hex');
return this;
};
@ -1651,12 +1651,12 @@ Path.prototype.fromKeyRing = function fromKeyRing(address) {
/**
* Instantiate path from keyring.
* @param {WalletID} wid
* @param {KeyRing} address
* @param {KeyRing} ring
* @returns {Path}
*/
Path.fromKeyRing = function fromKeyRing(address) {
return new Path().fromKeyRing(address);
Path.fromKeyRing = function fromKeyRing(ring) {
return new Path().fromKeyRing(ring);
};
/**
@ -1856,28 +1856,28 @@ PathInfo.fromTX = function fromTX(db, wid, tx, table) {
/**
* Test whether the map has paths
* for a given address hash.
* @param {Hash} address
* @param {Hash} hash
* @returns {Boolean}
*/
PathInfo.prototype.hasPath = function hasPath(address) {
if (!address)
PathInfo.prototype.hasPath = function hasPath(hash) {
if (!hash)
return false;
return this.pathMap[address] != null;
return this.pathMap[hash] != null;
};
/**
* Get paths for a given address hash.
* @param {Hash} address
* @param {Hash} hash
* @returns {Path[]|null}
*/
PathInfo.prototype.getPath = function getPath(address) {
if (!address)
PathInfo.prototype.getPath = function getPath(hash) {
if (!hash)
return;
return this.pathMap[address];
return this.pathMap[hash];
};
PathInfo.prototype.toDetails = function toDetails() {

View File

@ -242,7 +242,7 @@ Workers.prototype.verify = function verify(tx, flags, callback) {
/**
* Execute the tx signing job (default timeout).
* @param {KeyRing[]} addresses
* @param {KeyRing[]} rings
* @param {HDPrivateKey} master
* @param {MTX} tx
* @param {Number?} index
@ -250,8 +250,8 @@ Workers.prototype.verify = function verify(tx, flags, callback) {
* @param {Function} callback
*/
Workers.prototype.sign = function sign(addresses, master, tx, index, type, callback) {
var args = [addresses, master, tx, index, type];
Workers.prototype.sign = function sign(rings, master, tx, index, type, callback) {
var args = [rings, master, tx, index, type];
var i, input, sig, sigs, total;
return this.execute('sign', args, -1, function(err, result) {
@ -772,15 +772,15 @@ jobs.verify = function verify(tx, flags) {
/**
* Execute Wallet.sign() on worker.
* @see Wallet.sign
* @param {KeyRing[]} addresses
* @param {KeyRing[]} rings
* @param {HDPrivateKey} master
* @param {MTX} tx
* @param {Number?} index
* @param {SighashType?} type
*/
jobs.sign = function sign(addresses, master, tx, index, type) {
var total = bcoin.wallet.sign(addresses, master, tx, index, type);
jobs.sign = function sign(rings, master, tx, index, type) {
var total = bcoin.wallet.sign(rings, master, tx, index, type);
var sigs = [];
var i, input;