This commit is contained in:
Christopher Jeffrey 2016-06-27 07:10:26 -07:00
parent 90769d7e1a
commit b74bda623f
No known key found for this signature in database
GPG Key ID: 8962AB9DE6666BBD
8 changed files with 16 additions and 23 deletions

View File

@ -9,7 +9,6 @@
var EventEmitter = require('events').EventEmitter;
var bcoin = require('./env');
var utils = require('./utils');
var assert = utils.assert;
var constants = bcoin.protocol.constants;
var chachapoly = require('./chachapoly');
@ -63,7 +62,7 @@ BIP151.prototype.init = function init(publicKey) {
this.chacha.init(this.k1, this.iv());
this.aead.init(this.k2, this.iv());
this.aead.aad(this.sid);
}
};
BIP151.prototype.rekey = function rekey() {
this.mac = utils.hash256(this.mac);
@ -94,7 +93,7 @@ BIP151.prototype.getPublicKey = function getPublicKey() {
};
BIP151.prototype.encryptSize = function encryptSize(size) {
var b = new Buffer(4);
var data = new Buffer(4);
data.writeUInt32LE(size, 0, true);
return this.chacha.encrypt(data);
};

View File

@ -70,7 +70,6 @@ CompactBlock.fromOptions = function fromOptions(options) {
CompactBlock.prototype.fromRaw = function fromRaw(data) {
var p = bcoin.reader(data);
var last = 0;
var i, count, index, tx;
this.version = p.readU32(); // Technically signed
@ -206,7 +205,7 @@ CompactBlock.prototype.fillMempool = function fillMempool(mempool, callback) {
CompactBlock.prototype.fillMissing = function fillMissing(missing) {
var offset = 0;
var i, tx;
var i;
for (i = 0; i < this.available.length; i++) {
if (this.available[i])
@ -440,7 +439,7 @@ BlockTXRequest.prototype.toRaw = function toRaw(writer) {
* @constructor
*/
function BlockTX() {
function BlockTX(options) {
if (!(this instanceof BlockTX))
return new BlockTX(options);

View File

@ -971,8 +971,6 @@ HDPrivateKey.fromSeed = function fromSeed(seed, network) {
*/
HDPrivateKey.prototype.fromMnemonic = function fromMnemonic(mnemonic, network) {
var key;
if (!(mnemonic instanceof Mnemonic))
mnemonic = new Mnemonic(mnemonic);

View File

@ -201,8 +201,7 @@ KeyPair.prototype.toSecret = function toSecret(network) {
KeyPair.prototype.fromRaw = function fromRaw(data) {
var p = new BufferReader(data, true);
var compressed = false;
var i, prefix, version, type, privateKey;
var i, prefix, version, type;
version = p.readU8();
@ -301,7 +300,7 @@ KeyPair.prototype.fromJSON = function fromJSON(json) {
* @returns {KeyPair}
*/
KeyPair.fromJSON = function fromJSON(passphrase) {
KeyPair.fromJSON = function fromJSON(json) {
return new KeyPair().fromJSON(json);
};

View File

@ -4069,7 +4069,7 @@ Script.verifyProgram = function verifyProgram(witness, output, flags, tx, i) {
var program = output.toProgram();
var stack = witness.toStack();
var witnessScript, redeem, j;
var hash, pathdata, depth, path, posdata, pos, depth, root;
var hash, pathdata, depth, path, posdata, pos, root;
assert(program, 'verifyProgram called on non-witness-program.');
assert((flags & constants.flags.VERIFY_WITNESS) !== 0);

View File

@ -117,9 +117,8 @@ TXDB.prototype._testFilter = function _testFilter(addresses) {
*/
TXDB.prototype.getMap = function getMap(tx, callback) {
var i, input, output, address, addresses, map;
addresses = tx.getHashes('hex');
var addresses = tx.getHashes('hex');
var map;
if (!this._testFilter(addresses))
return callback();
@ -1939,7 +1938,7 @@ MapMember.prototype.toJSON = function toJSON() {
};
MapMember.prototype.fromJSON = function fromJSON(json) {
var i, account, path;
var i, path;
this.id = json.id;
this.name = json.name;

View File

@ -737,7 +737,7 @@ Wallet.prototype.getInputPaths = function getInputPaths(tx, callback) {
if (tx instanceof bcoin.input) {
if (!tx.coin)
return callback(new Error('Not all coins available.'));
hash = tx.coin.getHash('hex')
hash = tx.coin.getHash('hex');
if (hash)
hashes.push(hash);
return done();
@ -1543,8 +1543,6 @@ Wallet.isWallet = function isWallet(obj) {
*/
function Account(db, options) {
var i;
if (!(this instanceof Account))
return new Account(db, options);
@ -1587,6 +1585,8 @@ utils.inherits(Account, EventEmitter);
*/
Account.prototype.fromOptions = function fromOptions(options) {
var i;
assert(options, 'Options are required.');
assert(options.id, 'Wallet ID is required.');
assert(options.accountKey, 'Account key is required.');
@ -2245,7 +2245,7 @@ Account.prototype.fromJSON = function fromJSON(json) {
this.accountKey = bcoin.hd.fromBase58(json.accountKey);
for (i = 0; i < json.keys.length; i++)
this.keys.push(bcoin.hd.fromBase58(key));
this.keys.push(bcoin.hd.fromBase58(json.keys[i]));
return this;
};

View File

@ -20,6 +20,7 @@ var bcoin = require('./env');
var EventEmitter = require('events').EventEmitter;
var utils = require('./utils');
var assert = utils.assert;
var constants = bcoin.protocol.constants;
var BufferReader = require('./reader');
var BufferWriter = require('./writer');
@ -1046,8 +1047,6 @@ WalletDB.prototype.removeBlock = function removeBlock(block, callback) {
*/
WalletDB.prototype.fetchWallet = function fetchWallet(id, callback, handler) {
var self = this;
this.get(id, function(err, wallet) {
if (err)
return callback(err);
@ -1260,7 +1259,7 @@ Path.prototype.fromKey = function fromKey(key) {
return this;
};
Path.fromKey = function fromKey(json) {
Path.fromKey = function fromKey(key) {
return new Path().fromKey(key);
};