bcoin-org / bcoin

Javascript bitcoin library for node.js and browsers
https://bcoin.io
Other
2.98k stars 811 forks source link

updated walletdb.js #1145

Closed Rkvishnu closed 1 year ago

Rkvishnu commented 1 year ago

//Outpoint generation: The current implementation generates a random outpoint using the random.randomBytes() function, which can be slow.

function dummy() { const hash = random.randomBytes(32); return new Outpoint(hash, 0); }

// MY SOLUTION---> 👇👇 // To optimize this, we can use a faster random number generator, such as crypto.randomBytes().

async function dummy() { const hash = await crypto.randomBytes(32); const index= Math.floor(Math.random() * 1000); return new Outpoint(hash, index); }

theanmolsharma commented 1 year ago

This is a file used to benchmark the performance of walletDB, since this is not performance critical, making it faster would not yield any fruitful outcome. Thanks for the efforts though.