Merge branch 'master' into __tx

This commit is contained in:
Daniel Cousens 2018-04-30 10:43:44 +10:00 committed by GitHub
commit 024c541d7e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 134 additions and 237 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'),

View file

@ -476,6 +476,7 @@ function TransactionBuilder (network, maximumFeeRate) {
this.__inputs = []
this.__tx = new Transaction()
this.tx.version = 2
}
TransactionBuilder.prototype.setLockTime = function (locktime) {