Update rng function
In case someone copy pastes, instead of getting a dangerous key, they will get a random key, and a console error.
This commit is contained in:
parent
b93d9d99cc
commit
f8490b6c0d
1 changed files with 8 additions and 1 deletions
|
@ -15,7 +15,14 @@ const LITECOIN = {
|
||||||
}
|
}
|
||||||
|
|
||||||
// deterministic RNG for testing only
|
// deterministic RNG for testing only
|
||||||
function rng () { return Buffer.from('zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz') }
|
function rng (c) {
|
||||||
|
if (describe === undefined || it === undefined) {
|
||||||
|
console.error('DO NOT USE THIS rng FUNCTION OUTSIDE OF AUTOMATED TESTING!')
|
||||||
|
const randomBytes = require('randombytes')
|
||||||
|
return randomBytes(c)
|
||||||
|
}
|
||||||
|
return Buffer.from('zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz')
|
||||||
|
}
|
||||||
|
|
||||||
describe('bitcoinjs-lib (addresses)', function () {
|
describe('bitcoinjs-lib (addresses)', function () {
|
||||||
it('can generate a random address', function () {
|
it('can generate a random address', function () {
|
||||||
|
|
Loading…
Reference in a new issue