bufferutils: add varIntBuffer
This commit is contained in:
parent
c0c47f076a
commit
2214ccfdd8
4 changed files with 22 additions and 10 deletions
src
|
@ -120,13 +120,7 @@ Block.prototype.toBuffer = function(headersOnly) {
|
|||
|
||||
if (headersOnly || !this.transactions) return buffer
|
||||
|
||||
function varIntBuffer(i) {
|
||||
var ib = new Buffer(bufferutils.varIntSize(i))
|
||||
bufferutils.writeVarInt(ib, i, 0)
|
||||
return ib
|
||||
}
|
||||
|
||||
var txLenBuffer = varIntBuffer(this.transactions.length)
|
||||
var txLenBuffer = bufferutils.varIntBuffer(this.transactions.length)
|
||||
var txBuffers = this.transactions.map(function(tx) {
|
||||
return tx.toBuffer()
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue