drop old fee and dust constants. style.

This commit is contained in:
Christopher Jeffrey 2015-12-20 01:46:49 -08:00
parent a50ee3e0ba
commit 93e42e90a1
2 changed files with 12 additions and 15 deletions

View File

@ -642,6 +642,12 @@ function randomBytes(size) {
return Array.prototype.slice.call(crypto.randomBytes(size));
}
function array32(data) {
var b = [];
utils.writeU32BE(b, data, 0);
return b;
}
/**
* PDKBF2
* Credit to: https://github.com/stayradiated/pbkdf2-sha512
@ -681,10 +687,10 @@ function pbkdf2(key, salt, iterations, dkLen) {
utils.copy(salt.slice(0, salt.length), block1, 0);
for (i = 1; i <= l; i++) {
block1[salt.length + 0] = (i >> 24 & 0xff);
block1[salt.length + 1] = (i >> 16 & 0xff);
block1[salt.length + 2] = (i >> 8 & 0xff);
block1[salt.length + 3] = (i >> 0 & 0xff);
block1[salt.length + 0] = i >> 24 & 0xff;
block1[salt.length + 1] = i >> 16 & 0xff;
block1[salt.length + 2] = i >> 8 & 0xff;
block1[salt.length + 3] = i >> 0 & 0xff;
U = sha512hmac(block1, key);
@ -698,19 +704,13 @@ function pbkdf2(key, salt, iterations, dkLen) {
}
destPos = (i - 1) * hLen;
len = (i === l ? r : hLen);
len = i === l ? r : hLen;
utils.copy(T.slice(0, len), DK, 0);
}
return DK;
}
function array32(data) {
var b = [];
utils.writeU32BE(b, data, 0);
return b;
}
/**
* Expose
*/

View File

@ -86,10 +86,6 @@ function Wallet(options, passphrase) {
this.tx = new bcoin.txPool(this);
// Just a constants, actually
this.fee = 10000;
this.dust = 5460;
this._init();
}
@ -352,6 +348,7 @@ Wallet.addr2hash = function addr2hash(addr, prefix) {
return [];
chk = utils.checksum(addr.slice(0, -4));
if (utils.readU32(chk, 0) !== utils.readU32(addr, 21))
return [];