diff --git a/index.js b/index.js index b602d05..e6e367e 100644 --- a/index.js +++ b/index.js @@ -16,11 +16,11 @@ const rlp = ethUtil.rlp // geth compatible db keys const headHeaderKey = 'LastHeader' // current canonical head for light sync const headBlockKey = 'LastBlock' // current canonical head for full sync -const headerPrefix = new Buffer('h') // headerPrefix + number + hash -> header -const tdSuffix = new Buffer('t') // headerPrefix + number + hash + tdSuffix -> td -const numSuffix = new Buffer('n') // headerPrefix + number + numSuffix -> hash -const blockHashPrefix = new Buffer('H') // blockHashPrefix + hash -> number -const bodyPrefix = new Buffer('b') // bodyPrefix + number + hash -> block body +const headerPrefix = Buffer.from('h') // headerPrefix + number + hash -> header +const tdSuffix = Buffer.from('t') // headerPrefix + number + hash + tdSuffix -> td +const numSuffix = Buffer.from('n') // headerPrefix + number + numSuffix -> hash +const blockHashPrefix = Buffer.from('H') // blockHashPrefix + hash -> number +const bodyPrefix = Buffer.from('b') // bodyPrefix + number + hash -> block body // utility functions const bufBE8 = n => n.toArrayLike(Buffer, 'be', 8) // convert BN to big endian Buffer