Browse Source

Update rng function

In case someone copy pastes, instead of getting a dangerous key, they will get a random key, and a console error.
v4
Jonathan Underwood 6 years ago
committed by GitHub
parent
commit
f8490b6c0d
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 9
      test/integration/addresses.js

9
test/integration/addresses.js

@ -15,7 +15,14 @@ const LITECOIN = {
}
// 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 () {
it('can generate a random address', function () {

Loading…
Cancel
Save