Merge pull request from bitcoinjs/buremove

Remove bufferutils
This commit is contained in:
Daniel Cousens 2018-04-30 10:41:27 +10:00 committed by GitHub
commit 6b3c41a06c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 22 additions and 207 deletions

View file

@ -1,6 +1,3 @@
var pushdata = require('pushdata-bitcoin')
var varuint = require('varuint-bitcoin')
// https://github.com/feross/buffer/blob/master/index.js#L1127
function verifuint (value, max) {
if (typeof value !== 'number') throw new Error('cannot write a non-number as a number')
@ -15,7 +12,6 @@ function readUInt64LE (buffer, offset) {
b *= 0x100000000
verifuint(b + a, 0x001fffffffffffff)
return b + a
}
@ -27,30 +23,7 @@ function writeUInt64LE (buffer, value, offset) {
return offset + 8
}
// TODO: remove in 4.0.0?
function readVarInt (buffer, offset) {
var result = varuint.decode(buffer, offset)
return {
number: result,
size: varuint.decode.bytes
}
}
// TODO: remove in 4.0.0?
function writeVarInt (buffer, number, offset) {
varuint.encode(number, buffer, offset)
return varuint.encode.bytes
}
module.exports = {
pushDataSize: pushdata.encodingLength,
readPushDataInt: pushdata.decode,
readUInt64LE: readUInt64LE,
readVarInt: readVarInt,
varIntBuffer: varuint.encode,
varIntSize: varuint.encodingLength,
writePushDataInt: pushdata.encode,
writeUInt64LE: writeUInt64LE,
writeVarInt: writeVarInt
writeUInt64LE: writeUInt64LE
}

View file

@ -6,8 +6,6 @@ for (var key in templates) {
}
module.exports = {
bufferutils: require('./bufferutils'), // TODO: remove in 4.0.0
Block: require('./block'),
ECPair: require('./ecpair'),
ECSignature: require('./ecsignature'),