fix buffertool's fill calls
This commit is contained in:
parent
d96181898a
commit
bf0010b8ac
|
@ -19,6 +19,7 @@ module.exports.Peer = require('./Peer');
|
||||||
module.exports.Block = require('./Block');
|
module.exports.Block = require('./Block');
|
||||||
module.exports.Connection = require('./Connection');
|
module.exports.Connection = require('./Connection');
|
||||||
module.exports.ScriptInterpreter = require('./ScriptInterpreter');
|
module.exports.ScriptInterpreter = require('./ScriptInterpreter');
|
||||||
|
module.exports.networks = require('./networks');
|
||||||
|
|
||||||
|
|
||||||
if (typeof process.versions === 'undefined') {
|
if (typeof process.versions === 'undefined') {
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
var Put = require('bufferput');
|
var Put = require('bufferput');
|
||||||
|
var buffertools = require('buffertools');
|
||||||
var hex = function(hex) {return new Buffer(hex, 'hex');};
|
var hex = function(hex) {return new Buffer(hex, 'hex');};
|
||||||
|
|
||||||
exports.livenet = {
|
exports.livenet = {
|
||||||
|
@ -10,7 +11,7 @@ exports.livenet = {
|
||||||
nonce: 2083236893,
|
nonce: 2083236893,
|
||||||
version: 1,
|
version: 1,
|
||||||
hash: hex('6FE28C0AB6F1B372C1A6A246AE63F74F931E8365E15A089C68D6190000000000'),
|
hash: hex('6FE28C0AB6F1B372C1A6A246AE63F74F931E8365E15A089C68D6190000000000'),
|
||||||
prev_hash: new Buffer(32).fill(0),
|
prev_hash: buffertools.fill(new Buffer(32), 0),
|
||||||
timestamp: 1231006505,
|
timestamp: 1231006505,
|
||||||
merkle_root: hex('3BA3EDFD7A7B12B27AC72C3E67768F617FC81BC3888A51323A9FB8AA4B1E5E4A'),
|
merkle_root: hex('3BA3EDFD7A7B12B27AC72C3E67768F617FC81BC3888A51323A9FB8AA4B1E5E4A'),
|
||||||
bits: 486604799
|
bits: 486604799
|
||||||
|
@ -53,7 +54,7 @@ exports.testnet = {
|
||||||
nonce: 414098458,
|
nonce: 414098458,
|
||||||
version: 1,
|
version: 1,
|
||||||
hash: hex('43497FD7F826957108F4A30FD9CEC3AEBA79972084E90EAD01EA330900000000'),
|
hash: hex('43497FD7F826957108F4A30FD9CEC3AEBA79972084E90EAD01EA330900000000'),
|
||||||
prev_hash: new Buffer(32).fill(0),
|
prev_hash: buffertools.fill(new Buffer(32), 0),
|
||||||
timestamp: 1296688602,
|
timestamp: 1296688602,
|
||||||
merkle_root: hex('3BA3EDFD7A7B12B27AC72C3E67768F617FC81BC3888A51323A9FB8AA4B1E5E4A'),
|
merkle_root: hex('3BA3EDFD7A7B12B27AC72C3E67768F617FC81BC3888A51323A9FB8AA4B1E5E4A'),
|
||||||
bits: 486604799,
|
bits: 486604799,
|
||||||
|
|
|
@ -225,7 +225,8 @@ var decodeDiffBits = exports.decodeDiffBits = function (diffBits, asBigInt) {
|
||||||
|
|
||||||
// Convert to buffer
|
// Convert to buffer
|
||||||
var diffBuf = target.toBuffer();
|
var diffBuf = target.toBuffer();
|
||||||
var targetBuf = new Buffer(32).fill(0);
|
var targetBuf = new Buffer(32);
|
||||||
|
buffertools.fill(targetBuf, 0);
|
||||||
diffBuf.copy(targetBuf, 32-diffBuf.length);
|
diffBuf.copy(targetBuf, 32-diffBuf.length);
|
||||||
return targetBuf;
|
return targetBuf;
|
||||||
};
|
};
|
||||||
|
@ -325,11 +326,9 @@ var varStrBuf = exports.varStrBuf = function varStrBuf(s) {
|
||||||
};
|
};
|
||||||
|
|
||||||
// Initializations
|
// Initializations
|
||||||
exports.NULL_HASH = new Buffer(32)
|
exports.NULL_HASH = buffertools.fill(new Buffer(32), 0);
|
||||||
buffertools.fill(exports.NULL_HASH, 0);
|
|
||||||
exports.EMPTY_BUFFER = new Buffer(0);
|
exports.EMPTY_BUFFER = new Buffer(0);
|
||||||
exports.ZERO_VALUE = new Buffer(8)
|
exports.ZERO_VALUE = buffertools.fill(new Buffer(8), 0);
|
||||||
buffertools.fill(exports.ZERO_VALUE, 0);
|
|
||||||
var INT64_MAX = new Buffer('ffffffffffffffff', 'hex');
|
var INT64_MAX = new Buffer('ffffffffffffffff', 'hex');
|
||||||
exports.INT64_MAX = INT64_MAX;
|
exports.INT64_MAX = INT64_MAX;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue